-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
147 additions
and
7 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
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
File renamed without changes.
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,22 @@ | ||
# next.js-practical-cases - deploy production | ||
|
||
## Deploy by hand | ||
|
||
### Cheat sheet | ||
|
||
```bash | ||
# Load env vars | ||
export $(grep -v '^#' ~/.env.local | xargs) | ||
# Pull the latest image | ||
docker compose pull <app> | ||
# Restart container | ||
docker compose up -d <app> | ||
# Clear unused images | ||
docker image prune -f | ||
``` | ||
|
||
To kill all containers in current machine. | ||
|
||
```bash | ||
docker kill $(docker ps -q) && docker rm $(docker ps -a -q) | ||
``` |
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
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,6 @@ | ||
DOCKER_REGISTRY= | ||
DOCKER_USER= | ||
DOCKER_PASSWORD= | ||
POSTGRES_PASSWORD= | ||
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY= | ||
CLERK_SECRET_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# next.js-practical-cases - deploy | ||
# next.js-practical-cases - deploy staging | ||
|
||
## Deploy by hand | ||
|
||
|
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,94 @@ | ||
version: "3.8" | ||
|
||
services: | ||
template: | ||
container_name: template | ||
image: $DOCKER_REGISTRY/$DOCKER_USER/npcs-template:$DOCKER_TAG | ||
restart: always | ||
environment: | ||
- DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/template?pool_timeout=6000 | ||
- CLERK_SECRET_KEY | ||
- NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY | ||
ports: | ||
- 3000:3000 | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
|
||
notes: | ||
container_name: notes | ||
image: $DOCKER_REGISTRY/$DOCKER_USER/npcs-notes:$DOCKER_TAG | ||
restart: always | ||
environment: | ||
- DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/notes?pool_timeout=6000 | ||
- CLERK_SECRET_KEY | ||
- NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY | ||
ports: | ||
- 3001:3000 | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
|
||
stackoverflow: | ||
container_name: stackoverflow | ||
image: $DOCKER_REGISTRY/$DOCKER_USER/npcs-stackoverflow:$DOCKER_TAG | ||
restart: always | ||
environment: | ||
- DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/stackoverflow?pool_timeout=6000 | ||
- CLERK_SECRET_KEY | ||
- NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY | ||
ports: | ||
- 3002:3000 | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
|
||
large-file-upload: | ||
container_name: large-file-upload | ||
image: $DOCKER_REGISTRY/$DOCKER_USER/npcs-large-file-upload:$DOCKER_TAG | ||
restart: always | ||
environment: | ||
- DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/large-file-upload?pool_timeout=6000 | ||
- CLERK_SECRET_KEY | ||
- NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY | ||
ports: | ||
- 3003:3000 | ||
- 9999:9999 | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
|
||
postgres: | ||
container_name: postgres | ||
image: postgres:16 | ||
restart: always | ||
shm_size: 128mb | ||
environment: | ||
- POSTGRES_PASSWORD | ||
ports: | ||
- 5432:5432 | ||
healthcheck: | ||
test: [ "CMD-SHELL", "pg_isready -U postgres" ] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
volumes: | ||
- ./volumes/pgdata:/var/lib/postgresql/data | ||
|
||
nginx: | ||
container_name: nginx | ||
image: nginx:latest | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
volumes: | ||
- ./volumes/nginx.conf:/etc/nginx/nginx.conf:ro | ||
depends_on: | ||
- template | ||
- notes | ||
- stackoverflow | ||
- large-file-upload | ||
|
||
networks: | ||
default: | ||
driver: bridge |