diff --git a/.env.default b/.env.default index 766ce09fe..3e2131e00 100644 --- a/.env.default +++ b/.env.default @@ -7,6 +7,7 @@ SITE_NAME=Site name SITE_MAIL=admin@example.com PROJECT_INSTALL= PHP_VERSION=7 -IMAGE_PHP=skilldlabs/php:71-fpm +IMAGE_PHP=skilldlabs/php:72-fpm IMAGE_FRONT=skilldlabs/frontend:zen DB_URL=sqlite:///dev/shm/d8.sqlite +MYSQL_BASE_PATH=/dev/shm diff --git a/Makefile b/Makefile index f56096d7c..f0243f55c 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ CUID ?= $(LOCAL_UID) CGID ?= $(LOCAL_GID) COMPOSE_NET_NAME := $(COMPOSE_PROJECT_NAME)_front +MYSQL_DATADIR := $(MYSQL_BASE_PATH)/$(COMPOSE_PROJECT_NAME)_mysql php = docker-compose exec -T --user $(CUID):$(CGID) php time ${1} php-0 = docker-compose exec -T php time ${1} @@ -32,10 +33,10 @@ $(error Project name can not be default, please edit ".env" and set COMPOSE_PROJ endif prepare: - mkdir -p /dev/shm/${COMPOSE_PROJECT_NAME}_mysql + mkdir -p $(MYSQL_DATADIR) make -s down make -s up - $(call php-0, apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community git) + $(call php-0, apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community graphicsmagick) $(call php-0, kill -USR2 1) $(call php, composer global require -o --update-no-dev --no-suggest "hirak/prestissimo:^0.3") @@ -131,6 +132,7 @@ down: clean: DIRS := core libraries modules/contrib profiles/contrib sites themes/contrib clean: info down @for i in $(DIRS); do if [ -d "web/$$i" ]; then echo "Removing web/$$i..."; docker run --rm -v $(shell pwd):/mnt $(IMAGE_PHP) sh -c "rm -rf /mnt/web/$$i"; fi; done + @if [ -d $(MYSQL_DATADIR) ]; then echo "Removing mysql data $(MYSQL_DATADIR)..."; docker run --rm -v $(MYSQL_BASE_PATH):/mnt/2rm $(IMAGE_PHP) sh -c "rm -rf /mnt/2rm/$(COMPOSE_PROJECT_NAME)_mysql"; fi net: ifeq ($(shell docker network ls -q -f Name=$(COMPOSE_NET_NAME)),) @@ -140,7 +142,7 @@ ifeq ($(shell grep -c -F 'IPRANGE=' .env), 0) # @echo Define IP range $(net-range) @printf "\nIPRANGE=%s\n" $(shell docker network inspect $(COMPOSE_NET_NAME) --format '{{(index .IPAM.Config 0).Subnet}}') >> .env else - @if [ '$(IPRANGE)' != '$(shell docker network inspect $(COMPOSE_NET_NAME) --format '{{(index .IPAM.Config 0).Subnet}}')' ]; then echo "Replace IP range $(IPRANGE)"; sed -i "s#IPRANGE=.*#IPRANGE=$(shell docker network inspect $(COMPOSE_NET_NAME) --format '{{(index .IPAM.Config 0).Subnet}}')#" .env; fi; +# @if [ '$(IPRANGE)' != '$(shell docker network inspect $(COMPOSE_NET_NAME) --format '{{(index .IPAM.Config 0).Subnet}}')' ]; then echo "Replace IP range $(IPRANGE)"; sed -i "s#IPRANGE=.*#IPRANGE=$(shell docker network inspect $(COMPOSE_NET_NAME) --format '{{(index .IPAM.Config 0).Subnet}}')#" .env; fi; endif # grep -q -F 'IPRANGE=' .env || printf "\nIPRANGE=$(shell docker network inspect $(COMPOSE_NET_NAME) --format '{{(index .IPAM.Config 0).Subnet}}')" >> .env @@ -159,7 +161,7 @@ lint: dev: @echo "Dev tasks..." $(call php, composer install --prefer-dist -o) - $(call php-0, chmod -R 777 web/sites/default) + $(call php-0, chmod +w web/sites/default) $(call php, cp web/sites/default/default.services.yml web/sites/default/services.yml) $(call php, sed -i -e 's/debug: false/debug: true/g' web/sites/default/services.yml) $(call php, cp web/sites/example.settings.local.php web/sites/default/settings.local.php) diff --git a/docker/docker-compose.override.yml.default b/docker/docker-compose.override.yml.default index b8165ffaf..5451b9f2c 100644 --- a/docker/docker-compose.override.yml.default +++ b/docker/docker-compose.override.yml.default @@ -1,4 +1,4 @@ -version: "2" +version: "2.1" services: @@ -16,7 +16,7 @@ services: # volumes: # - ../../mysql:/var/lib/mysql:Z # On for linux machines use ramfs, make sure to create the directory first. -# - /dev/shm/${COMPOSE_PROJECT_NAME}_mysql:/var/lib/mysql:Z +# - ${MYSQL_BASE_PATH}/${COMPOSE_PROJECT_NAME}_mysql:/var/lib/mysql:Z # adminer: # image: dockette/adminer:mysql-php7 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 8d0c332df..f37ceff5c 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,4 +1,4 @@ -version: "2" +version: "2.1" services: @@ -15,14 +15,12 @@ services: - front nginx: - image: skilldlabs/nginx:1.10.1 + image: skilldlabs/nginx:1.14.1 container_name: "${COMPOSE_PROJECT_NAME}_web" depends_on: - php volumes_from: - php - volumes: - - ./drupal8.conf:/etc/nginx/conf.d/drupal8.conf:z restart: always networks: - front diff --git a/docker/drupal8.conf b/docker/drupal8.conf deleted file mode 100644 index 46f461633..000000000 --- a/docker/drupal8.conf +++ /dev/null @@ -1,238 +0,0 @@ -server { - server_name SERVER_NAME; - listen 80; - - root /var/www/html/web; - index index.php; - - fastcgi_keep_conn on; - fastcgi_index index.php; - fastcgi_param QUERY_STRING $query_string; - fastcgi_param SCRIPT_NAME $fastcgi_script_name; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - - location / { - - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - - location ^~ /system/files/ { - include fastcgi_params; - fastcgi_param QUERY_STRING q=$uri&$args; - fastcgi_param SCRIPT_NAME /index.php; - fastcgi_param SCRIPT_FILENAME $document_root/index.php; - fastcgi_hide_header 'X-Drupal-Cache'; - fastcgi_hide_header 'X-Generator'; - fastcgi_pass upstream; - log_not_found off; - } - - location ^~ /sites/.*/files/private/ { - internal; - } - - location ~* /imagecache/ { - access_log off; - expires 30d; - try_files $uri @drupal; - } - - location ~* /files/styles/ { - access_log off; - expires 30d; - try_files $uri @drupal; - } - - location ^~ /sites/.*/files/advagg_css/ { - expires max; - add_header ETag ''; - add_header Last-Modified 'Wed, 20 Jan 1988 04:20:42 GMT'; - add_header Accept-Ranges ''; - location ~* /sites/.*/files/advagg_css/css[_[:alnum:]]+\.css$ { - access_log off; - try_files $uri @drupal; - } - } - - location ^~ /sites/.*/files/advagg_js/ { - expires max; - add_header ETag ''; - add_header Last-Modified 'Wed, 20 Jan 1988 04:20:42 GMT'; - add_header Accept-Ranges ''; - location ~* /sites/.*/files/advagg_js/js[_[:alnum:]]+\.js$ { - access_log off; - try_files $uri @drupal; - } - } - - location ~* /admin/reports/hacked/.+/diff/ { - try_files $uri @drupal; - } - - location ~* ^.+\.(?:cur|jpe?g|gif|htc|ico|png|xml|otf|ttf|eot|woff|woff2|svg)$ { - access_log off; - expires 30d; - tcp_nodelay off; - open_file_cache max=3000 inactive=120s; - open_file_cache_valid 45s; - open_file_cache_min_uses 2; - open_file_cache_errors off; - } - - location ~* ^.+\.(?:css|js)$ { - access_log off; - expires 30d; - tcp_nodelay off; - open_file_cache off; - } - - location ~* ^.+\.(?:pdf|pptx?)$ { - expires 30d; - tcp_nodelay off; - } - - location ~* ^(?:.+\.(?:htaccess|make|txt|engine|inc|info|install|module|profile|po|pot|sh|.*sql|test|theme|tpl(?:\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$ { - return 404; - } - try_files $uri @drupal; - } - - location @drupal { - include fastcgi_params; - fastcgi_param QUERY_STRING $query_string; - fastcgi_param SCRIPT_NAME /index.php; - fastcgi_param SCRIPT_FILENAME $document_root/index.php; - fastcgi_hide_header 'X-Drupal-Cache'; - fastcgi_hide_header 'X-Generator'; - fastcgi_pass upstream; - track_uploads uploads 60s; - } - - location @drupal-no-args { - include fastcgi_params; - fastcgi_param QUERY_STRING q=$uri; - fastcgi_param SCRIPT_NAME /index.php; - fastcgi_param SCRIPT_FILENAME $document_root/index.php; - fastcgi_hide_header 'X-Drupal-Cache'; - fastcgi_hide_header 'X-Generator'; - fastcgi_pass upstream; - } - - location = /index.php { - include fastcgi_params; - fastcgi_param QUERY_STRING $query_string; - fastcgi_param SCRIPT_NAME /index.php; - fastcgi_param SCRIPT_FILENAME $document_root/index.php; - fastcgi_hide_header 'X-Drupal-Cache'; - fastcgi_hide_header 'X-Generator'; - fastcgi_pass upstream; - } - - location = /cron { - include fastcgi_params; - fastcgi_param QUERY_STRING q=$uri&$args; - fastcgi_param SCRIPT_NAME /index.php; - fastcgi_param SCRIPT_FILENAME $document_root/index.php; - fastcgi_hide_header 'X-Drupal-Cache'; - fastcgi_hide_header 'X-Generator'; - fastcgi_pass upstream; - } - - location ~* ^/update.php { - include fastcgi_params; - fastcgi_param QUERY_STRING $args; - fastcgi_param SCRIPT_NAME /update.php; - fastcgi_param SCRIPT_FILENAME $document_root/update.php; - fastcgi_hide_header 'X-Drupal-Cache'; - fastcgi_hide_header 'X-Generator'; - fastcgi_pass upstream; - } - - location = /core/install.php { - include fastcgi_params; - fastcgi_param QUERY_STRING $args; - fastcgi_param SCRIPT_NAME /core/install.php; - fastcgi_param SCRIPT_FILENAME $document_root/core/install.php; - fastcgi_hide_header 'X-Drupal-Cache'; - fastcgi_hide_header 'X-Generator'; - fastcgi_pass upstream; - } - - location ~* ^/core/authorize.php { - include fastcgi_params; - fastcgi_param QUERY_STRING $args; - fastcgi_param SCRIPT_NAME /core/authorize.php; - fastcgi_param SCRIPT_FILENAME $document_root/core/authorize.php; - fastcgi_hide_header 'X-Drupal-Cache'; - fastcgi_hide_header 'X-Generator'; - fastcgi_pass upstream; - } - - location ^~ /.bzr { - return 404; - } - - location ^~ /.git { - return 404; - } - - location ^~ /.hg { - return 404; - } - - location ^~ /.svn { - return 404; - } - - location ^~ /.cvs { - return 404; - } - - location ^~ /patches { - return 404; - } - - location ^~ /backup { - return 404; - } - - location = /robots.txt { - access_log off; - try_files $uri @drupal-no-args; - } - - location = /rss.xml { - try_files $uri @drupal-no-args; - } - - location = /sitemap.xml { - try_files $uri @drupal-no-args; - } - - location = /favicon.ico { - expires 30d; - try_files /favicon.ico @empty; - } - - location ~* ^/.well-known/ { - allow all; - } - - location @empty { - expires 30d; - empty_gif; - } - - location ~* ^.+\.php$ { - return 404; - } - - location ~ (?.*)/x-progress-id:(?\d*) { - rewrite ^ $upload_form_uri?X-Progress-ID=$upload_id; - } - - location ~ ^/progress$ { - upload_progress_json_output; - report_uploads uploads; - } -}