Merge pull request #38 from goryn-clade/logging

Adds volume and static files for logging from socket
This commit is contained in:
Sam 2022-08-28 00:21:16 +02:00 committed by GitHub
commit b16d39a9d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 37 additions and 9 deletions

View file

@ -13,11 +13,14 @@ RUN composer self-update 2.1.8
RUN composer install RUN composer install
FROM trafex/alpine-nginx-php7:ba1dd422 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
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 # symlink nginx logs to stdout/stderr for supervisord
RUN ln -sf /dev/stdout /var/log/nginx/access.log \ RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.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 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 # 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/ RUN mkdir -p /etc/nginx/sites_enabled/

View file

@ -124,7 +124,7 @@ Development configs and docker files can be quickly restored using:
chmod +x ./development/development.sh && ./development/development.sh chmod +x ./development/development.sh && ./development/development.sh
``` ```
This creates a partial `.env` file, but you will need to add your CCP SSO client and keys manually. This creates a partial `.env` file, but you will need to add your CCP SSO client and keys manually, if you want to copy development files without overwriting your .env file add the flag `--noenv` when running the script.
It's best to create a new SSO application for development work, so that you can set the callback url to `https://localhost/sso/callbackAuthorization`. It's best to create a new SSO application for development work, so that you can set the callback url to `https://localhost/sso/callbackAuthorization`.

View file

@ -1,4 +1,4 @@
FROM php:7.2.5-fpm-alpine3.7 as build FROM php:7.2.11-fpm-alpine3.7 as build
RUN apk update \ RUN apk update \
&& apk add --no-cache libpng-dev zeromq-dev git \ && apk add --no-cache libpng-dev zeromq-dev git \
@ -13,8 +13,10 @@ RUN composer self-update 2.1.8
RUN composer install RUN composer install
FROM trafex/alpine-nginx-php7:ba1dd422 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
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
COPY static/logrotate/pathfinder /etc/logrotate.d/pathfinder
COPY static/nginx/nginx.conf /etc/nginx/templateNginx.conf 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 # 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/ RUN mkdir -p /etc/nginx/sites_enabled/
@ -39,7 +41,6 @@ COPY static/entrypoint.sh /
WORKDIR /var/www/html WORKDIR /var/www/html
COPY --chown=nobody --from=build /app pathfinder 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 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/routes.ini /var/www/html/pathfinder/app/
COPY static/pathfinder/environment.ini /var/www/html/pathfinder/app/templateEnvironment.ini COPY static/pathfinder/environment.ini /var/www/html/pathfinder/app/templateEnvironment.ini

View file

@ -16,6 +16,15 @@ cp ./development/xdebug.ini ./static/php/xdebug.ini
# set up launch file for vscode # set up launch file for vscode
mkdir -p .vscode && cp ./development/launch.json ./.vscode/launch.json mkdir -p .vscode && cp ./development/launch.json ./.vscode/launch.json
# seed .env file with dev presets # seed .env unless --noenv flag is set
echo "path=\"$(pwd)\"" > ./.env 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 cat ./development/.env.development >> ./.env
echo "WARNING: .env has been replaced, remember to fill any required variables"
fi

View file

@ -35,6 +35,7 @@ services:
hostname: socket hostname: socket
volumes: volumes:
- ${PROJECT_ROOT}/websocket:/app - ${PROJECT_ROOT}/websocket:/app
- ${PROJECT_ROOT}/logs:/var/www/html/pathfinder/history/map
networks: networks:
pf: pf:
aliases: aliases:
@ -66,6 +67,7 @@ services:
- ${PROJECT_ROOT}/config/pathfinder/config.ini:/var/www/html/pathfinder/app/templateConfig.ini - ${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/pathfinder.ini:/var/www/html/pathfinder/app/pathfinder.ini
- ${PROJECT_ROOT}/config/pathfinder/plugin.ini:/var/www/html/pathfinder/app/plugin.ini - ${PROJECT_ROOT}/config/pathfinder/plugin.ini:/var/www/html/pathfinder/app/plugin.ini
- ${PROJECT_ROOT}/logs:/var/www/html/pathfinder/history/map
depends_on: depends_on:
- pfdb - pfdb
- pf-redis - pf-redis

View file

@ -35,6 +35,7 @@ services:
hostname: socket hostname: socket
volumes: volumes:
- ${PROJECT_ROOT}/websocket:/app - ${PROJECT_ROOT}/websocket:/app
- ${PROJECT_ROOT}/logs:/var/www/html/pathfinder/history/map
networks: networks:
pf: pf:
aliases: aliases:
@ -67,6 +68,7 @@ services:
- ${PROJECT_ROOT}/config/pathfinder/config.ini:/var/www/html/pathfinder/app/templateConfig.ini - ${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/pathfinder.ini:/var/www/html/pathfinder/app/pathfinder.ini
- ${PROJECT_ROOT}/config/pathfinder/plugin.ini:/var/www/html/pathfinder/app/plugin.ini - ${PROJECT_ROOT}/config/pathfinder/plugin.ini:/var/www/html/pathfinder/app/plugin.ini
- ${PROJECT_ROOT}/logs:/var/www/html/pathfinder/history/map
depends_on: depends_on:
- pfdb - pfdb
- pf-redis - pf-redis

4
logs/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View file

@ -0,0 +1,7 @@
/var/www/html/pathfinder/history/map/*.log {
daily
missingok
rotate 14
compress
notifempty
}