Skip to content

Commit 56660f4

Browse files
authored
Merge pull request #116 from LibreCodeCoop/feat/multi-instance-compose
feat: multi instance compose
2 parents 0313b8c + 9041189 commit 56660f4

9 files changed

Lines changed: 225 additions & 66 deletions

File tree

.docker/Dockerfile.php81

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ VOLUME /var/www/html
7777

7878
WORKDIR /var/www/html
7979

80-
ENTRYPOINT [ "bash", "/var/www/scripts/entrypoint.sh" ]
80+
ENTRYPOINT [ "bash", "/var/www/scripts/nextcloud-entrypoint.sh" ]
8181
CMD ["php-fpm"]

.docker/Dockerfile.php82

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ VOLUME /var/www/html
7777

7878
WORKDIR /var/www/html
7979

80-
ENTRYPOINT [ "bash", "/var/www/scripts/entrypoint.sh" ]
80+
ENTRYPOINT [ "bash", "/var/www/scripts/nextcloud-entrypoint.sh" ]
8181
CMD ["php-fpm"]

.docker/Dockerfile.php83

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ VOLUME /var/www/html
7777

7878
WORKDIR /var/www/html
7979

80-
ENTRYPOINT [ "bash", "/var/www/scripts/entrypoint.sh" ]
80+
ENTRYPOINT [ "bash", "/var/www/scripts/nextcloud-entrypoint.sh" ]
8181
CMD ["php-fpm"]

.docker/config/php/xdebug.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
xdebug.client_host=host.docker.internal
22
xdebug.discover_client_host=true
33
xdebug.log_level=0
4-
xdebug.mode=debug
54
xdebug.start_with_request=yes

.docker/database-services.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
services:
2+
mysql:
3+
# Pin to 8.4: mysql:latest currently resolves to 9.x, and Nextcloud autoinstall
4+
# runs with the application user, which cannot read mysql.component there.
5+
image: mysql:8.4
6+
volumes:
7+
- ../volumes/mysql/init:/docker-entrypoint-initdb.d
8+
- ../volumes/mysql/data:/var/lib/mysql
9+
ports:
10+
- target: 3306
11+
published: "3306-3325"
12+
host_ip: ${IP_BIND:-127.0.0.1}
13+
command: ["mysqld"]
14+
environment:
15+
- TZ=${TZ:-CET}
16+
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}
17+
- MYSQL_DATABASE=${MYSQL_DATABASE:-nextcloud}
18+
- MYSQL_USER=${MYSQL_USER:-nextcloud}
19+
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-nextcloud}
20+
pgsql:
21+
image: postgres:13-alpine
22+
volumes:
23+
- ../volumes/postgres/data:/var/lib/postgresql/data
24+
ports:
25+
- target: 5432
26+
published: "5432-5451"
27+
host_ip: ${IP_BIND:-127.0.0.1}
28+
command: ["postgres", "-c", "log_statement=all"]
29+
environment:
30+
- POSTGRES_DB=${POSTGRES_DB:-nextcloud}
31+
- POSTGRES_USER=${POSTGRES_USER:-nextcloud}
32+
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-nextcloud}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,5 @@ exec busybox crond -f -l 0 -L /dev/stdout > /dev/null 2>&1 &
140140
runuser -u www-data -- php -f /var/www/html/cron.php
141141

142142
# Start PHP-FPM
143-
if [[ "$HTTP_PORT" != 80 ]]; then
144-
echo "💙 Nextclud is up! Access http://localhost:$HTTP_PORT"
145-
else
146-
echo "💙 Nextclud is up! Access http://localhost"
147-
fi
143+
echo "💙 Nextcloud is up!"
148144
exec "$@"

README.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
# Nextcloud development environment
22

3-
An development apps environment for Nextcloud.
3+
A Docker Compose-based development environment for Nextcloud.
44

5-
## Development environment
5+
> [!WARNING]
6+
> This environment is intended for development only. It uses default credentials and insecure development settings and must not be used in production.
67
7-
Run the command:
8+
## Quick start
9+
10+
Start the basic environment with MySQL:
811

912
```bash
10-
docker compose up nextcloud mysql nginx mailpit redis
13+
docker compose up
1114
```
1215

13-
* [Advanced setup](docs/advanced-setup.md)
14-
* [Environments](docs/advanced-setup.md#environments)
15-
* [PHP custom settings](docs/advanced-setup.md#php-custom-settings)
16-
* [App development](docs/apps-development.md)
17-
* [Sample](docs/apps-development.md#samble)
18-
* [FAQ](docs/faq.md)
19-
* [Reset setup](docs/faq.md#reset-setup)
20-
* [Upgrade to newest commits of server repository](docs/faq.md#upgrade-to-newest-commits-of-server-repository)
21-
* [Using IDE](docs/faq.md#using-ide)
22-
* [Fix permissions](docs/faq.md#fix-permissions)
23-
* [Simplify commands with alias](docs/bash_aliases.md)
16+
For PostgreSQL, optional services, dynamic host ports, multiple environments,
17+
and other advanced configuration, see the
18+
[advanced setup guide](docs/advanced-setup.md).
19+
20+
## More documentation
21+
22+
- [Advanced setup](docs/advanced-setup.md)
23+
- [App development](docs/apps-development.md)
24+
- [FAQ](docs/faq.md)

docker-compose.yml

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,26 @@
11
services:
2-
pgsql:
3-
image: postgres:13-alpine
4-
restart: unless-stopped
5-
volumes:
6-
- ./volumes/postgres/data:/var/lib/postgresql/data
7-
environment:
8-
- POSTGRES_DB=${POSTGRES_DB:-nextcloud}
9-
- POSTGRES_USER=${POSTGRES_USER:-nextcloud}
10-
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-nextcloud}
11-
ports:
12-
- 127.0.0.1:5432:5432
13-
command: postgres -c log_statement=all
14-
mysql:
15-
# Pin to 8.4: mysql:latest currently resolves to 9.x, and Nextcloud autoinstall
16-
# runs with the application user, which cannot read mysql.component there.
17-
image: mysql:8.4
18-
volumes:
19-
- ./volumes/mysql/init:/docker-entrypoint-initdb.d
20-
- ./volumes/mysql/data:/var/lib/mysql
21-
ports:
22-
- 127.0.0.1:3306:3306
23-
restart: unless-stopped
24-
environment:
25-
- TZ=${TZ:-CET}
26-
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}
27-
- MYSQL_DATABASE=${MYSQL_DATABASE:-nextcloud}
28-
- MYSQL_USER=${MYSQL_USER:-nextcloud}
29-
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-nextcloud}
2+
database:
3+
extends:
4+
file: .docker/database-services.yml
5+
service: ${DB_HOST:-mysql}
6+
networks:
7+
default:
8+
aliases:
9+
- ${DB_HOST:-mysql}
3010
nextcloud:
3111
image: ghcr.io/librecodecoop/nextcloud-dev-php${PHP_VERSION:-83}:latest
3212
# build:
3313
# context: .docker/
3414
# dockerfile: Dockerfile.php${PHP_VERSION:-83}
3515
volumes:
3616
- ./.docker/scripts/wait-for-db.php:/var/www/scripts/wait-for-db.php
17+
- ./volumes/php:/var/www/php-config
3718
- ~/.composer:/var/www/.composer/
3819
- ~/.npm:/var/www/.npm/
3920
- ./volumes/nextcloud:/var/www/html
4021
restart: unless-stopped
22+
depends_on:
23+
- database
4124
environment:
4225
- HOST_UID=${HOST_UID:-1000}
4326
- HOST_GID=${HOST_GID:-1000}
@@ -56,10 +39,11 @@ services:
5639
- MAIL_DOMAIN=${MAIL_DOMAIN:-nextcloud.test}
5740
- MAIL_SMTPPORT=${MAIL_SMTPPORT:-1025}
5841
- MAIL_SMTPHOST=${MAIL_SMTPHOST:-mailpit}
59-
- VERSION_NEXTCLOUD=${VERSION_NEXTCLOUD:-stable33}
42+
- VERSION_NEXTCLOUD=${VERSION_NEXTCLOUD:-master}
6043
- AUTOINSTALL=${AUTOINSTALL:-1}
6144
- XDEBUG_CONFIG
62-
- HTTP_PORT=${HTTP_PORT:-80}
45+
- XDEBUG_MODE
46+
- PHP_INI_SCAN_DIR=/usr/local/etc/php/conf.d:/var/www/php-config
6347
extra_hosts:
6448
- host.docker.internal:host-gateway
6549
nginx:
@@ -75,23 +59,33 @@ services:
7559
- ./volumes/nginx/includes:/etc/nginx/conf.d/includes/
7660
- ./volumes/nginx/certs:/certs
7761
ports:
78-
- ${HTTP_PORT:-80}:80
79-
- 443:443
62+
- target: 80
63+
published: "${HTTP_PORT:-80-99}"
64+
host_ip: ${IP_BIND:-127.0.0.1}
65+
- target: 443
66+
published: "${HTTPS_PORT:-443-462}"
67+
host_ip: ${IP_BIND:-127.0.0.1}
8068
mailpit:
8169
image: axllent/mailpit
8270
ports:
83-
- 127.0.0.1:${MAILHOG_PORT:-8025}:8025
71+
- target: 8025
72+
published: "${MAILHOG_PORT:-8025-8044}"
73+
host_ip: ${IP_BIND:-127.0.0.1}
8474
redis:
8575
image: redis
8676
eurooffice:
8777
image: ghcr.io/euro-office/documentserver:latest
78+
profiles:
79+
- eurooffice
8880
restart: always
8981
volumes:
9082
- ./volumes/eurooffice:/home/eurooffice/.eurooffice
9183
- ./volumes/eurooffice/local.json:/etc/onlyoffice/documentserver/local.json
9284
- ./volumes/nextcloud/apps-extra/eurooffice-plugin:/var/www/onlyoffice/documentserver/sdkjs-plugins/libresign:ro
9385
ports:
94-
- 8080:80
86+
- target: 80
87+
published: "8080-8099"
88+
host_ip: ${IP_BIND:-127.0.0.1}
9589
environment:
9690
- EXAMPLE_ENABLED=true
9791
- JWT_SECRET=${JWT_SECRET:-my_jwt_secret}
@@ -101,13 +95,16 @@ services:
10195
- host.docker.internal:host-gateway
10296
playwright:
10397
image: mcr.microsoft.com/playwright:v1.59.1-noble
104-
container_name: nextcloud-playwright
98+
profiles:
99+
- playwright
105100
user: pwuser
106101
volumes:
107102
- ./volumes/nextcloud:/var/www/html
108103
working_dir: /var/www/html
109104
ports:
110-
- 127.0.0.1:9323:9323
105+
- target: 9323
106+
published: "9323-9342"
107+
host_ip: ${IP_BIND:-127.0.0.1}
111108
environment:
112109
- PLAYWRIGHT_BASE_URL=${PLAYWRIGHT_BASE_URL:-https://nginx}
113110
- NODE_ENV=test
@@ -120,15 +117,21 @@ services:
120117
- default
121118
signal-gateway:
122119
image: bbernhard/signal-cli-rest-api:latest
120+
profiles:
121+
- signal
123122
restart: unless-stopped
124123
ports:
125-
- 127.0.0.1:5001:8080
124+
- target: 8080
125+
published: "5001-5020"
126+
host_ip: ${IP_BIND:-127.0.0.1}
126127
volumes:
127128
- ./volumes/signal:/home/.local/share/signal-cli
128129
environment:
129130
- LOG_LEVEL=info
130131
whatsapp.web:
131132
image: aldinokemal2104/go-whatsapp-web-multidevice
133+
profiles:
134+
- whatsapp
132135
restart: unless-stopped
133136
environment:
134137
- APP_PORT=3000

0 commit comments

Comments
 (0)