-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update CLI for new Cfn database template (#12)
* Update CLI for new Cfn database template * Trigger initial build * Check error on confirm delete * Fix CI * Fix aurora flag handling * Handle RDS instance or cluster * Test Redis too * Only build databases nightly and on-demand
- Loading branch information
Showing
5 changed files
with
392 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,241 @@ | ||
name: databases | ||
|
||
on: | ||
workflow_dispatch: {} | ||
schedule: | ||
- cron: '0 1 * * *' | ||
|
||
jobs: | ||
init: | ||
name: init | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.15 | ||
- | ||
name: Build | ||
run: go build -o bin/apppack | ||
- | ||
name: AppPack Init | ||
run: | | ||
./bin/apppack create region --region us-east-2 \ | ||
--dockerhub-username $DOCKERHUB_USERNAME \ | ||
--dockerhub-access-token $DOCKERHUB_ACCESS_TOKEN | ||
./bin/apppack create cluster --region us-east-2 \ | ||
--domain testclusters.apppack.io \ | ||
--instance-class t3.micro | ||
timeout-minutes: 9 | ||
env: | ||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKERHUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
- | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: apppack | ||
path: bin | ||
standard-mysql: | ||
runs-on: ubuntu-latest | ||
needs: ["init"] | ||
steps: | ||
- | ||
uses: actions/download-artifact@master | ||
with: | ||
name: apppack | ||
path: bin | ||
- | ||
name: Create standard MySQL | ||
run: | | ||
chmod +x ./bin/apppack | ||
./bin/apppack create database --region us-east-2 \ | ||
--non-interactive \ | ||
--instance-class db.t3.micro \ | ||
--engine mysql \ | ||
--allocated-storage 10 \ | ||
--max-allocated-storage 20 \ | ||
standard-mysql | ||
timeout-minutes: 25 | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
- | ||
name: Destroy standard MySQL | ||
run: | | ||
yes yes | ./bin/apppack destroy database standard-mysql \ | ||
--region us-east-2 | ||
if: always() | ||
timeout-minutes: 15 | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
standard-postgres: | ||
runs-on: ubuntu-latest | ||
needs: ["init"] | ||
steps: | ||
- | ||
uses: actions/download-artifact@master | ||
with: | ||
name: apppack | ||
path: bin | ||
- | ||
name: Create standard Postgres | ||
run: | | ||
chmod +x ./bin/apppack | ||
./bin/apppack create database --region us-east-2 \ | ||
--non-interactive \ | ||
--instance-class db.t3.micro \ | ||
--engine postgres \ | ||
--allocated-storage 10 \ | ||
--max-allocated-storage 20 \ | ||
standard-postgres | ||
timeout-minutes: 25 | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
- | ||
name: Destroy standard Postgres | ||
run: | | ||
yes yes | ./bin/apppack destroy database standard-postgres \ | ||
--region us-east-2 | ||
if: always() | ||
timeout-minutes: 15 | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aurora-mysql: | ||
runs-on: ubuntu-latest | ||
needs: ["init"] | ||
steps: | ||
- | ||
uses: actions/download-artifact@master | ||
with: | ||
name: apppack | ||
path: bin | ||
- | ||
name: Create Aurora MySQL | ||
run: | | ||
chmod +x ./bin/apppack | ||
./bin/apppack create database --region us-east-2 \ | ||
--non-interactive \ | ||
--instance-class db.t3.small \ | ||
--aurora \ | ||
--engine mysql \ | ||
--allocated-storage 10 \ | ||
--max-allocated-storage 20 \ | ||
aurora-mysql | ||
timeout-minutes: 25 | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
- | ||
name: Destroy Aurora MySQL | ||
run: | | ||
yes yes | ./bin/apppack destroy database aurora-mysql \ | ||
--region us-east-2 | ||
if: always() | ||
timeout-minutes: 15 | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aurora-postgres: | ||
runs-on: ubuntu-latest | ||
needs: ["init"] | ||
steps: | ||
- | ||
uses: actions/download-artifact@master | ||
with: | ||
name: apppack | ||
path: bin | ||
- | ||
name: Create Aurora Postgres | ||
run: | | ||
chmod +x ./bin/apppack | ||
./bin/apppack create database --region us-east-2 \ | ||
--non-interactive \ | ||
--instance-class db.t3.medium \ | ||
--aurora \ | ||
--engine postgres \ | ||
aurora-postgres | ||
timeout-minutes: 25 | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
- | ||
name: Destroy Aurora Postgres | ||
run: | | ||
yes yes | ./bin/apppack destroy database aurora-postgres \ | ||
--region us-east-2 | ||
if: always() | ||
timeout-minutes: 15 | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
redis: | ||
runs-on: ubuntu-latest | ||
needs: ["init"] | ||
steps: | ||
- | ||
uses: actions/download-artifact@master | ||
with: | ||
name: apppack | ||
path: bin | ||
- | ||
name: Create Redis | ||
run: | | ||
chmod +x ./bin/apppack | ||
./bin/apppack create redis --region us-east-2 \ | ||
--non-interactive | ||
timeout-minutes: 25 | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
- | ||
name: Destroy Redis | ||
run: | | ||
yes yes | ./bin/apppack destroy redis apppack \ | ||
--region us-east-2 | ||
if: always() | ||
timeout-minutes: 15 | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
destroy: | ||
runs-on: ubuntu-latest | ||
if: always() | ||
needs: | ||
- standard-mysql | ||
- standard-postgres | ||
- aurora-mysql | ||
- aurora-postgres | ||
- redis | ||
steps: | ||
- | ||
uses: actions/download-artifact@master | ||
with: | ||
name: apppack | ||
path: bin | ||
- | ||
name: Destroy cluster | ||
run: | | ||
chmod +x ./bin/apppack | ||
yes yes | ./bin/apppack destroy cluster apppack --region us-east-2 | ||
if: always() | ||
timeout-minutes: 8 | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
- | ||
name: Destroy region | ||
run: yes yes | ./bin/apppack destroy region --region us-east-2 | ||
if: always() | ||
timeout-minutes: 3 | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.