Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

276/deploy to staging #323

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 🎭 Staging

on:
push:
branches:
- main

jobs:
migrate:
name: 🧑‍🚀 Migrate
environment:
name: staging-zoning-api
runs-on: ubuntu-latest
env:
DATABASE_USER: ${{secrets.DATABASE_USER}}
DATABASE_PASSWORD: ${{secrets.DATABASE_PASSWORD}}
DATABASE_NAME: ${{secrets.DATABASE_NAME }}
DATABASE_PORT: ${{secrets.DATABASE_PORT}}
DATABASE_HOST: ${{secrets.DATABASE_HOST}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Apply migrations
run: npm run drizzle:migrate
deploy:
name: 🚀 Deploy
environment:
name: staging-zoning-api
url: https://staging-zoning-api.nycplanningdigital.com
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy to Heroku
uses: akhileshns/[email protected]
with:
heroku_email: ${{secrets.HEROKU_EMAIL}}
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ${{secrets.HEROKU_APP_NAME}}
team: ${{secrets.HEROKU_TEAM}}
env:
HD_DATABASE_USER: ${{secrets.DATABASE_USER}}
HD_DATABASE_PASSWORD: ${{secrets.DATABASE_PASSWORD}}
HD_DATABASE_NAME: ${{secrets.DATABASE_NAME}}
HD_DATABASE_PORT: ${{secrets.DATABASE_PORT}}
HD_DATABASE_HOST: ${{secrets.DATABASE_HOST}}
HD_STORAGE_URL: ${{secrets.STORAGE_URL}}
HD_NODE_ENV: ${{secrets.NODE_ENV}}
4 changes: 3 additions & 1 deletion drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export default {
user: process.env.DATABASE_USER,
password: process.env.DATABASE_PASSWORD,
database: process.env.DATABASE_NAME!,
ssl: process.env.NODE_ENV === "production",
ssl: {
rejectUnauthorized: false,
},
},
} satisfies Config;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"scripts": {
"build": "npm run redoc:build && nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \"db/**/*.ts\"",
"start": "nest start",
"dev": "npm run redoc:build && nest start --watch",
"start": "node dist/main",
"start:debug": "npm run redoc:build && nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
Expand Down
3 changes: 3 additions & 0 deletions src/global/providers/db.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export const DbProvider: FactoryProvider = {
user: dbConfig.user,
password: dbConfig.password,
database: dbConfig.name,
ssl: {
rejectUnauthorized: false,
},
});

return drizzle(pool, { schema });
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ async function bootstrap() {
app.enableCors();
app.setGlobalPrefix("api");

await app.listen(3000);
await app.listen(process.env.PORT || 3000);
}
bootstrap();