Compare commits

...

29 Commits

Author SHA1 Message Date
David Bomba
e35653fe59 Merge pull request #284 from danielgroen/dotenv_improvements
got all the vars onto the dotenv file
2021-02-09 22:48:47 +11:00
danielgroen
4d7cc8e464 got all the vars onto the dotenv file 2021-02-09 11:35:45 +01:00
David Bomba
c6e122b81f Merge pull request #282 from turbo124/master
Remove redis queue worker from defaults
2021-02-03 09:32:29 +11:00
David Bomba
421a1f10e6 Remove redis queue worker from defaults 2021-02-03 09:31:14 +11:00
David Bomba
84db77cde8 Merge pull request #281 from turbo124/master
Improve supervisor configuration
2021-02-01 08:31:32 +11:00
David Bomba
e8706de11c Improve supervisor configuration 2021-02-01 08:30:50 +11:00
David Bomba
960a85d8a7 Merge pull request #278 from turbo124/master
fix for defaults of supervisor
2021-01-28 21:03:28 +11:00
David Bomba
6cd85f48cd fix for defaults of supervisor 2021-01-28 21:03:09 +11:00
David Bomba
eca3af3da5 Merge pull request #277 from turbo124/master
Adjustments for supervisor
2021-01-28 20:38:28 +11:00
David Bomba
b141cfe449 Adjustments for supervisor 2021-01-28 20:38:03 +11:00
David Bomba
3104ec0be9 Merge pull request #276 from turbo124/master
Adjustments for supervisor
2021-01-28 20:18:21 +11:00
David Bomba
acd778f815 Adjustments for supervisor 2021-01-28 20:18:03 +11:00
David Bomba
0641860c3f Merge pull request #275 from turbo124/master
Adjustments for supervisor
2021-01-28 20:09:27 +11:00
David Bomba
f6564ffb14 Adjustments for supervisor 2021-01-28 20:09:11 +11:00
David Bomba
d751217d9a Merge pull request #274 from turbo124/master
Adjustments for supervisor
2021-01-28 19:59:24 +11:00
David Bomba
9bd40b98df Adjustments for supervisor 2021-01-28 19:59:07 +11:00
David Bomba
54f789d5a1 Merge pull request #273 from turbo124/master
Add supervisor to DockerFile
2021-01-28 19:55:39 +11:00
David Bomba
a6644abaa2 Add supervisor to DockerFile 2021-01-28 19:55:20 +11:00
David Bomba
d42e333248 Merge pull request #272 from turbo124/master
Change from queue:listen to queue:work.
2021-01-28 19:36:01 +11:00
David Bomba
2e4ccb920b Adjustments for supervisor 2021-01-28 19:35:29 +11:00
David Bomba
ebe353ca52 Adjustments for supervisor 2021-01-28 19:34:48 +11:00
David Bomba
1af91f451d Merge pull request #271 from turbo124/master
Remove cron container
2021-01-28 19:31:52 +11:00
David Bomba
386f6ed8c1 Remove cron container 2021-01-28 19:31:20 +11:00
David Bomba
73e88f6042 Merge pull request #270 from tms0/supervisor_v5
Add example to run php-fpm, scheduler and queue worker in the same container with supervisor
2021-01-28 19:30:25 +11:00
Valentin Day
758709a796 Change supervisord logging options 2021-01-28 09:05:50 +01:00
Valentin Day
a67de32b6e Move supervisor example into an examples folder 2021-01-27 15:43:45 +01:00
Valentin Day
49d3e562de Add example to run php-fpm, scheduler and queue worker in the same container with supervisor 2021-01-27 15:30:14 +01:00
David Bomba
7d4afadbb5 Merge pull request #268 from turbo124/master
Add mysql-client back in
2021-01-26 17:13:07 +11:00
David Bomba
3709355309 Add mysql-client back in 2021-01-26 17:12:52 +11:00
9 changed files with 142 additions and 64 deletions

View File

@@ -1,4 +1,7 @@
APP_URL=http://in.localhost:8003/ APP_URL=http://${CNAME}:${port}
PORT=8003
CNAME=in.localhost
APP_KEY=<insert your generated key in here> APP_KEY=<insert your generated key in here>
APP_DEBUG=true APP_DEBUG=true
MULTI_DB_ENABLED=false MULTI_DB_ENABLED=false

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
*.sql
# docker/*
.env
!.env.example

View File

@@ -66,12 +66,14 @@ RUN install-php-extensions \
# Install chromium # Install chromium
RUN set -eux; \ RUN set -eux; \
apk add --no-cache \ apk add --no-cache \
# mysql-client \ supervisor \
mysql-client \
git \ git \
chromium \ chromium \
ttf-freefont ttf-freefont
COPY ./config/php/php.ini /usr/local/etc/php/conf.d/in-php.ini COPY ./config/php/php.ini /usr/local/etc/php/conf.d/in-php.ini
COPY ./config/supervisor/supervisord.conf /
## Separate user ## Separate user
ARG UID=1500 ARG UID=1500
@@ -86,7 +88,9 @@ RUN addgroup --gid=$UID -S "$INVOICENINJA_USER" \
--no-create-home \ --no-create-home \
"$INVOICENINJA_USER" \ "$INVOICENINJA_USER" \
&& addgroup "$INVOICENINJA_USER" www-data \ && addgroup "$INVOICENINJA_USER" www-data \
&& chown -R "$INVOICENINJA_USER":"$INVOICENINJA_USER" /var/www/app && mkdir /var/log/supervisord /var/run/supervisord \
&& chown -R "$INVOICENINJA_USER":"$INVOICENINJA_USER" /var/www/app \
&& chown $INVOICENINJA_USER:www-data /var/log/supervisord /var/run/supervisord
USER $UID USER $UID
@@ -98,4 +102,4 @@ ENV LOG errorlog
ENV SNAPPDF_EXECUTABLE_PATH /usr/bin/chromium-browser ENV SNAPPDF_EXECUTABLE_PATH /usr/bin/chromium-browser
ENTRYPOINT ["docker-entrypoint"] ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"] CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]

View File

@@ -1,16 +0,0 @@
#!/bin/sh
echo "Early Entry"
cleanup ()
{
kill -s SIGTERM $!
exit 0
}
trap cleanup SIGINT SIGTERM
while :
do
sleep 60 ; cd /var/www/app/ && php artisan schedule:run;
done

8
config/shutdown.sh Normal file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
printf "READY\n";
while read line; do
echo "Processing Event: $line" >&2;
kill -SIGQUIT $PPID
done < /dev/stdin

View File

@@ -0,0 +1,47 @@
[supervisord]
nodaemon=true
user=invoiceninja
pidfile=/var/run/supervisord/supervisord.pid
logfile=/dev/null ; nodaemon will cause logs to go to stdout
logfile_maxbytes=0
loglevel=error
[program:php-fpm]
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=php-fpm
[program:scheduler]
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=php artisan schedule:work
[program:queue-worker]
process_name=%(program_name)s_%(process_num)02d
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
numprocs=2
command=php artisan queue:work --sleep=3 --tries=3 --memory=256
[eventlistener:shutdown]
command=/shutdown.sh
events=PROCESS_STATE_STOPPED, PROCESS_STATE_EXITED, PROCESS_STATE_FATAL
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

View File

@@ -1,15 +1,14 @@
version: '3.7' version: "3.7"
services: services:
server: server:
image: nginx image: nginx
restart: always restart: always
env_file: env env_file: .env
volumes: volumes:
# Vhost configuration # Vhost configuration
#- ./config/caddy/Caddyfile:/etc/caddy/Caddyfiledocker-com #- ./config/caddy/Caddyfile:/etc/caddy/Caddyfiledocker-com
- ./config/nginx/in-vhost.conf:/etc/nginx/conf.d/in-vhost.conf:ro - ./config/nginx/in-vhost.conf:/etc/nginx/conf.d/in-vhost.conf:ro
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
- ./docker/app/public:/var/www/app/public:rw,delegated - ./docker/app/public:/var/www/app/public:rw,delegated
- ./docker/app/storage:/var/www/app/storage:rw,delegated - ./docker/app/storage:/var/www/app/storage:rw,delegated
depends_on: depends_on:
@@ -17,20 +16,20 @@ services:
# Run webserver nginx on port 80 # Run webserver nginx on port 80
# Feel free to modify depending what port is already occupied # Feel free to modify depending what port is already occupied
ports: ports:
- "80:80" - ${PORT}:80
#- "443:443" #- "443:443"
networks: networks:
- invoiceninja - invoiceninja
extra_hosts: extra_hosts:
- "in5.localhost:192.168.0.124 " #host and ip - "${CNAME}:192.168.0.124 " #host and ip
app: app:
image: invoiceninja/invoiceninja:5 image: invoiceninja/invoiceninja:5
env_file: env env_file: .env
restart: always restart: always
volumes: volumes:
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
- ./config/hosts:/etc/hosts:ro - ./config/hosts:/etc/hosts:ro
- ./config/shutdown.sh:/usr/local/bin/shutdown.sh
- ./docker/app/public:/var/www/app/public:rw,delegated - ./docker/app/public:/var/www/app/public:rw,delegated
- ./docker/app/storage:/var/www/app/storage:rw,delegated - ./docker/app/storage:/var/www/app/storage:rw,delegated
depends_on: depends_on:
@@ -38,51 +37,37 @@ services:
networks: networks:
- invoiceninja - invoiceninja
extra_hosts: extra_hosts:
- "in5.localhost:192.168.0.124 " #host and ip - "${CNAME}:192.168.0.124 " #host and ip
db: db:
image: mysql:5 image: mysql:5
env_file: .env
ports: ports:
- "3305:3306" - "3305:3306"
restart: always restart: always
environment: environment:
- MYSQL_ROOT_PASSWORD=ninjaAdm1nPassword - MYSQL_ROOT_PASSWORD=${DB_PASSWORD1} # config for 5
- MYSQL_USER=ninja - MYSQL_USER=${DB_USERNAME1}
- MYSQL_PASSWORD=ninja - MYSQL_PASSWORD=${DB_PASSWORD1}
- MYSQL_DATABASE=ninja - MYSQL_DATABASE=${DB_DATABASE1}
# - MYSQL_ROOT_PASSWORD=${DB_PASSWORD} # config for 4
# - MYSQL_USER=${DB_USERNAME}
# - MYSQL_PASSWORD=${DB_PASSWORD}
# - MYSQL_DATABASE=${DB_DATABASE}
volumes: volumes:
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
- ./docker/mysql/data:/var/lib/mysql:rw,delegated - ./docker/mysql/data:/var/lib/mysql:rw,delegated
networks: networks:
- invoiceninja - invoiceninja
extra_hosts: extra_hosts:
- "in5.localhost:192.168.0.124 " #host and ip - "${CNAME}:192.168.0.124 " #host and ip
# THIS IS ONLY A VALID CONFIGURATION FOR IN 5. DO NOT USE FOR IN 4.
cron:
image: invoiceninja/invoiceninja:5
env_file: env
volumes:
- ./config/cron.sh:/usr/local/bin/cron.sh
- ./config/hosts:/etc/hosts:ro
- ./docker/app/public:/var/www/app/public:rw,delegated
- ./docker/app/storage:/var/www/app/storage:rw,delegated
command:
- cron.sh
depends_on:
- app
networks:
- invoiceninja
extra_hosts:
- "in5.localhost:192.168.0.124 " #host and ip
# THIS IS ONLY A VALID CONFIGURATION FOR IN 4. DO NOT USE FOR IN 5. # THIS IS ONLY A VALID CONFIGURATION FOR IN 4. DO NOT USE FOR IN 5.
# cron: # cron:
# image: invoiceninja/invoiceninja:alpine-4 # image: invoiceninja/invoiceninja:alpine-4
# volumes: # volumes:
# - ./docker/app/public:/var/www/app/public:rw,delegated # - ./docker/app/public:/var/www/app/public:rw,delegated
# - ./docker/app/storage:/var/www/app/storage:rw,delegated # - ./docker/app/storage:/var/www/app/storage:rw,delegated
# - ./docker/app/public/logo:/var/www/app/public/logo:rw,delegated # - ./docker/app/public/logo:/var/www/app/public/logo:rw,delegated
# entrypoint: | # entrypoint: |
# /bin/sh -c 'sh -s <<EOF # /bin/sh -c 'sh -s <<EOF
# trap "break;exit" SIGHUP SIGINT SIGTERM # trap "break;exit" SIGHUP SIGINT SIGTERM

View File

@@ -0,0 +1,13 @@
FROM invoiceninja/invoiceninja:5
USER root
RUN apk add --no-cache supervisor \
&& mkdir /var/log/supervisord /var/run/supervisord \
&& chown $INVOICENINJA_USER:www-data /var/log/supervisord /var/run/supervisord
COPY supervisord.conf /
USER $INVOICENINJA_USER
CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]

View File

@@ -0,0 +1,29 @@
[supervisord]
nodaemon=true
user=invoiceninja
pidfile=/var/run/supervisord/supervisord.pid
logfile=/dev/null ; nodaemon will cause logs to go to stdout
logfile_maxbytes=0
loglevel=error
[program:php-fpm]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=php-fpm
[program:scheduler]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=php artisan schedule:work
[program:queue-worker]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
numprocs=2
command=php artisan queue:work --sleep=3 --tries=1 --memory=1024 --timeout=3600 --daemon