mirror of
				https://github.com/rorydavidson/owncloud-nginx-letsencrypt-docker.git
				synced 2025-11-04 10:01:25 +01:00 
			
		
		
		
	First real commit
This commit is contained in:
		
							
								
								
									
										45
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								README.md
									
									
									
									
									
								
							@@ -1,2 +1,43 @@
 | 
			
		||||
# owncloud-docker
 | 
			
		||||
Docker compose and information to run OwnCLoud with an Nginx proxy and LetsEncrypt
 | 
			
		||||
# owncloud-nginx-letsencrypt-docker
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
## Information sources
 | 
			
		||||
 | 
			
		||||
This is consolidated based on information from the following places and thanks to them:
 | 
			
		||||
- [ownCloud server repository](https://github.com/owncloud-docker/server)
 | 
			
		||||
- [LetsEncrypt NGINX Proxy companion](https://hub.docker.com/r/jrcs/letsencrypt-nginx-proxy-companion/)
 | 
			
		||||
 | 
			
		||||
## Get started
 | 
			
		||||
 | 
			
		||||
Pretty straightforward, follow these steps...
 | 
			
		||||
 | 
			
		||||
Set up the necessary environment variables at the command line (or equivalent method on the relevant operating system):
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
cat << EOF >| .env
 | 
			
		||||
OWNCLOUD_VERSION=10.0
 | 
			
		||||
OWNCLOUD_DOMAIN=localhost
 | 
			
		||||
ADMIN_USERNAME=admin
 | 
			
		||||
ADMIN_PASSWORD=admin
 | 
			
		||||
HTTP_PORT=80
 | 
			
		||||
EOF
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Change the hostname variables above and in the `docker-compose.yml` file as necessary specifically the variables in the owncloud service environment block:
 | 
			
		||||
 | 
			
		||||
```yml
 | 
			
		||||
    environment:
 | 
			
		||||
      - VIRTUAL_HOST=local.local.info
 | 
			
		||||
      - VIRTUAL_PORT=8080
 | 
			
		||||
      - LETSENCRYPT_HOST=local.local.info
 | 
			
		||||
      - LETSENCRYPT_EMAIL=x@x.x
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
And then run docker compose up to get going.
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
docker-compose up -d`
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										97
									
								
								docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										97
									
								
								docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,97 @@
 | 
			
		||||
version: '2.1'
 | 
			
		||||
 | 
			
		||||
volumes:
 | 
			
		||||
  files:
 | 
			
		||||
    driver: local
 | 
			
		||||
  mysql:
 | 
			
		||||
    driver: local
 | 
			
		||||
  backup:
 | 
			
		||||
    driver: local
 | 
			
		||||
  redis:
 | 
			
		||||
    driver: local
 | 
			
		||||
 | 
			
		||||
services:
 | 
			
		||||
  nginx-proxy:
 | 
			
		||||
    image: jwilder/nginx-proxy
 | 
			
		||||
    ports:
 | 
			
		||||
      - "80:80"
 | 
			
		||||
      - "443:443"
 | 
			
		||||
    volumes:
 | 
			
		||||
      - /var/run/docker.sock:/tmp/docker.sock:ro
 | 
			
		||||
      - /apps/docker-articles/nginx/vhost.d:/etc/nginx/vhost.d
 | 
			
		||||
      - /apps/docker-articles/nginx/certs:/etc/nginx/certs:ro
 | 
			
		||||
      - /apps/docker-articles/nginx/html:/usr/share/nginx/html
 | 
			
		||||
    labels:
 | 
			
		||||
     com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
 | 
			
		||||
 | 
			
		||||
  letsencrypt:
 | 
			
		||||
    image: jrcs/letsencrypt-nginx-proxy-companion:latest
 | 
			
		||||
    volumes:
 | 
			
		||||
      - /var/run/docker.sock:/var/run/docker.sock:ro
 | 
			
		||||
      - /apps/docker-articles/nginx/vhost.d:/etc/nginx/vhost.d
 | 
			
		||||
      - /apps/docker-articles/nginx/certs:/etc/nginx/certs:rw
 | 
			
		||||
      - /apps/docker-articles/nginx/html:/usr/share/nginx/html
 | 
			
		||||
 | 
			
		||||
  owncloud:
 | 
			
		||||
    image: owncloud/server:${OWNCLOUD_VERSION}
 | 
			
		||||
    restart: always
 | 
			
		||||
    ports:
 | 
			
		||||
      - ${HTTP_PORT}:8080
 | 
			
		||||
    depends_on:
 | 
			
		||||
      - db
 | 
			
		||||
      - redis
 | 
			
		||||
    environment:
 | 
			
		||||
      - VIRTUAL_HOST=local.local.info
 | 
			
		||||
      - VIRTUAL_PORT=8080
 | 
			
		||||
      - LETSENCRYPT_HOST=local.local.info
 | 
			
		||||
      - LETSENCRYPT_EMAIL=x@x.x
 | 
			
		||||
      - OWNCLOUD_DOMAIN=${OWNCLOUD_DOMAIN}
 | 
			
		||||
      - OWNCLOUD_DB_TYPE=mysql
 | 
			
		||||
      - OWNCLOUD_DB_NAME=owncloud
 | 
			
		||||
      - OWNCLOUD_DB_USERNAME=owncloud
 | 
			
		||||
      - OWNCLOUD_DB_PASSWORD=owncloud
 | 
			
		||||
      - OWNCLOUD_DB_HOST=db
 | 
			
		||||
      - OWNCLOUD_ADMIN_USERNAME=${ADMIN_USERNAME}
 | 
			
		||||
      - OWNCLOUD_ADMIN_PASSWORD=${ADMIN_PASSWORD}
 | 
			
		||||
      - OWNCLOUD_MYSQL_UTF8MB4=true
 | 
			
		||||
      - OWNCLOUD_REDIS_ENABLED=true
 | 
			
		||||
      - OWNCLOUD_REDIS_HOST=redis
 | 
			
		||||
    healthcheck:
 | 
			
		||||
      test: ["CMD", "/usr/bin/healthcheck"]
 | 
			
		||||
      interval: 30s
 | 
			
		||||
      timeout: 10s
 | 
			
		||||
      retries: 5
 | 
			
		||||
    volumes:
 | 
			
		||||
      - files:/mnt/data
 | 
			
		||||
 | 
			
		||||
  db:
 | 
			
		||||
    image: webhippie/mariadb:latest
 | 
			
		||||
    restart: always
 | 
			
		||||
    environment:
 | 
			
		||||
      - MARIADB_ROOT_PASSWORD=owncloud
 | 
			
		||||
      - MARIADB_USERNAME=owncloud
 | 
			
		||||
      - MARIADB_PASSWORD=owncloud
 | 
			
		||||
      - MARIADB_DATABASE=owncloud
 | 
			
		||||
      - MARIADB_MAX_ALLOWED_PACKET=128M
 | 
			
		||||
      - MARIADB_INNODB_LOG_FILE_SIZE=64M
 | 
			
		||||
    healthcheck:
 | 
			
		||||
      test: ["CMD", "/usr/bin/healthcheck"]
 | 
			
		||||
      interval: 30s
 | 
			
		||||
      timeout: 10s
 | 
			
		||||
      retries: 5
 | 
			
		||||
    volumes:
 | 
			
		||||
      - mysql:/var/lib/mysql
 | 
			
		||||
      - backup:/var/lib/backup
 | 
			
		||||
 | 
			
		||||
  redis:
 | 
			
		||||
    image: webhippie/redis:latest
 | 
			
		||||
    restart: always
 | 
			
		||||
    environment:
 | 
			
		||||
      - REDIS_DATABASES=1
 | 
			
		||||
    healthcheck:
 | 
			
		||||
      test: ["CMD", "/usr/bin/healthcheck"]
 | 
			
		||||
      interval: 30s
 | 
			
		||||
      timeout: 10s
 | 
			
		||||
      retries: 5
 | 
			
		||||
    volumes:
 | 
			
		||||
      - redis:/var/lib/redis
 | 
			
		||||
		Reference in New Issue
	
	Block a user