Skip to content

Commit 8d853f5

Browse files
author
Evgenii Mykhalichenko
committed
Updates:
- Update readmy file - Create sypervisord container and remove from php
1 parent d4bd01b commit 8d853f5

File tree

8 files changed

+50
-30
lines changed

8 files changed

+50
-30
lines changed

README.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ To install, you need to install docker locally.
88
- Simple and clear project structure;
99
- Php the latest version 8.1 (can be changed if you need);
1010
- All necessary php extensions including composer and xDebug3;
11-
- Output all necessary logs (nginx, php, mysql, redis, supervisor, cron), including slow mysql queries;
12-
- Supervisor and cron support
11+
- Output all necessary logs (nginx, php, mysql, redis, supervisor), including slow mysql queries;
12+
- Supervisor support
1313
- Quick, easy setup for everything you need
1414
- Lots of useful examples
1515

@@ -20,6 +20,7 @@ To install, you need to install docker locally.
2020
* [PHP-FPM](http://php-fpm.org/)
2121
* [Redis](http://redis.io/)
2222
* [Redis commander](https://joeferner.github.io/redis-commander/)
23+
* [Supervisord](http://supervisord.org/)
2324

2425
### Requirements
2526

@@ -67,10 +68,9 @@ And you should see something like:
6768

6869
### Makefile
6970
This file helps to quickly interact with the work of docker and additional features.
71+
Read about available commands `make help`
7072

7173
```
72-
usage: make COMMAND
73-
7474
Commands:
7575
init Init skeleton settings
7676
help List of all commands in make file
@@ -112,6 +112,11 @@ Commands:
112112
└── src - [Your workspace]
113113
```
114114
115+
### Project links (Default: http://127.0.0.1/)
116+
- [Homepage](http://127.0.0.1/)
117+
- [Rediscommander](http://127.0.0.1:8081)
118+
- [Supervisor GUI](http://127.0.0.1:9001)
119+
115120
### More documentation
116121
You can also read more information about the project
117122

docker-compose.yml

+14-2
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,23 @@ services:
7676
volumes:
7777
- "./src:${DOCKER_WORK_DIR}"
7878
- ./logs/supervisor/:/var/log/supervisor/
79-
ports:
80-
- "9001:9001" # Access GUI with http://localhost:9001/
8179
networks:
8280
- backend-network
8381

82+
supervisord:
83+
container_name: "${DOCKER_PREFIX}-supervisord"
84+
build:
85+
context: ./docker/supervisord
86+
dockerfile: Dockerfile
87+
restart: always
88+
volumes:
89+
- ./logs/supervisor/:/var/log/supervisor/
90+
- "./src:${DOCKER_WORK_DIR}"
91+
networks:
92+
- backend-network
93+
ports:
94+
- "9001:9001" # Access GUI with http://localhost:9001/
95+
8496
networks:
8597
backend-network:
8698
driver: bridge

docker/backend/Dockerfile

+1-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ RUN apt-get update && apt-get install -y \
2121
zip \
2222
unzip \
2323
curl \
24-
supervisor \
2524
procps \
2625
htop
2726

@@ -31,8 +30,6 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/*
3130
# Copy confjgurations files
3231
COPY php/conf.d/php.ini $PHP_INI_DIR/
3332
COPY php/conf.d/xdebug.ini $PHP_INI_DIR/conf.d/
34-
COPY supervisor/supervisord.conf /etc/supervisor
35-
COPY supervisor/conf.d/* /etc/supervisor/conf.d
3633

3734
# Set configuration for xdebug
3835
RUN sed -i -e 's/xdebug.client_host=host.docker.internal/xdebug.client_host='"${XDEBUG_CLIENT_HOST}"'/g' $PHP_INI_DIR/conf.d/xdebug.ini
@@ -49,6 +46,4 @@ RUN docker-php-ext-install pdo_mysql
4946
# Get latest Composer
5047
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
5148

52-
WORKDIR "${WORK_DIR}"
53-
54-
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
49+
WORKDIR "${WORK_DIR}"

docker/backend/supervisor/conf.d/example.conf

-14
This file was deleted.

docker/supervisord/Dockerfile

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM php:8.1
2+
3+
# Install dependencies
4+
RUN apt-get update && apt-get install -y \
5+
libpq-dev \
6+
supervisor
7+
8+
# Clear cache
9+
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
10+
11+
COPY supervisord.conf /etc/supervisor
12+
COPY conf.d/* /etc/supervisor/conf.d
13+
14+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[program:messenger-consume]
2+
command=php /var/www/backend/src/bin/supervisor
3+
user=root
4+
numprocs=1
5+
startsecs=0
6+
autostart=true
7+
autorestart=true
8+
process_name=%(program_name)s_%(process_num)02d

docker/backend/supervisor/supervisord.conf renamed to docker/supervisord/supervisord.conf

-3
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,5 @@ port = 9001
1919
username = root
2020
password = root
2121

22-
[program:php]
23-
command=docker-php-entrypoint php-fpm # This is our main process so let us put it here
24-
2522
[include]
2623
files=/etc/supervisor/conf.d/*.conf

src/.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
/vendor
1+
/vendor
2+
3+
# Supervisor debug info
4+
src/bin/supervisor-debug.log

0 commit comments

Comments
 (0)