Skip to content

Commit

Permalink
Merge branch 'greg2010-master'
Browse files Browse the repository at this point in the history
Merges any changes  from greg2010-master branch
  • Loading branch information
samoneilll committed Apr 14, 2023
2 parents 6de6baa + 43cd481 commit 6a14acb
Show file tree
Hide file tree
Showing 11 changed files with 136 additions and 50 deletions.
20 changes: 18 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
PROJECT_ROOT=""
CONTAINER_NAME="pf"
DOMAIN=""
# Emails from Let's Encrypt about your certificate will go here
LE_EMAIL=""
APP_PASSWORD=""
MYSQL_HOST="mariadb"
MYSQL_PORT="3306"
MYSQL_USER="root"
MYSQL_PASSWORD=""
MYSQL_PF_DB_NAME="pathfinder"
MYSQL_UNIVERSE_DB_NAME="eve_universe"
MYSQL_CCP_DB_NAME="eve_lifeblood_min"
REDIS_HOST="redis"
REDIS_PORT="6379"
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,esi-search.search_structures.v1"
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"
PATHFINDER_SOCKET_HOST="pathfinder-socket"
PATHFINDER_SOCKET_PORT="5555"
SMTP_HOST=""
SMTP_PORT=""
SMTP_SCHEME=""
SMTP_USER=""
SMTP_PASS=""
SMTP_FROM=""
SMTP_ERROR=""
48 changes: 48 additions & 0 deletions .github/workflows/publish-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Create and publish a Docker image

on:
release:
types: [published]

env:
REGISTRY: ghcr.io
IMAGE_NAME_OWNER: ${{ github.repository_owner }}

jobs:
build-and-publish:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- dockerfile: ./pathfinder.Dockerfile
image_name: pathfinder
- dockerfile: ./pf-websocket.Dockerfile
image_name: pf-websocket
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_OWNER }}/${{ matrix.image_name }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,31 @@ A fork of techfreak's [Pathfinder-container](https://gitlab.com/techfreak/pathfi

1. **Create a *.env* file (copy .env.example) and make sure every config option has an entry.**
```shell
PROJECT_ROOT="" # The path of the cloned repo
PROJECT_ROOT="" # The path of the cloned repo
CONTAINER_NAME="pf" # docker container name prefix
DOMAIN="" # The domain you will be using
APP_PASSWORD="" # Password for /setup
MYSQL_PASSWORD="" # Mysql Password
MYSQL_HOST="mariadb" # mysql host
MYSQL_PORT="3306" # default mysql port
MYSQL_USER="root" # mysql root user
MYSQL_PASSWORD="" # mysql Password
CCP_SSO_CLIENT_ID="" # Use the SSO tokens created in step 1
CCP_SSO_SECRET_KEY=""
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 pathfinder table name
MYSQL_UNIVERSE_DB_NAME="eve_universe"
MYSQL_CCP_DB_NAME="eve_lifeblood_min"
REDIS_HOST="redis" # redis host
REDIS_PORT="6379" # default redis port
PATHFINDER_SOCKET_HOST="pathfinder-socket" # domain of the websocket container, relative to the main pf container
PATHFINDER_SOCKET_PORT="5555" # default tcp socket port
SMTP_HOST=""
SMTP_PORT=""
SMTP_SCHEME=""
SMTP_USER=""
SMTP_PASS=""
SMTP_FROM=""
SMTP_ERROR=""
> The `PROJECT_ROOT` key is the *absolute* path to the project directory, ie if you have clone it to /app/pathfinder-containers, this is the value you should enter. If you're unsure of the absolute path, you can use the command `pwd` to get the full absolute path of the current directory.
1. **Edit the *config/pathfinder/pathfinder.ini*** to your liking
Expand Down
2 changes: 1 addition & 1 deletion config/pathfinder/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ SEED = {{ md5(@SERVER.SERVER_NAME) }}
; - Cache data is stored on disc
; redis=[SERVER]
; - Cache data is stored in Redis. redis=[host]:[port]:[db]:[auth] (e.g. redis=localhost:6379:1:myPass)
CACHE = redis=${CONTAINER_NAME}-redis:6379
CACHE = redis=${REDIS_HOST}:${REDIS_PORT}

; Cache backend for API data
; This sets the cache backend for API response data and other temp data relates to API requests.
Expand Down
23 changes: 10 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,43 @@ 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:
- redis_data:/data
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"]
build:
context: '.'
dockerfile: '$PROJECT_ROOT/pf-websocket.Dockerfile'
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: '.'
build:
context: '.'
dockerfile: '$PROJECT_ROOT//pathfinder.Dockerfile'
env_file:
- .env
labels:
Expand Down
10 changes: 6 additions & 4 deletions Dockerfile → pathfinder.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ 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
$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
Expand Down Expand Up @@ -39,7 +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
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

Expand Down
7 changes: 7 additions & 0 deletions pf-websocket.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM composer:2.3.10
COPY websocket /app
WORKDIR /app

RUN composer install

ENTRYPOINT ["/usr/local/bin/php", "cmd.php"]
2 changes: 1 addition & 1 deletion static/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e
crontab /var/crontab.txt
envsubst '$DOMAIN' </etc/nginx/templateSite.conf >/etc/nginx/sites_enabled/site.conf
envsubst '$CONTAINER_NAME' </etc/nginx/templateNginx.conf >/etc/nginx/nginx.conf
envsubst '$PATHFINDER_SOCKET_HOST' </etc/nginx/templateNginx.conf >/etc/nginx/nginx.conf
envsubst </var/www/html/pathfinder/app/templateEnvironment.ini >/var/www/html/pathfinder/app/environment.ini
envsubst </var/www/html/pathfinder/app/templateConfig.ini >/var/www/html/pathfinder/app/config.ini
envsubst </etc/zzz_custom.ini >/etc/php7/conf.d/zzz_custom.ini
Expand Down
6 changes: 3 additions & 3 deletions static/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ http {
}

upstream websocket {
server ${CONTAINER_NAME}-socket:8020;
server ${PATHFINDER_SOCKET_HOST}:8020;
}




# Default log file
Expand Down Expand Up @@ -235,7 +235,7 @@ http {
# a specific directory, or on an individual server{} level.
gzip_static off;

proxy_buffers 16 16k;
proxy_buffers 16 16k;
proxy_buffer_size 16k;

# Include files in the sites-enabled folder. server{} configuration files should be
Expand Down
42 changes: 21 additions & 21 deletions static/pathfinder/environment.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ URL = {{@SCHEME}}://$DOMAIN
; level of debug/error stack trace
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
Expand All @@ -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 = [email protected]
SMTP_ERROR = [email protected]
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
2 changes: 1 addition & 1 deletion static/php/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fastcgi.impersonate=1
fastcgi.logging=0
request_terminate_timeout = 300
session.save_handler = redis
session.save_path = "tcp://${CONTAINER_NAME}-redis:6379"
session.save_path = "tcp://${REDIS_HOST}:${REDIS_PORT}"
[Date]
date.timezone="UTC"

0 comments on commit 6a14acb

Please sign in to comment.