diff --git a/Dockerfile b/Dockerfile index dc27a2f..3a061d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM php:7.2.11-fpm-alpine3.7 as build +FROM php:7.2.5-fpm-alpine3.7 as build RUN apk update \ && apk add --no-cache libpng-dev zeromq-dev git \ @@ -25,6 +25,12 @@ COPY static/nginx/site.conf /etc/nginx/templateSite.conf # Configure PHP-FPM COPY static/php/fpm-pool.conf /etc/php7/php-fpm.d/zzz_custom.conf +# DEBUG +RUN apk add php7-xdebug --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ +COPY static/php/xdebug.ini /etc/php7/conf.d/xdebug.ini +COPY static/php/error_reporting.ini /etc/php7/conf.d/error_reporting.ini +RUN echo "zend_extension=/usr/lib/php7/modules/xdebug.so" >> /etc/php7/php.ini + COPY static/php/php.ini /etc/zzz_custom.ini # configure cron COPY static/crontab.txt /var/crontab.txt @@ -35,6 +41,7 @@ COPY static/entrypoint.sh / WORKDIR /var/www/html COPY --chown=nobody --from=build /app pathfinder + RUN chmod 0766 pathfinder/logs pathfinder/tmp/ && rm index.php && touch /etc/nginx/.setup_pass && chmod +x /entrypoint.sh COPY static/pathfinder/routes.ini /var/www/html/pathfinder/app/ COPY static/pathfinder/environment.ini /var/www/html/pathfinder/app/templateEnvironment.ini diff --git a/development/development.sh b/development/development.sh index 6aad8f7..14a327f 100755 --- a/development/development.sh +++ b/development/development.sh @@ -16,7 +16,15 @@ cp ./development/xdebug.ini ./static/php/xdebug.ini # set up launch file for vscode mkdir -p .vscode && cp ./development/launch.json ./.vscode/launch.json -# seed .env file with dev presets -echo "PROJECT_ROOT=\"$(pwd)\"" > ./.env -cat ./development/.env.development >> ./.env -echo "Remember to set your CCP SSO Client and Secret keys" +# seed .env unless --noenv flag is set +while true; do + case "$1" in + --noenv ) NO_ENV=true; shift ;; + * ) break ;; + esac +done +if [ ! "$NO_ENV" == "true" ]; then + echo "PROJECT_ROOT=\"$(pwd)\"" > ./.env + cat ./development/.env.development >> ./.env + echo "WARNING: .env has been replaced, remember to fill any required variables" +fi diff --git a/docker-compose.yml b/docker-compose.yml index 9b8245b..c0b3710 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -55,8 +55,7 @@ services: - "traefik.http.routers.pf.entrypoints=web" - "traefik.http.routers.pf-secure.rule=Host(`${DOMAIN}`)" - "traefik.http.routers.pf-secure.entrypoints=websecure" - - "traefik.http.routers.pf-secure.tls=true" - - "traefik.http.routers.pf-secure.tls.certresolver=letsencrypt" + - "traefik.http.routers.pf-secure.tls=true" - "traefik.http.middlewares.redirecthttps.redirectscheme.scheme=https" - "traefik.http.routers.pf.middlewares=redirecthttps" networks: @@ -84,19 +83,12 @@ services: - "--providers.docker.exposedbydefault=false" - "--entrypoints.web.address=:80" - "--entrypoints.websecure.address=:443" - - "--certificatesresolvers.letsencrypt.acme.httpchallenge=true" - - "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web" - - "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json" - # Remove below line when ready for production - - "--certificatesresolvers.letsencrypt.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory" - - "--certificatesresolvers.letsencrypt.acme.email=MYEMAIL@someemailprobablygmail.com" ports: - "80:80" - "443:443" - "8080:8080" volumes: - "/var/run/docker.sock:/var/run/docker.sock:ro" - - "${PROJECT_ROOT}/letsencrypt:/letsencrypt" networks: - web restart: always diff --git a/static/pathfinder/environment.ini b/static/pathfinder/environment.ini index 64628f6..c65ced1 100644 --- a/static/pathfinder/environment.ini +++ b/static/pathfinder/environment.ini @@ -4,16 +4,16 @@ ; project environment (DEVELOP || PRODUCTION). ; This effects: DB connection, Mail-Server, SSO, ESI configurations in this file ; configuration below -SERVER = PRODUCTION +SERVER = DEVELOPMENT -[ENVIRONMENT.PRODUCTION] +[ENVIRONMENT.DEVELOPMENT] ; path to index.php (Default: leave blank == "auto-detect") ; -> e.g. set /pathfinder if your URL looks like https://www.[YOUR_DOMAIN]/pathfinder (subfolder) BASE = ; deployment URL (e.g. https://www.pathfinder-w.space) URL = {{@SCHEME}}://$DOMAIN ; level of debug/error stack trace -DEBUG = 0 +DEBUG = 3 ; Pathfinder database DB_PF_DNS = mysql:host=${CONTAINER_NAME}db;port=3306;dbname= DB_PF_NAME = pf diff --git a/static/php/php.ini b/static/php/php.ini index 0b403a3..5919688 100755 --- a/static/php/php.ini +++ b/static/php/php.ini @@ -10,6 +10,7 @@ fastcgi.logging=0 request_terminate_timeout = 300 session.save_handler = redis session.save_path = "tcp://${CONTAINER_NAME}-redis:6379" +zend_extension=/usr/lib/php7/modules/xdebug.so [Date] date.timezone="UTC"