├── LICENSE ├── README.md └── docker-compose.yml /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Rory Davidson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # owncloud-nginx-letsencrypt-docker 2 | 3 | This is a simple repo with information on the a `docker-compose.yml` to run [ownCloud](https://owncloud.org/) with an Nginx proxy and LetsEncrypt using Docker, as I was able to find anything that did everything I needed based on the official documentation from ownCloud and kept separate volumes for data. 4 | 5 | ## Information sources 6 | 7 | This is consolidated based on information from the following places and thanks to them: 8 | - [ownCloud server repository](https://github.com/owncloud-docker/server) 9 | - [LetsEncrypt NGINX Proxy companion](https://hub.docker.com/r/jrcs/letsencrypt-nginx-proxy-companion/) 10 | 11 | ## Get started 12 | 13 | Pretty straightforward, follow these steps... 14 | 15 | Set up the necessary environment variables at the command line (or equivalent method on the relevant operating system): 16 | 17 | ```bash 18 | cat << EOF >| .env 19 | OWNCLOUD_VERSION=10.0 20 | OWNCLOUD_DOMAIN=localhost 21 | ADMIN_USERNAME=admin 22 | ADMIN_PASSWORD=admin 23 | HTTP_PORT=8080 24 | EOF 25 | ``` 26 | 27 | The webserver is nginx-proxy and it will listen on ports 80 and 443 by default, redirecting traffic to HTTPS for your ownCloud instance. The HTTP_PORT environment variable sets which port ownCloud itself will listen. 28 | 29 | Change the hostname variables above and in the `docker-compose.yml` file as necessary specifically the variables in the owncloud service environment block: 30 | 31 | ```yml 32 | environment: 33 | - VIRTUAL_HOST=local.local.info 34 | - VIRTUAL_PORT=8080 35 | - LETSENCRYPT_HOST=local.local.info 36 | - LETSENCRYPT_EMAIL=x@x.x 37 | ``` 38 | 39 | And then run docker compose up to get going. 40 | 41 | ```bash 42 | docker-compose up -d 43 | ``` 44 | 45 | You should then be able to access it at the domain name you entered and it will redirect to the https URL with a valid certificate. 46 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2.1' 2 | 3 | volumes: 4 | files: 5 | driver: local 6 | mysql: 7 | driver: local 8 | backup: 9 | driver: local 10 | redis: 11 | driver: local 12 | 13 | services: 14 | nginx-proxy: 15 | image: jwilder/nginx-proxy 16 | restart: always 17 | ports: 18 | - "80:80" 19 | - "443:443" 20 | volumes: 21 | - /var/run/docker.sock:/tmp/docker.sock:ro 22 | - /apps/docker-articles/nginx/vhost.d:/etc/nginx/vhost.d 23 | - /apps/docker-articles/nginx/certs:/etc/nginx/certs:ro 24 | - /apps/docker-articles/nginx/html:/usr/share/nginx/html 25 | labels: 26 | com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true" 27 | 28 | letsencrypt: 29 | image: jrcs/letsencrypt-nginx-proxy-companion:latest 30 | restart: always 31 | depends_on: 32 | - nginx-proxy 33 | volumes: 34 | - /var/run/docker.sock:/var/run/docker.sock:ro 35 | - /apps/docker-articles/nginx/vhost.d:/etc/nginx/vhost.d 36 | - /apps/docker-articles/nginx/certs:/etc/nginx/certs:rw 37 | - /apps/docker-articles/nginx/html:/usr/share/nginx/html 38 | 39 | owncloud: 40 | image: owncloud/server:${OWNCLOUD_VERSION} 41 | restart: always 42 | ports: 43 | - ${HTTP_PORT}:8080 44 | depends_on: 45 | - db 46 | - redis 47 | environment: 48 | - VIRTUAL_HOST=local.local.info 49 | - VIRTUAL_PORT=8080 50 | - LETSENCRYPT_HOST=local.local.info 51 | - LETSENCRYPT_EMAIL=x@x.x 52 | - OWNCLOUD_DOMAIN=${OWNCLOUD_DOMAIN} 53 | - OWNCLOUD_DB_TYPE=mysql 54 | - OWNCLOUD_DB_NAME=owncloud 55 | - OWNCLOUD_DB_USERNAME=owncloud 56 | - OWNCLOUD_DB_PASSWORD=owncloud 57 | - OWNCLOUD_DB_HOST=db 58 | - OWNCLOUD_ADMIN_USERNAME=${ADMIN_USERNAME} 59 | - OWNCLOUD_ADMIN_PASSWORD=${ADMIN_PASSWORD} 60 | - OWNCLOUD_MYSQL_UTF8MB4=true 61 | - OWNCLOUD_REDIS_ENABLED=true 62 | - OWNCLOUD_REDIS_HOST=redis 63 | healthcheck: 64 | test: ["CMD", "/usr/bin/healthcheck"] 65 | interval: 30s 66 | timeout: 10s 67 | retries: 5 68 | volumes: 69 | - files:/mnt/data 70 | 71 | db: 72 | image: webhippie/mariadb:latest 73 | restart: always 74 | environment: 75 | - MARIADB_ROOT_PASSWORD=owncloud 76 | - MARIADB_USERNAME=owncloud 77 | - MARIADB_PASSWORD=owncloud 78 | - MARIADB_DATABASE=owncloud 79 | - MARIADB_MAX_ALLOWED_PACKET=128M 80 | - MARIADB_INNODB_LOG_FILE_SIZE=64M 81 | healthcheck: 82 | test: ["CMD", "/usr/bin/healthcheck"] 83 | interval: 30s 84 | timeout: 10s 85 | retries: 5 86 | volumes: 87 | - mysql:/var/lib/mysql 88 | - backup:/var/lib/backup 89 | 90 | redis: 91 | image: webhippie/redis:latest 92 | restart: always 93 | environment: 94 | - REDIS_DATABASES=1 95 | healthcheck: 96 | test: ["CMD", "/usr/bin/healthcheck"] 97 | interval: 30s 98 | timeout: 10s 99 | retries: 5 100 | volumes: 101 | - redis:/var/lib/redis 102 | --------------------------------------------------------------------------------