Skip to content

Commit 905c033

Browse files
committed
finish deployment chapter
1 parent 88da520 commit 905c033

File tree

14 files changed

+116
-62
lines changed

14 files changed

+116
-62
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
DATABASE_URL=postgres://prisma:prisma@localhost:5432/hackernews-db
2+
3+
# rename file to .env

.github/workflows/deployment.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: deploy-hackernews-app-heroku # 1
2+
3+
on:
4+
push:
5+
branches: # 2
6+
- master
7+
- main
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2 # 3
14+
- run: npm ci # 4
15+
- name: Run production migration
16+
run: npm run migrate:deploy # 5
17+
env:
18+
DATABASE_URL: ${{ secrets.DATABASE_URL }}
19+
- uses: akhileshns/[email protected] # 6
20+
with:
21+
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
22+
heroku_app_name: ${{ secrets.HEROKU_APP_NAME }}
23+
heroku_email: ${{ secrets.HEROKU_EMAIL }}

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
node_modules
2-
# Keep environment variables out of version control
32
.env
4-
.idea
53
.vscode
6-
dist
4+
dist
5+
.idea

docker-compose.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: '3.8'
2+
services:
3+
4+
# Docker connection string for local machine: postgres://prisma:prisma@localhost:5432/
5+
6+
postgres:
7+
image: postgres:10.3
8+
restart: always
9+
environment:
10+
- POSTGRES_USER=prisma
11+
- POSTGRES_PASSWORD=prisma
12+
volumes:
13+
- postgres:/var/lib/postgresql/data
14+
ports:
15+
- '5432:5432'
16+
17+
volumes:
18+
postgres:

package-lock.json

Lines changed: 14 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"test": "echo \"Error: no test specified\" && exit 1",
88
"dev": "ts-node-dev --transpile-only --no-notify --exit-child src/index.ts",
99
"generate": "ts-node --transpile-only src/schema",
10-
"prettier-format": "prettier 'src/**/*.ts' --write"
10+
"prettier-format": "prettier 'src/**/*.ts' --write",
11+
"migrate:deploy": "prisma migrate deploy",
12+
"build": "prisma generate && npm run generate && tsc",
13+
"start": "node dist/src/index.js"
1114
},
1215
"keywords": [],
1316
"author": "",

prisma/dev.db

-40 KB
Binary file not shown.

prisma/migrations/20211116205624_init/migration.sql

Lines changed: 0 additions & 7 deletions
This file was deleted.

prisma/migrations/20211120093350_user/migration.sql

Lines changed: 0 additions & 26 deletions
This file was deleted.

prisma/migrations/20211214080826_add_vote_relation/migration.sql

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)