Deliver complete stack for nextcloud.

This commit is contained in:
2022-02-22 09:13:24 +01:00
parent b788fa12bc
commit 146d69e6fd
4 changed files with 53 additions and 38 deletions

4
.env
View File

@@ -1,8 +1,4 @@
DB_ROOT_PW=340985asdfklweo20350~ DB_ROOT_PW=340985asdfklweo20350~
REDIS_PW=230skdfjl~23409
NEXTCLOUD_ADMIN_USER=chris
NEXTCLOUD_ADMIN_PW=lmaa,dw.
# InfluxDB options # InfluxDB options
INFLUXDB_DB=influx INFLUXDB_DB=influx

View File

@@ -115,14 +115,3 @@ services:
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"] test: ["CMD-SHELL", "pg_isready -U postgres"]
redis:
image: redis:alpine
container_name: redis
restart: unless-stopped
volumes:
- redis-data:/data
networks:
- internal
healthcheck:
test: ["CMD-SHELL", "redis-cli ping"]

View File

@@ -7,40 +7,48 @@ volumes:
name: nextcloud-data name: nextcloud-data
nextcloud-config: nextcloud-config:
name: nextcloud-config name: nextcloud-config
nextcloud-db:
name: nextcloud-db
nextcloud-redis:
name: nextcloud-redis
networks: networks:
proxy: proxy:
external: true external: true
internal: nextcloud:
external: true name: nextcloud
external: false
services: services:
nextcloud: nextcloud:
image: nextcloud:22-fpm-alpine image: nextcloud:22-fpm-alpine
container_name: nextcloud container_name: nextcloud
hostname: nextcloud-web
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- nextcloud:/var/www/html - nextcloud:/var/www/html
- nextcloud-data:/var/www/html/data - nextcloud-data:/var/www/html/data
- nextcloud-config:/var/www/html/config - nextcloud-config:/var/www/html/config
depends_on:
- nextcloud-db
- nextcloud-redis
networks: networks:
- internal - nextcloud
env_file: ../.env
environment: environment:
- POSTGRES_DB:nextcloud POSTGRES_PASSWORD: ${DB_PASS}
- POSTGRES_USER:nextcloud POSTGRES_USER: ${DB_USER}
- POSTGRES_PASSWORD:jX9hKI2POvt1VrjVbBs4 POSTGRES_DB: ${DB_NAME}
- POSTGRES_HOST:pgsql14 POSTGRES_HOST: nextcloud-db:5432
- REDIS_HOST:redis REDIS_HOST: nextcloud-redis
- REDIS_HOST_PASSWORD:${REDIS_PW} NEXTCLOUD_ADMIN_USER: ${NEXTCLOUD_ADMIN_USER}
- NEXTCLOUD_ADMIN_USER:${NEXTCLOUD_ADMIN_USER} NEXTCLOUD_ADMIN_PASSWORD: ${NEXTCLOUD_ADMIN_PW}
- NEXTCLOUD_ADMIN_PASSWORD:${NEXTCLOUD_ADMIN_PW} NEXTCLOUD_TRUSTED_DOMAINS: cs-nextcloud.ddnss.de nextcloud.lan
- NEXTCLOUD_TRUSTED_DOMAINS:cs-nextcloud.ddnss.de nextcloud.lan VIRTUAL_HOST: nextcloud
- VIRTUAL_HOST:nextcloud
nginx-nc: nextcloud-web:
image: nginx:alpine image: nginx:alpine
container_name: nginx-nc container_name: nextcloud-web
hostname: nextcloud-web
restart: unless-stopped restart: unless-stopped
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
@@ -61,12 +69,39 @@ services:
- "traefik.http.middlewares.nextcloud-redirect.redirectregex.permanent=true" - "traefik.http.middlewares.nextcloud-redirect.redirectregex.permanent=true"
- "traefik.http.middlewares.nextcloud-redirect.redirectregex.regex=^https://(.*)/.well-known/(card|cal)dav" - "traefik.http.middlewares.nextcloud-redirect.redirectregex.regex=^https://(.*)/.well-known/(card|cal)dav"
- "traefik.http.middlewares.nextcloud-redirect.redirectregex.replacement=https://$${1}/remote.php/dav/" - "traefik.http.middlewares.nextcloud-redirect.redirectregex.replacement=https://$${1}/remote.php/dav/"
depends_on: depends_on:
- nextcloud - nextcloud
networks: networks:
- proxy - proxy
- internal - nextcloud
volumes: volumes:
- nextcloud:/var/www/html - nextcloud:/var/www/html
- ${PWD}/nextcloud.conf:/etc/nginx/conf.d/default.conf - ${PWD}/nextcloud.conf:/etc/nginx/conf.d/default.conf
nextcloud-db:
image: postgres:14-alpine
container_name: nextcloud-db
hostname: naextcloud-db
restart: unless-stopped
volumes:
- nextcloud-db:/var/lib/postgresql/data
networks:
- nextcloud
environment:
POSTGRES_PASSWORD: ${DB_PASS}
POSTGRES_USER: ${DB_USER}
POSTGRES_DB: ${DB_NAME}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $DB_USER"]
nextcloud-redis:
image: redis:alpine
container_name: nextcloud-redis
hostname: nextcloud-redis
restart: unless-stopped
volumes:
- nextcloud-redis:/data
networks:
- nextcloud
healthcheck:
test: ["CMD-SHELL", "redis-cli ping"]

View File

@@ -1,14 +1,9 @@
-- create the databases; -- create the databases;
CREATE DATABASE nextcloud;
CREATE DATABASE gitea; CREATE DATABASE gitea;
CREATE DATABASE mattermost; CREATE DATABASE mattermost;
-- create users and privileges -- create users and privileges
CREATE USER nextcloud WITH PASSWORD 'jX9hKI2POvt1VrjVbBs4';
GRANT ALL PRIVILEGES ON DATABASE nextcloud TO nextcloud;
CREATE USER gitea WITH PASSWORD 'sadlkf0234lsdf'; CREATE USER gitea WITH PASSWORD 'sadlkf0234lsdf';
GRANT ALL PRIVILEGES ON DATABASE gitea TO gitea; GRANT ALL PRIVILEGES ON DATABASE gitea TO gitea;