-
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.
Merge pull request #42 from Longridge-High-School/feat-docker-rework
feat: docker rework #42
- Loading branch information
Showing
6 changed files
with
173 additions
and
52 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
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,23 +1,41 @@ | ||
version: '3.9' | ||
services: | ||
remix: | ||
image: longridgehighschool/net-doc:main | ||
restart: always | ||
ports: | ||
- '3000:3000' | ||
environment: | ||
x-shared: | ||
net-doc-service: &net-doc-service | ||
environment: &net-doc-environment | ||
- PASSWORD_KEY=YOUR KEY | ||
- PASSWORD_SALT=YOUR SALT | ||
- PASSWORD_IV=YOUR IV | ||
- DATABASE_URL=file:./data/net-doc.db | ||
volumes: | ||
- REDIS_URL=net-doc-redis:6379 | ||
volumes: &net-doc-volumes | ||
- ./db:/app/prisma/data | ||
- ./uploads:/app/public/uploads | ||
- ./backups:/app/public/backups | ||
redis: | ||
image: longridgehighschool/net-doc:2 | ||
restart: always | ||
depends_on: | ||
- net-doc-redis | ||
|
||
services: | ||
net-doc-remix: | ||
<<: *net-doc-service | ||
command: ['net-doc-remix'] | ||
|
||
net-doc-worker: | ||
<<: *net-doc-service | ||
command: ['net-doc-worker'] | ||
depends_on: | ||
- net-doc-remix | ||
|
||
net-doc-nginx: | ||
<<: *net-doc-service | ||
command: ['net-doc-nginx'] | ||
depends_on: | ||
- net-doc-remix | ||
ports: | ||
- '8080:80' | ||
|
||
net-doc-redis: | ||
image: redis:7 | ||
restart: always | ||
volumes: | ||
- ./data/redis:/data | ||
ports: | ||
- 6379:6379 |
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,33 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
: "${REMIX_HOST:=net-doc-remix}" | ||
: "${REMIX_PORT:=3000}" | ||
|
||
function prepare_database { | ||
npm uninstall bcrypt | ||
npm install bcrypt | ||
|
||
npx prisma migrate deploy | ||
npx prisma generate --sql | ||
} | ||
|
||
if [ "$1" = 'net-doc-remix' ]; then | ||
prepare_database | ||
|
||
npm run start:remix | ||
|
||
elif [ "$1" = 'net-doc-worker' ]; then | ||
prepare_database | ||
|
||
npm run start:worker | ||
elif [ "$1" = 'net-doc-nginx' ]; then | ||
# configure nginx | ||
sed -e "s#server .*:3000#server ${REMIX_HOST}:${REMIX_PORT}#g" \ | ||
-e 's#/var/log/nginx/net-doc.\(access\|error\).log#/dev/stdout#g' < /app/docker/nginx.conf > /etc/nginx/sites-enabled/default | ||
|
||
echo "starting nginx..." | ||
|
||
exec /usr/sbin/nginx -g 'daemon off;' | ||
fi |
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,38 @@ | ||
upstream net-doc-remix { | ||
server 127.0.0.1:3000; | ||
} | ||
|
||
server { | ||
listen 80; | ||
listen [::]:80; | ||
|
||
# replace 'localhost' with your fqdn if you want to use zammad from remote | ||
server_name localhost; | ||
|
||
# security - prevent information disclosure about server version | ||
server_tokens off; | ||
|
||
root /app/build/client; | ||
|
||
access_log /var/log/nginx/net-doc.access.log; | ||
error_log /var/log/nginx/net-doc.error.log; | ||
|
||
client_max_body_size 50M; | ||
|
||
location ~ ^/(assets/|robots.txt|humans.txt|favicon.ico|apple-touch-icon.png) { | ||
expires max; | ||
} | ||
|
||
location / { | ||
proxy_set_header Host $http_host; | ||
proxy_set_header CLIENT_IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
|
||
proxy_read_timeout 300; | ||
proxy_pass http://net-doc-remix; | ||
|
||
gzip on; | ||
gzip_types text/plain text/xml text/css image/svg+xml application/javascript application/x-javascript application/json application/xml; | ||
gzip_proxied any; | ||
} | ||
} |
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