From 6c3c6bc5ddac5612fcdef7d16693e587b335faa1 Mon Sep 17 00:00:00 2001 From: Sam ONeill Date: Sat, 15 Apr 2023 22:22:39 +1200 Subject: [PATCH] Updates static and development files for .env and dockerfile changes --- .gitignore | 2 +- config/pathfinder/config.ini | 2 +- development/.env.development | 28 ++++++++--- development/Dockerfile.development | 56 ---------------------- development/development.sh | 4 +- development/docker-compose.development.yml | 26 ++++------ development/environment.development.ini | 48 +++++++++---------- docker-compose.yml | 21 ++++---- static/pathfinder/environment.ini | 2 +- 9 files changed, 68 insertions(+), 121 deletions(-) delete mode 100644 development/Dockerfile.development diff --git a/.gitignore b/.gitignore index 48ec249..5c1ce64 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -.env +.env* .vscode letsencrypt *.production* diff --git a/config/pathfinder/config.ini b/config/pathfinder/config.ini index 3c11fcf..45e6dd2 100644 --- a/config/pathfinder/config.ini +++ b/config/pathfinder/config.ini @@ -1,7 +1,7 @@ ; Global Framework Config [SERVER] -SERVER_NAME = PATHFINDER COMMUNITY EDITION +SERVER_NAME = ${SERVER_NAME} [globals] ; Verbosity level of error stack trace for errors diff --git a/development/.env.development b/development/.env.development index 8699b57..78804ee 100644 --- a/development/.env.development +++ b/development/.env.development @@ -1,9 +1,25 @@ -CONTAINER_NAME="pfdev" -DOMAIN="localhost" -SERVER_NAME="PFDEV" APP_PASSWORD="DEVPASSWORD" +CCP_ESI_SCOPES="esi-location.read_online.v1,esi-location.read_location.v1,esi-location.read_ship_type.v1,esi-ui.write_waypoint.v1,esi-ui.open_window.v1,esi-universe.read_structures.v1,esi-corporations.read_corporation_membership.v1,esi-clones.read_clones.v1,esi-characters.read_corporation_roles.v1,esi-search.search_structures.v1"LE_EMAIL="" +CCP_SSO_CLIENT_ID="bebbf51a1bbc4189b07f4fd7ba10a9b9" +CCP_SSO_SECRET_KEY="NZDMwbVMHOD3dZdhPIFtQq8wHVZDouEK60I6IXau" +DOMAIN="localhost" +MYSQL_CCP_DB_NAME="eve_lifeblood_min" +MYSQL_HOST="mariadb" MYSQL_PASSWORD="PASSWORD" -CCP_SSO_CLIENT_ID="" -CCP_SSO_SECRET_KEY="" -CCP_ESI_SCOPES="esi-location.read_online.v1,esi-location.read_location.v1,esi-location.read_ship_type.v1,esi-ui.write_waypoint.v1,esi-ui.open_window.v1,esi-universe.read_structures.v1,esi-corporations.read_corporation_membership.v1,esi-clones.read_clones.v1,esi-characters.read_corporation_roles.v1" +MYSQL_PF_DB_NAME="pathfinder" +MYSQL_PORT="3306" +MYSQL_UNIVERSE_DB_NAME="eve_universe" +MYSQL_USER="root" +PATHFINDER_SOCKET_HOST="pathfinder-socket" +PATHFINDER_SOCKET_PORT="5555" +REDIS_HOST="redis" +REDIS_PORT="6379" +SERVER_NAME="PFDEV" +SMTP_ERROR="" +SMTP_FROM="" +SMTP_HOST="" +SMTP_PASS="" +SMTP_PORT="" +SMTP_SCHEME="" +SMTP_USER="" XDEBUG_CONFIG="remote_host=host.docker.internal remote_port=9000 remote_enable=1" diff --git a/development/Dockerfile.development b/development/Dockerfile.development deleted file mode 100644 index 06f931a..0000000 --- a/development/Dockerfile.development +++ /dev/null @@ -1,56 +0,0 @@ -FROM php:7.2.11-fpm-alpine3.7 as build - -RUN apk update \ - && apk add --no-cache libpng-dev zeromq-dev git \ - $PHPIZE_DEPS \ - && docker-php-ext-install gd && docker-php-ext-install pdo_mysql && pecl install redis && docker-php-ext-enable redis && pecl install channel://pecl.php.net/zmq-1.1.3 && docker-php-ext-enable zmq \ - && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - -COPY pathfinder /app -WORKDIR /app - -RUN composer self-update 2.1.8 -RUN composer install - -FROM trafex/alpine-nginx-php7:ba1dd422 - -RUN apk update && apk add --no-cache busybox-suid sudo php7-redis php7-pdo php7-pdo_mysql php7-fileinfo shadow gettext bash apache2-utils logrotate - -# symlink nginx logs to stdout/stderr for supervisord -RUN ln -sf /dev/stdout /var/log/nginx/access.log \ - && ln -sf /dev/stderr /var/log/nginx/error.log - -COPY static/logrotate/pathfinder /etc/logrotate.d/pathfinder -COPY static/nginx/nginx.conf /etc/nginx/templateNginx.conf -# we need to create sites_enabled directory in order for entrypoint.sh being able to copy file after envsubst -RUN mkdir -p /etc/nginx/sites_enabled/ -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 -# Configure supervisord -COPY static/supervisord.conf /etc/supervisor/conf.d/supervisord.conf -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 - -WORKDIR /var/www/html -EXPOSE 80 - -ENTRYPOINT ["/entrypoint.sh"] -CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] diff --git a/development/development.sh b/development/development.sh index 14a327f..894ad48 100755 --- a/development/development.sh +++ b/development/development.sh @@ -2,13 +2,13 @@ # preserve original production files mv ./docker-compose.yml ./docker-compose.production.yml -mv ./Dockerfile ./Dockerfile.production +mv ./pathfinder.Dockerfile ./pathfinder.Dockerfile.production mv ./static/pathfinder/environment.ini ./static/pathfinder/environment.production.ini mv ./static/php/php.ini ./static/php/php.production.ini # copy development versions cp ./development/docker-compose.development.yml ./docker-compose.yml -cp ./development/Dockerfile.development ./Dockerfile +cp ./development/pathfinder.Dockerfile.developm ./pathfinder.Dockerfile cp ./development/environment.development.ini ./static/pathfinder/environment.ini cp ./development/php.development.ini ./static/php/php.ini cp ./development/xdebug.ini ./static/php/xdebug.ini diff --git a/development/docker-compose.development.yml b/development/docker-compose.development.yml index 128bea9..1d10f58 100644 --- a/development/docker-compose.development.yml +++ b/development/docker-compose.development.yml @@ -5,18 +5,16 @@ services: image: bianjp/mariadb-alpine:latest environment: MYSQL_ROOT_PASSWORD: $MYSQL_PASSWORD - container_name: "$CONTAINER_NAME-db" networks: pf: aliases: - - "${CONTAINER_NAME}db" + - "$MYSQL_HOST" volumes: - db_data:/var/lib/mysql - $PROJECT_ROOT/pathfinder/export/sql/eve_universe.sql.zip:/eve_universe.sql.zip restart: always pf-redis: image: redis:6.2.5-alpine3.14 - container_name: "$CONTAINER_NAME-redis" command: ["redis-server", "--appendonly", "yes"] hostname: redis volumes: @@ -24,25 +22,20 @@ services: networks: pf: aliases: - - "$CONTAINER_NAME-redis" + - "$REDIS_HOST" logging: driver: none restart: always pf-socket: - image: composer:composer@sha256:d374b2e1f715621e9d9929575d6b35b11cf4a6dc237d4a08f2e6d1611f534675 - container_name: "$CONTAINER_NAME-socket" - command: ["sh","-c","composer install && php cmd.php --tcpHost 0.0.0.0"] + image: ghcr.io/goryn-clade/pf-websocket:latest + command: ["--tcpHost", "0.0.0.0"] hostname: socket - volumes: - - ${PROJECT_ROOT}/websocket:/app - - ${PROJECT_ROOT}/logs:/var/www/html/pathfinder/history/map networks: pf: aliases: - - "$CONTAINER_NAME-socket" + - "$PATHFINDER_SOCKET_HOST" restart: always pf: - container_name: ${CONTAINER_NAME} hostname: "pathfinder" build: '.' env_file: @@ -64,10 +57,10 @@ services: healthcheck: disable: true volumes: - - ${PROJECT_ROOT}/config/pathfinder/config.ini:/var/www/html/pathfinder/app/templateConfig.ini - - ${PROJECT_ROOT}/config/pathfinder/pathfinder.ini:/var/www/html/pathfinder/app/pathfinder.ini - - ${PROJECT_ROOT}/config/pathfinder/plugin.ini:/var/www/html/pathfinder/app/plugin.ini - - ${PROJECT_ROOT}/logs:/var/www/html/pathfinder/history/map + - ./config/pathfinder/config.ini:/var/www/html/pathfinder/app/templateConfig.ini + - ./config/pathfinder/pathfinder.ini:/var/www/html/pathfinder/app/pathfinder.ini + - ./config/pathfinder/plugin.ini:/var/www/html/pathfinder/app/plugin.ini + - ./logs:/var/www/html/pathfinder/history/map depends_on: - pfdb - pf-redis @@ -100,4 +93,3 @@ volumes: networks: pf: web: - external: true diff --git a/development/environment.development.ini b/development/environment.development.ini index c65ced1..9797d31 100644 --- a/development/environment.development.ini +++ b/development/environment.development.ini @@ -4,34 +4,34 @@ ; project environment (DEVELOP || PRODUCTION). ; This effects: DB connection, Mail-Server, SSO, ESI configurations in this file ; configuration below -SERVER = DEVELOPMENT +SERVER = DEVELOP -[ENVIRONMENT.DEVELOPMENT] +[ENVIRONMENT.PRODUCTION] ; 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 = 3 +DEBUG = 0 ; Pathfinder database -DB_PF_DNS = mysql:host=${CONTAINER_NAME}db;port=3306;dbname= -DB_PF_NAME = pf -DB_PF_USER = root +DB_PF_DNS = mysql:host=${MYSQL_HOST};port=${MYSQL_PORT};dbname= +DB_PF_NAME = $MYSQL_PF_DB_NAME +DB_PF_USER = $MYSQL_USER DB_PF_PASS = $MYSQL_PASSWORD -; Universe data (New Eden) cache DB for ESI API respons -DB_UNIVERSE_DNS = mysql:host=${CONTAINER_NAME}db;port=3306;dbname= -DB_UNIVERSE_NAME = eve_universe -DB_UNIVERSE_USER = root +; Universe data (New Eden) cache DB for ESI API response +DB_UNIVERSE_DNS = mysql:host=${MYSQL_HOST};port=${MYSQL_PORT};dbname= +DB_UNIVERSE_NAME = $MYSQL_UNIVERSE_DB_NAME +DB_UNIVERSE_USER = $MYSQL_USER DB_UNIVERSE_PASS = $MYSQL_PASSWORD ; EVE-Online CCP Database export -DB_CCP_DNS = mysql:host=${CONTAINER_NAME}db;port=3306;dbname= -DB_CCP_NAME = eve_lifeblood_min -DB_CCP_USER = root -DB_CCP_PASS = $MYSQL_PASSWORD +DB_CCP_DNS = mysql:host=${MYSQL_HOST};port=${MYSQL_PORT};dbname= +DB_CCP_NAME = $MYSQL_CCP_DB_NAME +DB_CCP_USER = $MYSQL_USER +DB_CCP_PASS = $MYSQL_PASSWORD ; CCP SSO CCP_SSO_URL = https://login.eveonline.com @@ -43,19 +43,19 @@ CCP_SSO_DOWNTIME = 11:00 ; CCP ESI API CCP_ESI_URL = https://esi.evetech.net CCP_ESI_DATASOURCE = tranquility -CCP_ESI_SCOPES = $CCP_ESI_SCOPES +CCP_ESI_SCOPES = $CCP_ESI_SCOPES CCP_ESI_SCOPES_ADMIN = ; SMTP settings (optional) -SMTP_HOST = localhost -SMTP_PORT = 25 -SMTP_SCHEME = TLS -SMTP_USER = -SMTP_PASS = +SMTP_HOST = $SMTP_HOST +SMTP_PORT = $SMTP_PORT +SMTP_SCHEME = $SMTP_SCHEME +SMTP_USER = $SMTP_USER +SMTP_PASS = $SMTP_PASS -SMTP_FROM = registration@pathfinder-w.space -SMTP_ERROR = admin@pathfinder-w.space +SMTP_FROM = $SMTP_FROM +SMTP_ERROR = $SMTP_EMAIL ; TCP Socket configuration (optional) (advanced) -SOCKET_HOST = ${CONTAINER_NAME}-socket -SOCKET_PORT = 5555 +SOCKET_HOST = $PATHFINDER_SOCKET_HOST +SOCKET_PORT = $PATHFINDER_SOCKET_PORT diff --git a/docker-compose.yml b/docker-compose.yml index 63e4159..60b40a6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,7 +11,7 @@ services: - "$MYSQL_HOST" volumes: - db_data:/var/lib/mysql - - $PROJECT_ROOT/pathfinder/export/sql/eve_universe.sql.zip:/eve_universe.sql.zip + - ./pathfinder/export/sql/eve_universe.sql.zip:/eve_universe.sql.zip restart: always pf-redis: image: redis:6.2.5-alpine3.14 @@ -27,9 +27,7 @@ services: driver: none restart: always pf-socket: - build: - context: '.' - dockerfile: '$PROJECT_ROOT/pf-websocket.Dockerfile' + image: ghcr.io/goryn-clade/pf-websocket:latest command: ["--tcpHost", "0.0.0.0"] hostname: socket networks: @@ -39,9 +37,7 @@ services: restart: always pf: hostname: "pathfinder" - build: - context: '.' - dockerfile: '$PROJECT_ROOT//pathfinder.Dockerfile' + image: ghcr.io/goryn-clade/pathfinder:latest env_file: - .env labels: @@ -62,10 +58,10 @@ services: healthcheck: disable: true volumes: - - ${PROJECT_ROOT}/config/pathfinder/config.ini:/var/www/html/pathfinder/app/templateConfig.ini - - ${PROJECT_ROOT}/config/pathfinder/pathfinder.ini:/var/www/html/pathfinder/app/pathfinder.ini - - ${PROJECT_ROOT}/config/pathfinder/plugin.ini:/var/www/html/pathfinder/app/plugin.ini - - ${PROJECT_ROOT}/logs:/var/www/html/pathfinder/history/map + - ./config/pathfinder/config.ini:/var/www/html/pathfinder/app/templateConfig.ini + - ./config/pathfinder/pathfinder.ini:/var/www/html/pathfinder/app/pathfinder.ini + - ./config/pathfinder/plugin.ini:/var/www/html/pathfinder/app/plugin.ini + - ./logs:/var/www/html/pathfinder/history/map depends_on: - pfdb - pf-redis @@ -93,7 +89,7 @@ services: - "8080:8080" volumes: - "/var/run/docker.sock:/var/run/docker.sock:ro" - - "${PROJECT_ROOT}/letsencrypt:/letsencrypt" + - "./letsencrypt:/letsencrypt" networks: - web restart: always @@ -105,4 +101,3 @@ volumes: networks: pf: web: - external: true diff --git a/static/pathfinder/environment.ini b/static/pathfinder/environment.ini index 5f4a967..19c2a1f 100644 --- a/static/pathfinder/environment.ini +++ b/static/pathfinder/environment.ini @@ -28,7 +28,7 @@ DB_UNIVERSE_PASS = $MYSQL_PASSWORD ; EVE-Online CCP Database export -DB_CCP_DNS = mysql:host=${MYSQL_HOST};port=${MYSQL_PORT};dbname= +DB_CCP_DNS = mysql:host=${MYSQL_HOST};port=${MYSQL_PORT};dbname= DB_CCP_NAME = $MYSQL_CCP_DB_NAME DB_CCP_USER = $MYSQL_USER DB_CCP_PASS = $MYSQL_PASSWORD