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

feat(health-check): Next.js health checks #351

Merged
merged 19 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
132 changes: 66 additions & 66 deletions app/smoketest/compose/db.yaml
Original file line number Diff line number Diff line change
@@ -1,75 +1,75 @@
version: "3"

services:
db:
image: docker.io/library/postgres:16-bullseye
networks:
- backend
- db-admin
hostname: db
expose:
- 5432
ports:
- "5432:5432"
environment:
POSTGRES_DB: privacypal
POSTGRES_USER: privacypal
POSTGRES_PASSWORD: password
volumes:
- postgres:/var/lib/pgsql/data
restart: unless-stopped
healthcheck:
test: pg_isready -U privacypal -d privacypal || exit 1
interval: 10s
retries: 3
start_period: 10s
timeout: 5s
db:
image: docker.io/library/postgres:16-bullseye
networks:
- backend
- db-admin
hostname: db
expose:
- 5432
ports:
- "5432:5432"
environment:
POSTGRES_DB: privacypal
POSTGRES_USER: privacypal
POSTGRES_PASSWORD: password
volumes:
- postgres:/var/lib/pgsql/data
restart: unless-stopped
healthcheck:
test: pg_isready -U privacypal -d privacypal || exit 1
interval: 10s
retries: 3
start_period: 10s
timeout: 5s

db-init:
image: ghcr.io/cosc-499-w2023/privacypal-init-db:0.1.0-dev
depends_on:
db:
condition: service_healthy
build: ../../web/db
networks:
- db-admin
environment:
DATABASE_URL: postgresql://privacypal:password@db:5432/privacypal
PRIVACYPAL_AUTH_MANAGER: ${PRIVACYPAL_AUTH_MANAGER:-basic}
PRIVACYPAL_USER_PROPERTY_PATH: /opt/privacypal/user.properties.csv
volumes:
- ../../web/db/sample/user.properties.csv:/opt/privacypal/user.properties.csv:z
db-init:
image: ghcr.io/cosc-499-w2023/privacypal-init-db:0.1.0-dev
depends_on:
db:
condition: service_healthy
build: ../../web/db
networks:
- db-admin
environment:
DATABASE_URL: postgresql://privacypal:password@db:5432/privacypal
PRIVACYPAL_AUTH_MANAGER: ${PRIVACYPAL_AUTH_MANAGER:-basic}
PRIVACYPAL_USER_PROPERTY_PATH: /opt/privacypal/user.properties.csv
volumes:
- ../../web/db/sample/user.properties.csv:/opt/privacypal/user.properties.csv:z

db-viewer:
image: docker.io/dpage/pgadmin4:8
depends_on:
db:
condition: service_healthy
hostname: db-viewer
ports:
- "8989:8989"
networks:
- db-admin
environment:
PGADMIN_DEFAULT_EMAIL: admin@privacypal.io
PGADMIN_DEFAULT_PASSWORD: admin
PGADMIN_LISTEN_PORT: 8989
volumes:
- pgadmin:/var/lib/pgadmin
- ./include/servers.json:/pgadmin4/servers.json:z
restart: always
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:8989 || exit 1
interval: 10s
retries: 3
start_period: 10s
timeout: 5s
db-viewer:
image: docker.io/dpage/pgadmin4:8
depends_on:
db:
condition: service_healthy
hostname: db-viewer
ports:
- "8989:8989"
networks:
- db-admin
environment:
PGADMIN_DEFAULT_EMAIL: admin@privacypal.io
PGADMIN_DEFAULT_PASSWORD: admin
PGADMIN_LISTEN_PORT: 8989
volumes:
- pgadmin:/var/lib/pgadmin
- ./include/servers.json:/pgadmin4/servers.json:z
restart: always
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:8989 || exit 1
interval: 10s
retries: 3
start_period: 10s
timeout: 5s

networks:
db-admin:
db-admin:

volumes:
postgres:
driver: local
pgadmin:
driver: local
postgres:
driver: local
pgadmin:
driver: local
124 changes: 62 additions & 62 deletions app/smoketest/compose/privacypal.yaml
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
version: "3"

services:
privacypal:
image: ghcr.io/cosc-499-w2023/privacypal:0.1.0-dev
build: ../../web/
user: "0"
depends_on:
db-init:
condition: service_completed_successfully
networks:
- backend
hostname: privacypal
expose:
- 8080
ports:
- "8080:8080"
environment:
PORT: 8080
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN}
AWS_REGION: ca-central-1
PRIVACYPAL_CONFIG_DIR: /opt/privacypal/
PRIVACYPAL_INPUT_VIDEO_DIR: /opt/privacypal/input-videos
PRIVACYPAL_OUTPUT_VIDEO_DIR: /opt/privacypal/output-videos
PRIVACYPAL_AUTH_MANAGER: basic
PRIVACYPAL_DEBUG: true
PRIVACYPAL_AUTH_SECRET: NZFbGxlrFl5Ae2kh0pcKbsiNVL37eEvtSg4zunBpfmw=
PRIVACYPAL_COOKIE_NAME: privacypal
DATABASE_URL: postgresql://privacypal:password@db:5432/privacypal
PRIVACYPAL_PROCESSOR_URL: http://video-processor:3000
volumes:
- output_videos:/opt/privacypal/output-videos
- input_videos:/opt/privacypal/input-videos
restart: unless-stopped
privacypal:
image: ghcr.io/cosc-499-w2023/privacypal:0.1.0-dev
build: ../../web/
user: "0"
depends_on:
db-init:
condition: service_completed_successfully
networks:
- backend
hostname: privacypal
expose:
- 8080
ports:
- "8080:8080"
environment:
PORT: 8080
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN}
AWS_REGION: ca-central-1
PRIVACYPAL_CONFIG_DIR: /opt/privacypal/
PRIVACYPAL_INPUT_VIDEO_DIR: /opt/privacypal/input-videos
PRIVACYPAL_OUTPUT_VIDEO_DIR: /opt/privacypal/output-videos
PRIVACYPAL_AUTH_MANAGER: basic
PRIVACYPAL_DEBUG: true
PRIVACYPAL_AUTH_SECRET: NZFbGxlrFl5Ae2kh0pcKbsiNVL37eEvtSg4zunBpfmw=
PRIVACYPAL_COOKIE_NAME: privacypal
DATABASE_URL: postgresql://privacypal:password@db:5432/privacypal
PRIVACYPAL_PROCESSOR_URL: http://video-processor:3000
volumes:
- output_videos:/opt/privacypal/output-videos
- input_videos:/opt/privacypal/input-videos
restart: unless-stopped

video-processor:
image: ghcr.io/cosc-499-w2023/privacypal-vidprocess:0.1.0-dev
build: ../../video-processing
user: "0"
networks:
- backend
hostname: video-processor
expose:
- 3000
ports:
- "3000:3000"
environment:
PORT: 3000
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN}
AWS_DEFAULT_REGION: ca-central-1
PRIVACYPAL_CONFIG_DIR: /opt/privacypal/
PRIVACYPAL_INPUT_VIDEO_DIR: /opt/privacypal/input-videos
PRIVACYPAL_OUTPUT_VIDEO_DIR: /opt/privacypal/output-videos
volumes:
- output_videos:/opt/privacypal/output-videos
- input_videos:/opt/privacypal/input-videos
restart: unless-stopped
video-processor:
image: ghcr.io/cosc-499-w2023/privacypal-vidprocess:0.1.0-dev
build: ../../video-processing
user: "0"
networks:
- backend
hostname: video-processor
expose:
- 3000
ports:
- "3000:3000"
environment:
PORT: 3000
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN}
AWS_DEFAULT_REGION: ca-central-1
PRIVACYPAL_CONFIG_DIR: /opt/privacypal/
PRIVACYPAL_INPUT_VIDEO_DIR: /opt/privacypal/input-videos
PRIVACYPAL_OUTPUT_VIDEO_DIR: /opt/privacypal/output-videos
volumes:
- output_videos:/opt/privacypal/output-videos
- input_videos:/opt/privacypal/input-videos
restart: unless-stopped

networks:
backend:
backend:

volumes:
output_videos:
driver: local
input_videos:
driver: local
output_videos:
driver: local
input_videos:
driver: local
1 change: 0 additions & 1 deletion app/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ RUN mkdir .next && chown nextjs .next
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs /app/.next/standalone ./
COPY --from=builder --chown=nextjs /app/.next/static ./.next/static
# COPY --from=builder /app/public ./public

USER nextjs

Expand Down
3 changes: 3 additions & 0 deletions app/web/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ PRIVACYPAL_AUTH_MANAGER ?= cognito
PRIVACYPAL_DEBUG ?= true
PRIVACYPAL_PROCESSOR_URL = http://localhost:3000
DATABASE_URL = postgresql://privacypal:password@localhost:5432/privacypal
PRIVACYPAL_LAMBDA_NAME ?= processVideoContainer

PRIVACYPAL_TMP_BUCKET ?= privacypal-input
PRIVACYPAL_TMP_BUCKET ?= privacypal-output
Expand Down Expand Up @@ -62,6 +63,8 @@ run: setup-run ## Run the web server as a standalone container.
-e AWS_POOL_ID=$${AWS_POOL_ID} \
-e DATABASE_URL="$(DATABASE_URL)" \
-e PRIVACYPAL_PROCESSOR_URL="$(PRIVACYPAL_PROCESSOR_URL)" \
-e PRIVACYPAL_S3_BUCKET="privacypal" \
-e PRIVACYPAL_LAMBDA_NAME="$(PRIVACYPAL_LAMBDA_NAME)" \
-e PRIVACYPAL_OUTPUT_BUCKET="$(PRIVACYPAL_TMP_BUCKET)" \
-e PRIVACYPAL_TMP_BUCKET="$(PRIVACYPAL_TMP_BUCKET)" \
-e NEXTAUTH_URL="http://localhost:8080" \
Expand Down
1 change: 1 addition & 0 deletions app/web/generate_dev_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
echo PRIVACYPAL_DEBUG=${PRIVACYPAL_DEBUG:-true}
echo PRIVACYPAL_COOKIE_NAME=${PRIVACYPAL_COOKIE_NAME:-"privacypal"}
echo PRIVACYPAL_PROCESSOR_URL=${PRIVACYPAL_PROCESSOR_URL:-"http://localhost:3000"}
connordoman marked this conversation as resolved.
Show resolved Hide resolved
echo PRIVACYPAL_VERSION=${PRIVACYPAL_VERSION:-"dev0.0.1"}
} > .env.local
Loading
Loading