diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..892e269ec --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,19 @@ +name: Run CI checks + +on: + push: + branches: + - develop + +jobs: + build: + runs-on: [self-hosted, linux] + timeout-minutes: 150 + + steps: + - name: Checkout Repo + uses: actions/checkout@v2 + + - name: Build AMI + run: | + packer build -timestamp-ui -color=false -on-error=abort -var-file common.vars.json -var-file development-arm.vars.json amazon.json diff --git a/amazon.json b/amazon.json index 5a57dc871..63fb266b3 100644 --- a/amazon.json +++ b/amazon.json @@ -1,34 +1,36 @@ { "variables": { - "aws_access_key": "", - "aws_secret_key": "", - "region": "af-south-1", - "ami_regions": "af-south-1", - "ami": "ami-08a4b40f2fe1e4b35", - "ami_name": "supabase-postgres-13.3.0.4", - "environment": "prod", - "ansible_arguments": "--skip-tags,install-postgrest,--skip-tags,install-pgbouncer,--skip-tags,install-supabase-internal" + "profile": "{{env `AWS_PROFILE`}}" }, "builders": [ { "type": "amazon-ebs", - "access_key": "{{user `aws_access_key`}}", - "secret_key": "{{user `aws_secret_key`}}", + "profile": "{{user `profile`}}", "region": "{{user `region`}}", "ami_regions": "{{user `ami_regions`}}", - "source_ami": "{{user `ami`}}", - "instance_type": "m5.2xlarge", + "source_ami": "{{user `ubuntu-2004`}}", + "instance_type": "{{user `instance-type`}}", "ssh_username": "ubuntu", - "ami_name": "{{user `ami_name`}}", + "ami_name": "supabase-postgres-{{user `postgres-version`}}", "tags": { "environment": "{{user `environment`}}", - "appType": "postgres" + "appType": "postgres", + "creator": "packer" + }, + "run_tags": { + "creator": "packer" + }, + "snapshot_tags": { + "creator": "packer" + }, + "run_volume_tags": { + "creator": "packer" }, "launch_block_device_mappings": [ { "device_name": "/dev/sda1", "volume_size": 16, - "volume_type": "gp2", + "volume_type": "gp3", "delete_on_termination": true } ] @@ -45,7 +47,7 @@ "type": "ansible", "user": "ubuntu", "playbook_file": "ansible/playbook.yml", - "extra_arguments": "{{user `ansible_arguments`}}" + "extra_arguments": "--skip-tags,install-postgrest" }, { "execute_command": "echo 'packer' | sudo -S sh -c '{{ .Vars }} {{ .Path }}'", diff --git a/common.vars.json b/common.vars.json new file mode 100644 index 000000000..83454511d --- /dev/null +++ b/common.vars.json @@ -0,0 +1,3 @@ +{ + "postgres-version": "13.3.0.5-rc0" +} diff --git a/development-arm.vars.json b/development-arm.vars.json new file mode 100644 index 000000000..d0c6f99f6 --- /dev/null +++ b/development-arm.vars.json @@ -0,0 +1,8 @@ +{ + "ami_regions": "ap-southeast-1", + "arch": "arm64", + "environment": "dev", + "instance-type": "t4g.2xlarge", + "region": "ap-southeast-1", + "ubuntu-2004": "ami-077adae4d983338da" +}