-
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.
Merge pull request #23 from kennedy-steve/production-eb-deployment
Production EB deployment
- Loading branch information
Showing
2 changed files
with
76 additions
and
3 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,73 @@ | ||
name: Deploy to Elastic Beanstalk Production Environment | ||
on: | ||
push: | ||
branches: | ||
- production | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
# Service containers to run with `container-job` | ||
services: | ||
# Label used to access the service container | ||
postgres: | ||
# Docker Hub image | ||
image: postgres | ||
# Provide the password for postgres | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
# Maps TCP port 5432 on service container to the host | ||
- 5432:5432 | ||
env: | ||
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/skylink-if | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: '16.x' | ||
- run: npm ci | ||
# run the migration in the test database | ||
- run: npm run db:push | ||
|
||
deployment: | ||
runs-on: ubuntu-latest | ||
environment: production | ||
steps: | ||
|
||
- name: Checkout source code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Generate deployment package | ||
run: zip -r deploy.zip . -x '*.git*' | ||
|
||
- name: Setup npm | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '16.x' | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run production migration | ||
run: npm run migrate:deploy | ||
env: | ||
DATABASE_URL: ${{ secrets.DATABASE_URL }} | ||
|
||
|
||
- name: Deploy to Elastic Beanstalk Production Environment | ||
uses: einaregilsson/beanstalk-deploy@v20 | ||
with: | ||
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
application_name: ${{ secrets.ELASTIC_BEANSTALK_APPLICATION_NAME }} | ||
environment_name: ${{ secrets.ELASTIC_BEANSTALK_ENVIRONMENT_NAME }} | ||
version_label: skylink-if-production-${{ github.run_number }} | ||
region: us-east-1 | ||
deployment_package: deploy.zip |
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