new script to run workers

This commit is contained in:
Kyle Corbitt
2023-08-18 13:01:01 -07:00
parent 1b394cc72b
commit 9b1f2ac30a
7 changed files with 31 additions and 12 deletions

View File

@@ -45,4 +45,4 @@ EXPOSE 3000
ENV PORT 3000
# Run the "run-prod.sh" script
CMD /code/app/run-prod.sh
CMD /code/app/scripts/run-prod.sh

View File

@@ -0,0 +1,6 @@
#! /bin/bash
set -e
cd "$(dirname "$0")/.."
apt-get update
apt-get install -y htop psql

10
app/scripts/run-workers-prod.sh Executable file
View File

@@ -0,0 +1,10 @@
#! /bin/bash
set -e
echo "Migrating the database"
pnpm prisma migrate deploy
echo "Starting 4 workers"
pnpm concurrently "pnpm worker" "pnpm worker" "pnpm worker" "pnpm worker"

13
app/scripts/test-docker.sh Executable file
View File

@@ -0,0 +1,13 @@
#! /bin/bash
set -e
cd "$(dirname "$0")/../.."
echo "Env is"
echo $ENVIRONMENT
docker build . --file app/Dockerfile --tag "openpipe-prod"
# Run the image
docker run --env-file app/.env -it --entrypoint "/bin/bash" "openpipe-prod"

View File

@@ -1,9 +0,0 @@
#! /bin/bash
set -e
cd "$(dirname "$0")/.."
source app/.env
docker build . --file app/Dockerfile

View File

@@ -39,8 +39,7 @@ services:
dockerfilePath: ./app/Dockerfile
dockerContext: .
plan: pro
# Run 4 workers
dockerCommand: pnpm concurrently "pnpm worker" "pnpm worker" "pnpm worker" "pnpm worker"
dockerCommand: /code/app/scripts/run-workers-prod.sh
envVars:
- key: DATABASE_URL
fromDatabase: