You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've added as much info as possible here, not sure of the cause of the problem, but I've put my next thing to check in the "Hypotheses" section. I might have time to look at this later, but it might be the weekend before I can sit down to work this through. Any input appreciated!
Issue
After applying the fix in PR #33, the API endpoints appear to work, but in fact the startstop endpoint is having no effect on the desire count of the ECS service.
Check server status - by looking at the AWS console or using the serverstatus endpoint - at this point if the status is "not running" the response is empty from the serverstatus endpoint:
curl --request GET 'https://[YOUR_API_GATEWAY_DOMAIN]/prod/serverstatus
If the response is blank try starting the task:
curl --request GET 'https://[YOUR_API_GATEWAY_DOMAIN]/prod/startstop?key=[YOUR_API_PASSWORD_FROM_DOTENV_FILE]&desiredCount=1'
... else try to stop the task:
curl --request GET 'https://[YOUR_API_GATEWAY_DOMAIN]/prod/startstop?key=[YOUR_API_PASSWORD_FROM_DOTENV_FILE]&desiredCount=0'
Check the status of the task again, either in the console or by using the API serverstatus endpoint.
Checks
Lambda Logs
The Lambda backing the startstop endpoint logs that it has made the update command - e.g.:
2023-01-20T00:05:18.106Z 732cdc88-f3e5-4a63-a2ac-a4b41237a9d5 INFO starting service
{
"desiredCount": 1,
"service": [SERVICE_ARN],
"cluster": [CLUSTER_ARN]
}
and
2023-01-20T08:37:06.306Z ca083a87-1c9f-4d5d-91d3-d0ddc1c9fd8f INFO changing desiredCount to 0
2023-01-20T08:37:06.389Z ca083a87-1c9f-4d5d-91d3-d0ddc1c9fd8f INFO starting service
{
"desiredCount": 0,
"service": [SERVICE_ARN],
"cluster": [CLUSTER_ARN]
}
Worked it out. It isn't permissions: thankfully! The "startstop" lambda code doesn't await the resolution of the ECS client command - by adding the await keyword the endpoint works as expected.
See PR #35 for fix (and a couple of other improvements).
I've added as much info as possible here, not sure of the cause of the problem, but I've put my next thing to check in the "Hypotheses" section. I might have time to look at this later, but it might be the weekend before I can sit down to work this through. Any input appreciated!
Issue
After applying the fix in PR #33, the API endpoints appear to work, but in fact the startstop endpoint is having no effect on the desire count of the ECS service.
Recreate
serverstatus
endpoint - at this point if the status is "not running" the response is empty from theserverstatus
endpoint:... else try to stop the task:
serverstatus
endpoint.Checks
Lambda Logs
The Lambda backing the
startstop
endpoint logs that it has made the update command - e.g.:and
... but this is having no effect.
The code lines are:
valheim-ecs-fargate-cdk/resources/startstopserver.ts
Lines 34 to 38 in 61bf2bb
valheim-ecs-fargate-cdk/resources/startstopserver.ts
Lines 55 to 60 in 61bf2bb
These match up with use of the ECS client - docs here: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-ecs/classes/updateservicecommand.html
Updating cluster another way
As a sense check, you can use the aws cli to perform the same task:
After performing this command, the cluster responds. The
serverstatus
endpoint reflects the change and also the AWS console can be used to check, too.This command is equivalent to what the Lambda is using - docs are here: https://docs.aws.amazon.com/cli/latest/reference/ecs/update-service.html
Hypotheses
The text was updated successfully, but these errors were encountered: