Created
November 16, 2018 23:20
-
-
Save pbt001/f9adbc0e9a08c8f7504dd5c5e5de806f to your computer and use it in GitHub Desktop.
Docker compose with Nextcloud + Cron + MariaDB + Reverse Proxy + Let's Encrypt + Postfix relay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
proxy: | |
image: jwilder/nginx-proxy:alpine | |
labels: | |
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true" | |
container_name: nextcloud-proxy | |
networks: | |
- nextcloud_default | |
ports: | |
- 80:80 | |
- 443:443 | |
volumes: | |
- ./proxy/conf.d:/etc/nginx/conf.d:rw | |
- ./proxy/vhost.d:/etc/nginx/vhost.d:rw | |
- ./proxy/html:/usr/share/nginx/html:rw | |
- ./proxy/certs:/etc/nginx/certs:ro | |
- /etc/localtime:/etc/localtime:ro | |
- /var/run/docker.sock:/tmp/docker.sock:ro | |
restart: unless-stopped | |
letsencrypt: | |
image: jrcs/letsencrypt-nginx-proxy-companion | |
container_name: nextcloud-letsencrypt | |
depends_on: | |
- proxy | |
networks: | |
- nextcloud_default | |
volumes: | |
- ./proxy/certs:/etc/nginx/certs:rw | |
- ./proxy/vhost.d:/etc/nginx/vhost.d:rw | |
- ./proxy/html:/usr/share/nginx/html:rw | |
- /etc/localtime:/etc/localtime:ro | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
restart: unless-stopped | |
db: | |
image: mariadb | |
container_name: nextcloud-mariadb | |
networks: | |
- nextcloud_default | |
volumes: | |
- ./db:/var/lib/mysql | |
- /etc/localtime:/etc/localtime:ro | |
environment: | |
- MYSQL_ROOT_PASSWORD= | |
- MYSQL_PASSWORD= | |
- MYSQL_DATABASE=nextcloud | |
- MYSQL_USER=nextcloud | |
restart: unless-stopped | |
cron: | |
image: nextcloud:11.0.5 | |
container_name: nextcloud-cron | |
volumes: | |
- nextcloud:/var/www/html | |
networks: | |
- nextcloud_default | |
user: www-data | |
entrypoint: | | |
bash -c 'bash -s <<EOF | |
trap "break;exit" SIGHUP SIGINT SIGTERM | |
while [ ! -f /var/www/html/config/config.php ]; do | |
sleep 1 | |
done | |
while true; do | |
php -f /var/www/html/cron.php | |
sleep 15m | |
done | |
EOF' | |
depends_on: | |
- db | |
restart: unless-stopped | |
app: | |
image: nextcloud:11.0.5 | |
container_name: nextcloud-app | |
networks: | |
- nextcloud_default | |
depends_on: | |
- letsencrypt | |
- proxy | |
- db | |
volumes: | |
- nextcloud:/var/www/html | |
- ./app/config:/var/www/html/config | |
- ./app/custom_apps:/var/www/html/custom_apps | |
- ./app/data:/var/www/html/data | |
- ./app/themes:/var/www/html/themes | |
- /etc/localtime:/etc/localtime:ro | |
environment: | |
- VIRTUAL_HOST=nextcloud.example.com | |
- LETSENCRYPT_HOST=nextcloud.example.com | |
- [email protected] | |
restart: unless-stopped | |
postfix: | |
image: alterrebe/postfix-relay | |
container_name: nextcloud-postfix | |
networks: | |
- nextcloud_default | |
depends_on: | |
- app | |
volumes: | |
- /etc/localtime:/etc/localtime:ro | |
environment: | |
- RELAY_HOST_NAME=nextcloud.example.com | |
- ACCEPTED_NETWORK=0.0.0.0/0 | |
- EXT_RELAY_HOST=[smtp.example.com] | |
- EXT_RELAY_PORT=587 | |
- [email protected] | |
- SMTP_PASSWORD= | |
- USE_TLS=yes | |
- TLS_VERIFY=may | |
restart: unless-stopped | |
volumes: | |
nextcloud: | |
networks: | |
nextcloud_default: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$CONFIG = array ( | |
'trusted_domains' => | |
array ( | |
0 => 'nextcloud.example.com', | |
1 => '127.0.0.1', | |
), | |
'apps_paths' => | |
array ( | |
0 => | |
array ( | |
'path' => '/var/www/html/apps', | |
'url' => '/apps', | |
'writable' => false, | |
), | |
1 => | |
array ( | |
'path' => '/var/www/html/custom_apps', | |
'url' => '/custom_apps', | |
'writable' => true, | |
), | |
), | |
'datadirectory' => '/var/www/html/data', | |
'dbtype' => 'mysql', | |
'version' => '11.0.5.1', | |
'dbname' => 'nextcloud', | |
'dbhost' => 'db:3306', | |
'dbuser' => 'nextcloud', | |
'dbpassword' => '', | |
'cron_log' => true, | |
'mail_smtpmode' => 'postfix', | |
'mail_from_address' => 'nextcloud', | |
'mail_domain' => 'example.com', | |
'mail_smtphost' => 'postfix', | |
'mail_smtpport' => '25', | |
'forcessl' => true, | |
'memcache.local' => '\\OC\\Memcache\\APCu', | |
'overwrite.cli.url' => 'http://127.0.0.1:8000', | |
'htaccess.RewriteBase' => '/', | |
'enable_previews' => true, | |
'updater.release.channel' => 'stable', | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment