Loading build/aws-marketplace/Dockerfile +5 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,11 @@ RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2 RUN unzip awscliv2.zip RUN ./aws/install #install psql for setup RUN apt-get update -y RUN apt-get install -y postgresql-client COPY ./build/aws-marketplace/setup.sh /setup.sh COPY ./build/aws-marketplace/start.sh /start.sh RUN chmod a+x /start.sh ENTRYPOINT [ "/start.sh" ] build/aws-marketplace/README.md +15 −1 Original line number Diff line number Diff line # Cloud Build Variables # Release process The images for AWS Marketplace are tagged the same way the Nakama itself is tagged. Each new tag of Nakama triggers a build for the same tag of the AWS Marketplace image. ## Marketplace Product Version When a new Marketplace image is published by the cloudbuild it must be registered manually in the Marketplace product. This is done by a Change Request - Add new version. The contents of the version specification can be copied from pervious available version and the tag numbers changed in version description and launch link. ## Cloud Build Variables The following variables are present in the cloudbuild environment: _MAP_ECR_REPOSITORY _AWS_ACCESS_KEY_ID Loading build/aws-marketplace/cloudbuild.yaml +1 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,6 @@ steps: - '-ec' - | source ~/.heroic-ecr-secret && \ docker tag nakama-awsmp:${TAG#v} $_MAP_ECR_REPOSITORY:${TAG#v} docker tag nakama-awsmp:${TAG#v} $_MAP_ECR_REPOSITORY:$TAG images: - $_MAP_ECR_REPOSITORY build/aws-marketplace/setup.sh 0 → 100644 +17 −0 Original line number Diff line number Diff line #!/bin/bash set -e psql postgres://$1:$2@$3:5432 -q -c "CREATE USER nakama WITH PASSWORD 'nakama';" psql postgres://$1:$2@$3:5432 -q -c "ALTER USER nakama CREATEDB;" psql postgres://$1:$2@$3:5432 -q -c "CREATE DATABASE \"nakama\";" psql postgres://$1:$2@$3:5432 -q -c "GRANT ALL PRIVILEGES ON DATABASE nakama TO nakama;" psql postgres://$1:$2@$3:5432/nakama -q -c "CREATE EXTENSION IF NOT EXISTS \"btree_gin\";" psql postgres://$1:$2@$3:5432/nakama -q -c "CREATE EXTENSION IF NOT EXISTS \"btree_gist\";" psql postgres://$1:$2@$3:5432/nakama -q -c "CREATE EXTENSION IF NOT EXISTS \"fuzzystrmatch\";" psql postgres://$1:$2@$3:5432/nakama -q -c "CREATE EXTENSION IF NOT EXISTS \"pgrowlocks\";" psql postgres://$1:$2@$3:5432/nakama -q -c "CREATE EXTENSION IF NOT EXISTS \"pg_stat_statements\";" psql postgres://$1:$2@$3:5432/nakama -q -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" psql postgres://$1:$2@$3:5432/nakama -q -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" psql postgres://$1:$2@$3:5432/nakama -q -c "GRANT EXECUTE ON FUNCTION pg_stat_statements_reset TO nakama;" psql postgres://$1:$2@$3:5432/nakama -q -c "GRANT pg_monitor TO nakama;" build/aws-marketplace/start.sh +17 −16 Original line number Diff line number Diff line #!/bin/bash set -e if [[ -z "$1" ]]; then echo "the first argument must be a database host" echo "the first argument must be a database username" exit 1; fi if [[ -z "$2" ]]; then echo "the second argument must be a database password for the postgres user" echo "the second argument must be a database password" exit 1; fi /nakama/nakama migrate up --database.address postgres:$2@$1:5432 if [ $? -ne 0 ]; then if [[ -z "$3" ]]; then echo "the third argument must be a database host" exit 1; fi if [[ "$4" == "-setup" ]]; then source /setup.sh exit 0; fi /nakama/nakama migrate up --database.address nakama:nakama@$3:5432/nakama rm -rf /nakama-data/* if [ $? -ne 0 ]; then exit 2; fi mkdir -p /nakama-data && touch /nakama-data/config.yaml if [ $? -ne 0 ]; then exit 2; fi if [[ ! -z "$3" ]]; then aws s3 cp s3://$3/ /nakama-data/ --recursive if [ $? -ne 0 ]; then exit 3; fi if [[ ! -z "$4" ]]; then aws s3 cp s3://$4/ /nakama-data/ --recursive fi /nakama/nakama --config /nakama-data/config.yaml --data_dir /nakama-data --runtime.path /nakama-data --database.address postgres:$2@$1:5432 No newline at end of file /nakama/nakama --config /nakama-data/config.yaml --data_dir /nakama-data --runtime.path /nakama-data --database.address nakama:nakama@$3:5432/nakama Loading
build/aws-marketplace/Dockerfile +5 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,11 @@ RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2 RUN unzip awscliv2.zip RUN ./aws/install #install psql for setup RUN apt-get update -y RUN apt-get install -y postgresql-client COPY ./build/aws-marketplace/setup.sh /setup.sh COPY ./build/aws-marketplace/start.sh /start.sh RUN chmod a+x /start.sh ENTRYPOINT [ "/start.sh" ]
build/aws-marketplace/README.md +15 −1 Original line number Diff line number Diff line # Cloud Build Variables # Release process The images for AWS Marketplace are tagged the same way the Nakama itself is tagged. Each new tag of Nakama triggers a build for the same tag of the AWS Marketplace image. ## Marketplace Product Version When a new Marketplace image is published by the cloudbuild it must be registered manually in the Marketplace product. This is done by a Change Request - Add new version. The contents of the version specification can be copied from pervious available version and the tag numbers changed in version description and launch link. ## Cloud Build Variables The following variables are present in the cloudbuild environment: _MAP_ECR_REPOSITORY _AWS_ACCESS_KEY_ID Loading
build/aws-marketplace/cloudbuild.yaml +1 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,6 @@ steps: - '-ec' - | source ~/.heroic-ecr-secret && \ docker tag nakama-awsmp:${TAG#v} $_MAP_ECR_REPOSITORY:${TAG#v} docker tag nakama-awsmp:${TAG#v} $_MAP_ECR_REPOSITORY:$TAG images: - $_MAP_ECR_REPOSITORY
build/aws-marketplace/setup.sh 0 → 100644 +17 −0 Original line number Diff line number Diff line #!/bin/bash set -e psql postgres://$1:$2@$3:5432 -q -c "CREATE USER nakama WITH PASSWORD 'nakama';" psql postgres://$1:$2@$3:5432 -q -c "ALTER USER nakama CREATEDB;" psql postgres://$1:$2@$3:5432 -q -c "CREATE DATABASE \"nakama\";" psql postgres://$1:$2@$3:5432 -q -c "GRANT ALL PRIVILEGES ON DATABASE nakama TO nakama;" psql postgres://$1:$2@$3:5432/nakama -q -c "CREATE EXTENSION IF NOT EXISTS \"btree_gin\";" psql postgres://$1:$2@$3:5432/nakama -q -c "CREATE EXTENSION IF NOT EXISTS \"btree_gist\";" psql postgres://$1:$2@$3:5432/nakama -q -c "CREATE EXTENSION IF NOT EXISTS \"fuzzystrmatch\";" psql postgres://$1:$2@$3:5432/nakama -q -c "CREATE EXTENSION IF NOT EXISTS \"pgrowlocks\";" psql postgres://$1:$2@$3:5432/nakama -q -c "CREATE EXTENSION IF NOT EXISTS \"pg_stat_statements\";" psql postgres://$1:$2@$3:5432/nakama -q -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" psql postgres://$1:$2@$3:5432/nakama -q -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" psql postgres://$1:$2@$3:5432/nakama -q -c "GRANT EXECUTE ON FUNCTION pg_stat_statements_reset TO nakama;" psql postgres://$1:$2@$3:5432/nakama -q -c "GRANT pg_monitor TO nakama;"
build/aws-marketplace/start.sh +17 −16 Original line number Diff line number Diff line #!/bin/bash set -e if [[ -z "$1" ]]; then echo "the first argument must be a database host" echo "the first argument must be a database username" exit 1; fi if [[ -z "$2" ]]; then echo "the second argument must be a database password for the postgres user" echo "the second argument must be a database password" exit 1; fi /nakama/nakama migrate up --database.address postgres:$2@$1:5432 if [ $? -ne 0 ]; then if [[ -z "$3" ]]; then echo "the third argument must be a database host" exit 1; fi if [[ "$4" == "-setup" ]]; then source /setup.sh exit 0; fi /nakama/nakama migrate up --database.address nakama:nakama@$3:5432/nakama rm -rf /nakama-data/* if [ $? -ne 0 ]; then exit 2; fi mkdir -p /nakama-data && touch /nakama-data/config.yaml if [ $? -ne 0 ]; then exit 2; fi if [[ ! -z "$3" ]]; then aws s3 cp s3://$3/ /nakama-data/ --recursive if [ $? -ne 0 ]; then exit 3; fi if [[ ! -z "$4" ]]; then aws s3 cp s3://$4/ /nakama-data/ --recursive fi /nakama/nakama --config /nakama-data/config.yaml --data_dir /nakama-data --runtime.path /nakama-data --database.address postgres:$2@$1:5432 No newline at end of file /nakama/nakama --config /nakama-data/config.yaml --data_dir /nakama-data --runtime.path /nakama-data --database.address nakama:nakama@$3:5432/nakama