Skip to content

Commit

Permalink
Add nextcloud-redis-mariadb sample
Browse files Browse the repository at this point in the history
Signed-off-by: Anca Iordache <anca.iordache@docker.com>
  • Loading branch information
Anca Iordache committed Mar 19, 2020
1 parent 4cd956e commit fb99b4c
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 0 deletions.
77 changes: 77 additions & 0 deletions nextcloud-redis-mariadb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
## Nextcloud with Redis and MariaDB
This example defines one of the basic setups for Nextcloud. More details on how to
further customize the installation and the compose file can be found on the
[official image page](https://hub.docker.com/_/nextcloud).


Project structure:
```
.
├── docker-compose.yaml
└── README.md
```

[_docker-compose.yaml_](docker-compose.yaml)
```
services:
nc:
image: nextcloud:apache
ports:
- 80:80
...
redis:
image: redis:alpine
restart: always
networks:
- redisnet
db:
image: mariadb
...
```

When deploying this setup, docker-compose maps the nextcloud container port 80 to
port 80 of the host as specified in the compose file.

## Deploy with docker-compose

```
$ docker$ compose up -d
Creating network "nextcloud-redis-mariadb_redisnet" with the default driver
Creating network "nextcloud-redis-mariadb_dbnet" with the default driver
Creating volume "nextcloud-redis-mariadb_nc_data" with default driver
Pulling redis (redis:alpine)...
alpine: Pulling from library/redis....
....
Status: Downloaded newer image for mariadb:latest
Creating nextcloud-redis-mariadb_db_1 ... done
Creating nextcloud-redis-mariadb_nc_1 ... done
Creating nextcloud-redis-mariadb_redis_1 ... done
```


## Expected result

Check containers are running and the port mapping:
```
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6541add4d648 nextcloud:apache "/entrypoint.sh apac…" 35 seconds ago Up 34 seconds 0.0.0.0:80->80/tcp nextcloud-redis-mariadb_nc_1
6c656f98cf14 redis:alpine "docker-entrypoint.s…" 35 seconds ago Up 34 seconds 6379/tcp nextcloud-redis-mariadb_redis_1
6d4c6630a4a3 mariadb "docker-entrypoint.s…" 35 seconds ago Up 34 seconds 3306/tcp nextcloud-redis-mariadb_db_1
```

Navigate to `http://localhost:80` in your web browser to access the installed
Nextcloud service.

![page](output.jpg)

Stop and remove the containers

```
$ docker-compose down
```

To delete all data, remove all named volumes by passing the `-v` arguments:
```
$ docker-compose down -v
```
45 changes: 45 additions & 0 deletions nextcloud-redis-mariadb/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
version: '3.7'
services:
nc:
image: nextcloud:apache
restart: always
ports:
- 80:80
volumes:
- nc_data:/var/www/html
networks:
- redisnet
- dbnet
environment:
- REDIS_HOST=redis
- MYSQL_HOST=db
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_PASSWORD=nextcloud
redis:
image: redis:alpine
restart: always
networks:
- redisnet
db:
image: mariadb
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: always
volumes:
- db_data:/var/lib/mysql
networks:
- dbnet
environment:
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_ROOT_PASSWORD=nextcloud
- MYSQL_PASSWORD=nextcloud
volumes:
db_data:
nc_data:
networks:
dbnet:
redisnet:



Binary file added nextcloud-redis-mariadb/output.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fb99b4c

Please sign in to comment.