A command line app for supporting AccelByte Gaming Services (AGS) Extend use cases.
β This repository contains binary release only.
Latest builds can be downloaded from releases page.
β οΈ We recommend to always use the latest version available: For new projects, please avoid using v0.0.3 and below.
-
Docker (Docker Desktop 4.30+/Docker Engine v23.0+)
-
On Linux Ubuntu:
- To install from the Ubuntu repository, run
sudo apt update && sudo apt install docker.io docker-buildx docker-compose-v2. - Add your user to the
dockergroup:sudo usermod -aG docker $USER. - Log out and log back in to allow the changes to take effect.
- To install from the Ubuntu repository, run
-
On Windows or macOS:
Follow Docker's documentation on installing the Docker Desktop on Windows or macOS.
docker version ... Server: Docker Desktop Engine: Version: 24.0.5
-
-
Access to AGS environment. Keep the
Base URL.- Example for AGS Shared Cloud:
https://spaceshooter.prod.gamingservices.accelbyte.io - Example for AGS Private Cloud:
https://dev.customer.accelbyte.io
- Example for AGS Shared Cloud:
-
Create an OAuth Client with
confidentialclient type with the following permission. Keep theClient IDandClient Secret.For AGS Private Cloud customers:
ADMIN:NAMESPACE:{namespace}:EXTEND:APP [CREATE, READ, UPDATE, DELETE]ADMIN:NAMESPACE:{namespace}:EXTEND:DEPLOYMENT [CREATE]ADMIN:NAMESPACE:{namespace}:EXTEND:REPOCREDENTIALS [READ]ADMIN:NAMESPACE:{namespace}:EXTEND:SECRET [CREATE, READ, UPDATE]ADMIN:NAMESPACE:{namespace}:EXTEND:VARIABLE [CREATE, READ, UPDATE]ADMIN:NAMESPACE:{namespace}:EXTEND:TUNNEL [READ]
For AGS Shared Cloud customers:
- Extend > App Management (Read, Create, Update, Delete)
- Extend > Deployment Management (Create)
- Extend > Extend app image repository access (Read)
- Extend > Configuration Secret Management (Read, Create, Update)
- Extend > Configuration Variable Management (Read, Create, Update)
- Extend > TCP Tunneling (Read)
Set the variables required by this command line app.
Execute the following commands depending on your operating system.
For Linux, Windows (WSL2), and macOS:
# Base URL of AccelByte Gaming Services e.g. https://test.accelbyte.io
export AB_BASE_URL='https://xxxxxxxxxx'
# Use Client ID and Client Secret from the Prerequisites section
export AB_CLIENT_ID='xxxxxxxxxx'
export AB_CLIENT_SECRET='xxxxxxxxxx'For Windows (Command Prompt):
rem Base URL of AccelByte Gaming Services e.g. https://test.accelbyte.io
set AB_BASE_URL=https://xxxxxxxxxx
rem Use Client ID and Client Secret from the Prerequisites section
set AB_CLIENT_ID=xxxxxxxxxx
set AB_CLIENT_SECRET=xxxxxxxxxxPut the variables in a .env file in the directory where this command line app will be executed.
AB_BASE_URL='https://xxxxxxxxxx'
AB_CLIENT_ID='xxxxxxxxxx'
AB_CLIENT_SECRET='xxxxxxxxxx'
Use create-app command to create an Extend App.
extend-helper-cli create-app --namespace <my-game-namespace> --app <my-extend-app> --scenario service-extension --confirmThe output will look like the following.
{
"appId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"appName": "<my-extend-app>",
"appRepoArn": "",
"appRepoUrl": "",
"basePath": "xxx-xxxx-xxxx",
"CPU": {
"cpuLimit": 1550,
"requestCPU": 1000
},
"createdAt": "2024-01-01T00:00:00.000Z",
"deletedAt": "",
"deploymentCreatedAt": "",
"deploymentId": "",
"deploymentImageTag": "",
"memory": {
"memoryLimit": 3300,
"requestMemory": 350
},
"message": "",
"replica": {
"maxReplica": 10,
"minReplica": 1,
"replicaLimit": 60
},
"scenario": "service-extension",
"servicePublicURL": "https://xxxx.accelbyte.io/xxx-xxxx-xxxx",
"serviceURL": "",
"updatedAt": "2024-01-31T00:00:00.000Z"
}
π‘ You can also add
--wait(and--wait-interval <duration-in-seconds:10>,--wait-limit <duration-in-seconds:300>) to wait for the app to be ready for image upload/deployment.
Use dockerlogin command to authenticate Docker with the Extend App container registry. It runs docker login for you using credentials scoped to the given game namespace and Extend App.
extend-helper-cli dockerlogin --namespace <my-game-namespace> --app <my-extend-app>
β οΈ The credentials can be used only for a specific game namespace and Extend App: For different game namespace and Extend App, you will need to use this command again.
The output of a successful login looks like the following.
INFO[0000] signing in to https://dev.accelbyte.io
INFO[0001] getting docker credentials...
WARNING! Your password will be stored unencrypted in /home/xyz-abc/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeededπ‘ To print the credentials instead of logging in (for example, to use them in a script), use
--print --format=token(raw password only).
To build your Extend App container image, tag it, and push it to the Extend App container registry, use image-upload command.
extend-helper-cli image-upload --namespace <my-game-namespace> --app <my-extend-app>
--image-tag v1.0.0
--work-dir <path-to-directory-containing-service-dockerfile>π‘ You can also use the
--loginflag to automatically executedockerloginbeforehand so that you do not have to execute it separately.
extend-helper-cli image-upload --namespace <my-game-namespace> --app <my-extend-app>
--image-tag v1.0.0
--work-dir <path-to-directory-containing-service-dockerfile>
--loginπ‘ You can also add
--retry-limit(and--retry-interval <duration-in-seconds:1.0>,--retry-rate <duration-in-seconds:2.0>) to tell the CLI to retry the upload whenever it fails.
extend-helper-cli image-upload --namespace <my-game-namespace> --app <my-extend-app>
--image-tag v1.0.0
--work-dir <path-to-directory-containing-service-dockerfile>
--retry-limit 3Use get-app-info command to get a specific Extend App information.
extend-helper-cli get-app-info --namespace <my-game-namespace> --app <my-extend-app>The output will look like the following.
{
"appId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"appName": "<my-extend-app>",
"appRepoArn": "arn:aws:ecr:xxxxxxxxx:xxxxxxxxxxxx:xxxx/xxxx/xxxx/xxxx/xxxx/xxx-xxxx-xxxx/xxxx",
"appRepoUrl": "xxxx.xxxx.xxxx.xxxxxxxxx.xxxx.xxxx/xxxx/xxxx/xxxx/xxxx/xxx-xxxx-xxxx/xxxx",
"appStatus": "app-undeployed",
"app_release_status": "U",
"basePath": "xxx-xxxx-xxxx",
"createdAt": "2024-01-01T00:00:00.000Z",
"scenario": "service-extension",
"updatedAt": "2024-01-31T00:00:00.000Z"
}
If you only need to query a specific field, use --path and pass in a valid JSON pointer.
For example, to get the appName only:
extend-helper-cli get-app-info --namespace <my-game-namespace> --app <my-extend-app> --path /appNameAnother example, to get appRepoUrl only:
extend-helper-cli get-app-info --namespace <my-game-namespace> --app <my-extend-app> --path /appRepoUrlUse list-images command to list the container images that have been pushed for an Extend App.
extend-helper-cli list-images --namespace <my-game-namespace> --app <my-extend-app>The output will look like the following.
{
"data": [
{
"IsActive": true,
"imageDigest": "sha256:xxxxxxxxxxxxxxxx",
"imageTag": "v1.0.0",
"size": 12345678,
"updatedAt": "2024-01-31T00:00:00.000Z"
}
],
"vulnerabilityStatus": "OK"
}
π‘ By default the cached image list is returned. Pass
--cached=falseto force a fresh listing.
βΉοΈ This command requires the
ADMIN:NAMESPACE:{namespace}:EXTEND:IMAGE [READ]permission on your OAuth client.
To extract only what you need (for example, in a script), add --output json and pipe stdout into jq. The API response is passed through verbatim under .serverResponse.csm.response.
For example, to list all image tags:
extend-helper-cli list-images --namespace <my-game-namespace> --app <my-extend-app> --output json \
| jq -r '.serverResponse.csm.response.data[].imageTag'To check whether a specific image tag already exists β for example, in a CI/CD pipeline before building and pushing. Pass --cached=false for a definitive answer (the cached list may not yet reflect a just-pushed tag), and use jq -e so the exit code reflects the result (0 if the tag exists, 1 if not):
extend-helper-cli list-images --namespace <my-game-namespace> --app <my-extend-app> --cached=false --output json \
| jq -e '.serverResponse.csm.response.data | any(.imageTag == "v1.0.0")'Use deploy-app command to create a deployment for an Extend App.
extend-helper-cli deploy-app --namespace <my-game-namespace> --app <my-extend-app> --image-tag v1.0.0The output will look like the following.
{
"deploymentId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
π‘ You can also add
--wait(and--wait-interval <duration-in-seconds:10>,--wait-limit <duration-in-seconds:300>) to wait for the app to finish deployment.
Use the start-app or stop-app command to start or stop an Extend App.
extend-helper-cli start-app --namespace <my-game-namespace> --app <my-extend-app>extend-helper-cli stop-app --namespace <my-game-namespace> --app <my-extend-app>π‘ You can also add
--wait(and--wait-interval <duration-in-seconds:10>,--wait-limit <duration-in-seconds:300>) to wait for the app to be fully started/stopped.
Use the update-var or update-secret command to create new or modify existing Extend App variables or secrets.
extend-helper-cli update-var --namespace <my-game-namespace> --app <my-extend-app> --key REQUEST_TIMEOUT --value 100extend-helper-cli update-secret --namespace <my-game-namespace> --app <my-extend-app> --key API_KEY --value <api-key>π‘ You can also add
--forceto force the command to create the variable or secret if it does not exist yet.
Use the tunnel command to create a secure tunnel to access the databases through a local port.
extend-helper-cli tunnel --resource-name <resource-name> --local-port <local-port> --namespace <my-game-namespace>Or use the short form:
extend-helper-cli tunnel -r <resource-name> -p <local-port> -n <my-game-namespace>For example, to tunnel to a DocumentDB cluster created for your Extend App:
extend-helper-cli tunnel -r extend-nosql-accelbyte-development -p 27019 -n my-game-namespaceYou can find the <resource-name> in the Admin Portal's Extend Service Extension page. Open the detail of your Extend app, click the NoSQL Database tab, and find the information under the Database URL field.
The tunnel will listen on the specified local port and forward connections to the remote resource. You can then connect your database client to localhost:<local-port>.
Use delete-app command to delete an Extend App.
extend-helper-cli delete-app --namespace <my-game-namespace> --app <my-extend-app> --confirmπ‘ You can also add
--wait(and--wait-interval <duration-in-seconds:10>,--wait-limit <duration-in-seconds:300>) to wait for the app to be fully deleted.
Add --output json to any supported command to receive a single JSON object on stdout instead of human-readable text. All log lines are redirected to stderr, so stdout contains only the JSON envelope and can be piped directly into tools like jq, or redirected to a file.
extend-helper-cli create-app --namespace <my-game-namespace> --app <my-extend-app> \
--scenario service-extension --output jsonThe envelope always contains command and result. When the command contacted a server, serverResponse holds the raw HTTP status and response body for each backend called (csm and/or iam).
{
"command": "create-app",
"result": "success",
"serverResponse": {
"csm": {
"httpStatus": 200,
"response": { ... }
}
}
}On failure, result contains the error message and the process exits with code 1:
{
"command": "create-app",
"result": "error: app already exists",
"serverResponse": {
"csm": {
"httpStatus": 409,
"response": { ... }
}
}
}For commands with no server calls (e.g. status, clone-template), serverResponse is omitted.
Supported commands: create-app, deploy-app, start-app, stop-app, delete-app, get-app-info, list-images, update-var, update-secret, clone-template, login, logout, status.
β οΈ --output jsonis not supported ondockerlogin,image-upload, andtunnelbecause their output is inherently streaming. Passing the flag on these commands prints a warning to stderr and the command runs normally.
π‘ When
--output jsonis set and the command would normally show an interactive confirmation prompt (e.g.create-appordelete-appwithout--confirm), the prompt is skipped and the command proceeds automatically. Always use--output jsonin non-interactive environments such as CI/CD pipelines.
When pushing an Extend app container image to AGS, extend-helper-cli dockerlogin ... command returns the following error:
Error saving credentials: error storing credentials - err: exit status 1, out: `error storing credentials - err: exit status 1, out: `The stub received bad data.`
This issue may be due to the token size being larger than most credential managers can handle. See here for more information.
The workaround for this issue depends on your operating system.
For Linux:
-
Remove
"credsStore": "desktop.exe"from$HOME/.docker\config.json. -
Try
extend-helper-cli dockerlogin ...command again.
For Windows (WSL2):
-
In Windows file system:
- Remove
"credsStore": "desktop.exe"from$HOME/.docker\config.json.
- Remove
-
In WSL2 file system:
- Remove
"credsStore": "desktop.exe"from%USERPROFILE%\.docker\config.json. - Rename the following files in
C:\Program Files\Docker\Docker\resources\bin.docker-credential-desktop.exetodocker-credential-desktop.exe.olddocker-credential-wincred.exetodocker-credential-wincred.exe.old
- Remove
-
Try
extend-helper-cli dockerlogin ...command again.
β οΈ You may need to periodically apply this workaround. Docker may restore"credsStore": "desktop"in theconfig.jsonfile when it is restarted. See the discussion here for more information.