merge from feat docker refactor
commit1c7f70e579Author: Sébastien STOLZ <sebastien@e-declic.com> Date: Thu Dec 21 23:01:16 2017 +0100 change mysql container name commit622f42e9b9Author: Sébastien STOLZ <sebastien@e-declic.com> Date: Thu Dec 21 22:57:42 2017 +0100 port conf modification commit186d94a7ecAuthor: Sébastien STOLZ <sebastien@e-declic.com> Date: Tue Dec 19 17:27:38 2017 +0100 Increase Makefile readability commitb7a01bbeb3Author: Sébastien STOLZ <sebastien@e-declic.com> Date: Tue Dec 19 17:27:21 2017 +0100 Change backup/restore filename strategy commit6ffa535de0Author: Sébastien STOLZ <sebastien@e-declic.com> Date: Tue Dec 19 16:33:48 2017 +0100 refactor
This commit is contained in:
+5
-4
@@ -1,5 +1,6 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
*.log
|
|
||||||
*~
|
/conf/env/*.env
|
||||||
volume/*
|
/volume/*
|
||||||
conf/docker-compose.override.yml
|
!/volume/www
|
||||||
|
/volume/www/**/conf/nginx.conf
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
|
||||||
|
CLIENT=tt-nextcloud
|
||||||
|
|
||||||
|
DOCKERCOMPOSE := $(shell command -v docker-compose 2> /dev/null)
|
||||||
|
USAGE := Usage: make ENV={prod|preprod|dev} {docker-build|docker-start|docker-stop|docker-restart}
|
||||||
|
|
||||||
|
ifndef DOCKERCOMPOSE
|
||||||
|
$(error docker-compose is not available)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef ENV
|
||||||
|
$(info Environment variable is not set)
|
||||||
|
$(info $(USAGE))
|
||||||
|
$(error Exiting)
|
||||||
|
endif
|
||||||
|
|
||||||
|
DC_OVERRIDE := $(shell test -e conf/docker-compose.override.yml && echo "--file conf/docker-compose.override.yml")
|
||||||
|
DC_OVERRIDE_ENV := $(shell test -e conf/docker-compose.$(ENV).yml && echo "--file conf/docker-compose.$(ENV).yml")
|
||||||
|
|
||||||
|
DC=ENV=$(ENV) CLIENT=$(CLIENT) $(DOCKERCOMPOSE) --project-name "$(CLIENT)_$(ENV)" --file conf/docker-compose.yml $(DC_OVERRIDE) $(DC_OVERRIDE_ENV)
|
||||||
|
|
||||||
|
default:
|
||||||
|
$(info $(USAGE))
|
||||||
|
$(error Exiting)
|
||||||
|
|
||||||
|
docker-build:
|
||||||
|
$(DC) build
|
||||||
|
$(DC) up -d
|
||||||
|
|
||||||
|
docker-start:
|
||||||
|
$(DC) start
|
||||||
|
|
||||||
|
docker-stop:
|
||||||
|
$(DC) stop
|
||||||
|
|
||||||
|
docker-restart: docker-stop docker-start
|
||||||
|
|
||||||
|
docker-rm: docker-stop
|
||||||
|
$(DC) rm
|
||||||
|
|
||||||
|
config:
|
||||||
|
@echo "Configuring docker for environment '$(ENV)'"
|
||||||
|
|
||||||
|
@echo " --> Generating mysql auth file"
|
||||||
|
@cat conf/env/mysql.env \
|
||||||
|
| python -c "import sys; import string; v=sys.stdin.readline().split('MYSQL_ROOT_PASSWORD=')[1]; print(string.Template(open('conf/build/mysql/my.cnf').read()).substitute({'PASSWORD':v}))" \
|
||||||
|
| docker exec -i $(CLIENT).mysql.$(ENV) sh -c 'cat > /root/.my.cnf'
|
||||||
|
|
||||||
|
db-backup:
|
||||||
|
@echo "Backing up database"
|
||||||
|
@mkdir -p backup/
|
||||||
|
@docker exec --tty --interactive $(CLIENT).mysql.$(ENV) mysqldump -uroot database > backup/mysql_dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
|
||||||
|
|
||||||
|
db-restore:
|
||||||
|
@echo "Restoring file to database (backup/mysql.sql)"
|
||||||
|
@docker exec -i $(CLIENT).mysql.$(ENV) mysql -uroot database < backup/mysql.sql
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
FROM mysql:5.7
|
||||||
|
|
||||||
|
ENV TERM=xterm
|
||||||
|
#ENV http_proxy 'http://192.168.64.1:8080/'
|
||||||
|
|
||||||
|
RUN apt-get clean \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y lsof mlocate nano less
|
||||||
|
|
||||||
|
COPY mysql.cnf /etc/mysql/conf.d/
|
||||||
|
|
||||||
|
RUN apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/ \
|
||||||
|
&& updatedb
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
[client]
|
||||||
|
password=$PASSWORD
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
[mysqld]
|
||||||
|
|
||||||
|
innodb_file_per_table = true
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
nextcloud:
|
||||||
|
ports:
|
||||||
|
- "8888:8888"
|
||||||
|
restart: "no"
|
||||||
|
|
||||||
|
mysql:
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
|
restart: "no"
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
nextcloud:
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- frontnginx_front
|
||||||
|
|
||||||
|
networks:
|
||||||
|
default:
|
||||||
|
driver: bridge
|
||||||
|
frontnginx_front:
|
||||||
|
external: true
|
||||||
+15
-34
@@ -1,43 +1,24 @@
|
|||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
# https://hub.docker.com/r/wonderfall/nextcloud/
|
# https://hub.docker.com/r/wonderfall/nextcloud/
|
||||||
tt.nc:
|
nextcloud:
|
||||||
image: wonderfall/nextcloud:12.0
|
image: wonderfall/nextcloud:12.0
|
||||||
container_name: tt.nc
|
container_name: ${CLIENT}.nextcloud.${ENV}
|
||||||
expose:
|
env_file: env/nextcloud.env
|
||||||
- "8888"
|
|
||||||
links:
|
|
||||||
- "tt.nc_mysql_db"
|
|
||||||
depends_on:
|
|
||||||
- "tt.nc_mysql_db"
|
|
||||||
external_links:
|
|
||||||
- "tt.front"
|
|
||||||
volumes:
|
volumes:
|
||||||
- /home/docker/nextcloud/volume/nextcloud/data:/data
|
- ../volume/nextcloud/data:/data
|
||||||
- /home/docker/nextcloud/volume/nextcloud/config:/config
|
- ../volume/nextcloud/config:/config
|
||||||
- /home/docker/nextcloud/volume/nextcloud/apps2:/apps2
|
- ../volume/nextcloud/apps2:/apps2
|
||||||
- /home/docker/nextcloud/volume/nextcloud/themes:/nextcloud/themes
|
- ../volume/nextcloud/themes:/nextcloud/themes
|
||||||
environment:
|
|
||||||
- UPLOAD_MAX_SIZE=100M
|
|
||||||
- DB_TYPE=mysql
|
|
||||||
- DB_NAME=nextcloud
|
|
||||||
- DB_USER=nextcloud
|
|
||||||
- DB_PASSWORD=*u;8k7W<V6n/(Qa9
|
|
||||||
- DB_HOST=tt.nc_mysql_db
|
|
||||||
- TZ=Europe/Paris
|
|
||||||
- DOMAIN=files.talentstube.io
|
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
# https://hub.docker.com/_/mysql/
|
# https://hub.docker.com/_/mysql/
|
||||||
tt.nc_mysql_db:
|
mysql:
|
||||||
image: mysql:5.7
|
build: build/mysql
|
||||||
container_name: tt.nc_mysql_db
|
container_name: ${CLIENT}.mysql.${ENV}
|
||||||
|
env_file: env/mysql.env
|
||||||
volumes:
|
volumes:
|
||||||
- "/home/docker/nextcloud/volume/mysql_db/data:/var/lib/mysql"
|
- "../volume/mysql/var.lib.mysql:/var/lib/mysql"
|
||||||
environment:
|
restart: always
|
||||||
- MYSQL_RANDOM_ROOT_PASSWORD="yes"
|
|
||||||
- MYSQL_DATABASE=nextcloud
|
|
||||||
- MYSQL_USER=nextcloud
|
|
||||||
- MYSQL_PASSWORD=*u;8k7W<V6n/(Qa9
|
|
||||||
restart: always
|
|
||||||
|
|||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
MYSQL_ROOT_PASSWORD=
|
||||||
|
MYSQL_DATABASE=database
|
||||||
|
MYSQL_USER=user
|
||||||
|
MYSQL_PASSWORD=
|
||||||
Vendored
+8
@@ -0,0 +1,8 @@
|
|||||||
|
UPLOAD_MAX_SIZE=
|
||||||
|
DB_TYPE=
|
||||||
|
DB_NAME=
|
||||||
|
DB_USER=
|
||||||
|
DB_PASSWORD=
|
||||||
|
DB_HOST=
|
||||||
|
TZ=
|
||||||
|
DOMAIN=
|
||||||
Reference in New Issue
Block a user