feat: add initial supervisor setup
This commit is contained in:
parent
306f6edd4e
commit
55de4319ed
6 changed files with 61 additions and 2 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -20,3 +20,6 @@ packages/files/uploads/*
|
|||
|
||||
data/*
|
||||
!data/.gitkeep
|
||||
|
||||
logs/*
|
||||
!logs/.gitkeep
|
||||
|
|
29
Dockerfile
Normal file
29
Dockerfile
Normal file
|
@ -0,0 +1,29 @@
|
|||
FROM node:18.13.0-alpine
|
||||
|
||||
RUN apk add --update \
|
||||
bash \
|
||||
curl \
|
||||
py3-pip \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
ENV NODE_ENV production
|
||||
|
||||
RUN corepack enable
|
||||
|
||||
RUN pip install --no-cache-dir --upgrade supervisor
|
||||
|
||||
RUN mkdir -p /var/lib/server/logs
|
||||
|
||||
COPY docker/supervisord.conf /etc/supervisord.conf
|
||||
|
||||
COPY docker/docker-entrypoint.sh /usr/local/bin/
|
||||
|
||||
COPY . /opt/server
|
||||
|
||||
WORKDIR /opt/server
|
||||
|
||||
RUN yarn install --immutable
|
||||
|
||||
RUN yarn build
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
|
@ -1,7 +1,12 @@
|
|||
version: '3.8'
|
||||
services:
|
||||
server:
|
||||
build: .
|
||||
env_file: .env
|
||||
volumes:
|
||||
- ./logs:/var/lib/server/logs
|
||||
|
||||
db:
|
||||
image: mysql:5.6
|
||||
image: mysql:8
|
||||
environment:
|
||||
MYSQL_DATABASE: '${DB_DATABASE}'
|
||||
MYSQL_USER: '${DB_USERNAME}'
|
||||
|
|
11
docker/docker-entrypoint.sh
Executable file
11
docker/docker-entrypoint.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Setup environment variables
|
||||
|
||||
printenv | grep API_GATEWAY_ | sed 's/API_GATEWAY_//g' > /opt/server/packages/api-gateway/.env
|
||||
|
||||
# Run supervisor
|
||||
|
||||
supervisord -c /etc/supervisord.conf
|
||||
|
||||
exec "$@"
|
11
docker/supervisord.conf
Normal file
11
docker/supervisord.conf
Normal file
|
@ -0,0 +1,11 @@
|
|||
[supervisord]
|
||||
nodaemon=true
|
||||
logfile=/tmp/supervisord.log
|
||||
|
||||
[program:api-gateway]
|
||||
directory=/opt/server
|
||||
command=yarn start:api-gateway
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/var/lib/server/logs/api-gateway.log
|
||||
stderr_logfile=/var/lib/server/logs/api-gateway.err
|
0
logs/.gitkeep
Normal file
0
logs/.gitkeep
Normal file
Loading…
Reference in a new issue