Unverified Commit 491ddb2f authored by Michal Harish's avatar Michal Harish Committed by GitHub
Browse files

Remove deprecated AWS Marketplace builder (#756)

parent 56ab66f6
Loading
Loading
Loading
Loading

build/aws-marketplace/Dockerfile

deleted100644 → 0
+0 −16
Original line number Diff line number Diff line
ARG VERSION=latest
FROM heroiclabs/nakama:$VERSION

#cannot use s3cmd because it's not an official aws tool and doesn't support standard aws credential chain
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
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

deleted100644 → 0
+0 −24
Original line number Diff line number Diff line
# 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:

1. First a AWS Marketplace Seller 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.
2. When the AWS Marketplace Change Request is applied, the new version must be added to the cloudformation
   template and the template be updated in the marketplace root S3 bucket.

## Cloud Build Variables

The following variables are present in the cloudbuild environment:

    _MAP_ECR_REPOSITORY
    _AWS_ACCESS_KEY_ID
    _AWS_SECRET_ACCESS_KEY
    _AWS_DEFAULT_REGION
+0 −24
Original line number Diff line number Diff line
timeout: 900s
steps:
  - name: 'gcr.io/cloud-builders/docker'
    entrypoint: sh
    env: ["TAG=$TAG_NAME"]
    args:
      - '-c'
      - 'docker build . --file ./build/aws-marketplace/Dockerfile --build-arg VERSION=${TAG#v} -t nakama-awsmp:${TAG#v}'
  - name: gcr.io/$PROJECT_ID/awscli
    env: ["AWS_ACCESS_KEY_ID=$_AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY=$_AWS_SECRET_ACCESS_KEY", "AWS_DEFAULT_REGION=$_AWS_DEFAULT_REGION"]
    entrypoint: sh
    args:
      - '-c'
      - 'aws ecr get-login --no-include-email > ~/.heroic-ecr-secret'
  - name: 'gcr.io/cloud-builders/docker'
    entrypoint: bash
    env: ["TAG=$TAG_NAME"]
    args:
      - '-ec'
      - |
        source ~/.heroic-ecr-secret && \
        docker tag nakama-awsmp:${TAG#v} $_MAP_ECR_REPOSITORY:$TAG
images:
  - $_MAP_ECR_REPOSITORY

build/aws-marketplace/setup.sh

deleted100644 → 0
+0 −17
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

deleted100644 → 0
+0 −35
Original line number Diff line number Diff line
#!/bin/bash

set -e

if [[ -z "$1" ]]; then
  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"
  exit 1;
fi

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/*

mkdir -p /nakama-data && touch /nakama-data/config.yaml

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 nakama:nakama@$3:5432/nakama