Add the wiki
This commit is contained in:
parent
6e13002578
commit
bf27c7b574
|
@ -0,0 +1,6 @@
|
|||
WIKI_EN_SECRET_KEY=
|
||||
WIKI_EN_UPGRADE_KEY=
|
||||
WIKI_FR_SECRET_KEY=
|
||||
WIKI_FR_UPGRADE_KEY=
|
||||
WIKI_DB_PASSWORD=
|
||||
DEBUG=0
|
|
@ -1 +1,2 @@
|
|||
volumes/*
|
||||
.env
|
|
@ -1,24 +1,27 @@
|
|||
[submodule "src/SH4compatibilityTool"]
|
||||
path = src/SH4compatibilityTool
|
||||
url = ../../Ziqumu/SH4compatibilityTool.git
|
||||
url = ../../devs/SH4compatibilityTool.git
|
||||
[submodule "src/G1rFxiTools"]
|
||||
path = src/G1rFxiTools
|
||||
url = ../../Ziqumu/G1rFxiTools.git
|
||||
url = ../../devs/G1rFxiTools.git
|
||||
[submodule "src/EactMaker"]
|
||||
path = src/EactMaker
|
||||
url = ../../Ziqumu/EactMaker.git
|
||||
url = ../../devs/EactMaker.git
|
||||
[submodule "src/FestivAlgo"]
|
||||
path = src/FestivAlgo
|
||||
url = ../../Ziqumu/FestivAlgo.git
|
||||
url = ../../devs/FestivAlgo.git
|
||||
[submodule "src/SpriteCoder"]
|
||||
path = src/SpriteCoder
|
||||
url = ../../Smashmaster/SpriteCoder.git
|
||||
url = ../../devs/SpriteCoder.git
|
||||
[submodule "src/CPluaEditor"]
|
||||
path = src/CPluaEditor
|
||||
url = ../../Ziqumu/CPluaEditor.git
|
||||
url = ../../devs/CPluaEditor.git
|
||||
[submodule "src/HPPrimeNotes"]
|
||||
path = src/HPPrimeNotes
|
||||
url = ../../Ziqumu/HPPrimeNotes.git
|
||||
url = ../../devs/HPPrimeNotes.git
|
||||
[submodule "src/PRGM2FUNC"]
|
||||
path = src/PRGM2FUNC
|
||||
url = ../../Ziqumu/PRGM2FUNC.git
|
||||
url = ../../devs/PRGM2FUNC.git
|
||||
[submodule "src/pcgenerator"]
|
||||
path = src/pcgenerator
|
||||
url = ../../devs/pcgenerator.git
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
# Tools compose
|
||||
Docker compose sources to start planete-casio's wiki and tools
|
||||
|
||||
|
||||
## Deployment
|
||||
|
||||
Firt install the last version of [docker](https://docs.docker.com/install/) and [docker-compose](https://docs.docker.com/compose/install/) on the server.
|
||||
|
||||
|
||||
### Clone the repo
|
||||
|
||||
Then clone this repository onto the server, cd into it and pull submodules
|
||||
|
||||
```
|
||||
# Put this somewhere only root can access, you weel need to keep this directory for production
|
||||
sudo su
|
||||
cd /srv/
|
||||
git clone https://gitea.planet-casio.com/devs/tools-compose
|
||||
cd tools-compose
|
||||
|
||||
# Enable git credential cache because there is multiple submodules that need your password multiple times
|
||||
git config --global credential.helper cache
|
||||
|
||||
# Now init an pull submodules
|
||||
git submodule init
|
||||
git submodule update
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
The docker-compose configuration is stored into a `.env` file at the root of the repository. You need to copy the `.env.example` file into `.env` and fill it with a valid configuration.
|
||||
|
||||
```
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
TODO configuration description
|
||||
|
||||
### Start the server for the first time
|
||||
|
||||
We will now use the `docker-compose` utility. To make it work you have to `cd` at the root of this repository.
|
||||
|
||||
```
|
||||
docker-compose up --build
|
||||
# Always keep the --build part, it will avoid you cache trouble if you play with the configuration of docker-compose
|
||||
```
|
||||
|
||||
You should see everything starting, if something wrong in logs, just to a `Ctrl+C`, fix it and try again. You might also need to clean the `volues` directory which contains the persistent data of containers (wiki database and uploads) to reset everything.
|
||||
|
||||
MariaDB take generraly a few seconds to really get started (because it has to start a temp server first to initialize the db), so wait for the following lines to know when it is ready.
|
||||
|
||||
```
|
||||
mariadb-wiki_1 | 2020-01-02 23:15:08+00:00 [Note] [Entrypoint]: Starting temporary server
|
||||
...
|
||||
mariadb-wiki_1 | 2020-01-02 23:15:09 0 [Note] mysqld: ready for connections.
|
||||
...
|
||||
mariadb-wiki_1 | 2020-01-02 23:16:21+00:00 [Note] [Entrypoint]: Temporary server stopped
|
||||
...
|
||||
mariadb-wiki_1 | 2020-01-02 23:16:21+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
|
||||
...
|
||||
mariadb-wiki_1 | 2020-01-02 23:16:21 0 [Note] mysqld: ready for connections.
|
||||
```
|
||||
|
||||
### Start it for real
|
||||
|
||||
If you want to start containers without beeing locked into the logs, start
|
||||
|
||||
```
|
||||
docker-compose up --build -d
|
||||
```
|
||||
|
||||
You can still go watch the logs by doing
|
||||
|
||||
```
|
||||
docker-compose logs -f
|
||||
```
|
||||
|
||||
### Debug mode
|
||||
TODO
|
|
@ -11,18 +11,22 @@ services:
|
|||
- ./src/EactMaker:/www/EactMaker/
|
||||
- ./src/SH4compatibilityTool:/www/SH4compatibilityTool/
|
||||
- ./src/G1rFxiTools:/www/G1rFxiTools/
|
||||
- ./src/FestivAlgo:/www/FestivAlgo/
|
||||
- ./src/SpriteCoder:/www/SpriteCoder/
|
||||
- ./src/FestivAlgo:/www/FestivAlgo/
|
||||
- ./src/CPluaEditor:/www/CPluaEditor/
|
||||
- ./src/HPPrimeNotes:/www/HPPrimeNotes/
|
||||
- ./src/PRGM2FUNC:/www/PRGM2FUNC/
|
||||
- ./src/pcgenerator:/www/pcgenerator/
|
||||
- ./src/home:/www/home/
|
||||
- ./src/wiki:/www/wiki/
|
||||
|
||||
phpfpm-main:
|
||||
build:
|
||||
context: ./php-docker/
|
||||
args:
|
||||
PHP_VERSION: 7.4
|
||||
PHP_EXT_PDO_MYSQL: 1
|
||||
PHP_EXT_GD: 1
|
||||
networks:
|
||||
- php-fpm
|
||||
volumes:
|
||||
|
@ -30,44 +34,59 @@ services:
|
|||
- ./src/SH4compatibilityTool:/www/SH4compatibilityTool/
|
||||
- ./src/G1rFxiTools:/www/G1rFxiTools/
|
||||
- ./src/SpriteCoder:/www/SpriteCoder/
|
||||
- ./src/FestivAlgo:/www/FestivAlgo/
|
||||
- ./src/CPluaEditor:/www/CPluaEditor/
|
||||
- ./src/HPPrimeNotes:/www/HPPrimeNotes/
|
||||
- ./src/PRGM2FUNC:/www/PRGM2FUNC/
|
||||
- ./src/pcgenerator:/www/pcgenerator/
|
||||
- ./src/home:/www/home/
|
||||
phpfpm-festivalgo:
|
||||
|
||||
phpfpm-wiki:
|
||||
build:
|
||||
context: ./php-docker/
|
||||
args:
|
||||
PHP_VERSION: 7.4
|
||||
PHP_VERSION: 5.6
|
||||
PHP_EXT_MYSQL: 1
|
||||
IMAGEMAGICK: 1
|
||||
environment:
|
||||
WIKI_EN_SECRET_KEY: "${WIKI_EN_SECRET_KEY}"
|
||||
WIKI_EN_UPGRADE_KEY: "${WIKI_EN_UPGRADE_KEY}"
|
||||
WIKI_FR_SECRET_KEY: "${WIKI_FR_SECRET_KEY}"
|
||||
WIKI_FR_UPGRADE_KEY: "${WIKI_FR_UPGRADE_KEY}"
|
||||
WIKI_DB_SERVER: "mariadb-wiki"
|
||||
WIKI_DB_NAME: "wiki"
|
||||
WIKI_DB_USER: "wiki"
|
||||
WIKI_DB_PASSWORD: "${WIKI_DB_WIKI_PASSWORD}"
|
||||
WIKI_DEBUG: "${DEBUG}"
|
||||
networks:
|
||||
- php-fpm
|
||||
# - mariadb-festivalgo
|
||||
- mariadb-wiki
|
||||
volumes:
|
||||
- ./src/FestivAlgo:/www/FestivAlgo/
|
||||
- ./src/wiki:/www/wiki/
|
||||
|
||||
# mariadb-festivalgo:
|
||||
# image: mariadb
|
||||
# networks:
|
||||
# - mariadb-festivalgo
|
||||
# environment:
|
||||
# MYSQL_ROOT_PASSWORD: example2
|
||||
# MYSQL_USER: festivalgo
|
||||
# MYSQL_PASSWORD: example
|
||||
# MYSQL_DATABASE: festivalgo
|
||||
# volumes:
|
||||
# - ./src/FestivAlgo/database.sql:/docker-entrypoint-initdb.d/database.sql
|
||||
# - ./volumes/mariadb-festivalgo:/var/lib/mysql
|
||||
mariadb-wiki:
|
||||
image: mariadb
|
||||
networks:
|
||||
- mariadb-wiki
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: "${WIKI_DB_ROOT_PASSWORD}"
|
||||
MYSQL_USER: wiki
|
||||
MYSQL_PASSWORD: "${WIKI_DB_WIKI_PASSWORD}"
|
||||
MYSQL_DATABASE: wiki
|
||||
volumes:
|
||||
- ./volumes/mariadb-wiki:/var/lib/mysql
|
||||
|
||||
# phpmyadmin-festivalgo:
|
||||
# Uncomment the following block to have a ready to use phpmyadmin
|
||||
# Don't keep it up in production
|
||||
# phpmyadmin-wiki:
|
||||
# image: phpmyadmin/phpmyadmin:5
|
||||
# networks:
|
||||
# - mariadb-festivalgo
|
||||
# - mariadb-wiki
|
||||
# ports:
|
||||
# - 8081:80
|
||||
# - 8009:80
|
||||
# environment:
|
||||
# PMA_HOST: mariadb-festivalgo
|
||||
|
||||
# PMA_HOST: mariadb-wiki
|
||||
|
||||
networks:
|
||||
php-fpm:
|
||||
# mariadb-festivalgo:
|
||||
mariadb-wiki:
|
74
nginx.conf
74
nginx.conf
|
@ -1,6 +1,10 @@
|
|||
server {
|
||||
index index.php index.html;
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
server_name _;
|
||||
|
||||
index index.php index.html;
|
||||
root /www;
|
||||
|
||||
# Redirect old path to newer ones
|
||||
|
@ -15,7 +19,7 @@ server {
|
|||
rewrite ^/?$ /home/index.php;
|
||||
|
||||
# Forward to the main php-fpm container
|
||||
location ~ ^/(home|EactMaker|SH4compatibilityTool|G1rFxiTools|SpriteCoder|CPluaEditor|HPPrimeNotes|PRGM2FUNC)/.*\.php$ {
|
||||
location ~ \.php$ {
|
||||
try_files $uri =404;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass phpfpm-main:9000;
|
||||
|
@ -24,20 +28,74 @@ server {
|
|||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name alabate-laptop;
|
||||
|
||||
index index.php;
|
||||
root /www/wiki;
|
||||
|
||||
client_max_body_size 5m;
|
||||
client_body_timeout 60;
|
||||
|
||||
# Redirect old path to newer ones
|
||||
rewrite ^/tools/(.*)$ http://tools.planet-casio.com/$1;
|
||||
|
||||
# Priority to the fr part
|
||||
location = / {
|
||||
rewrite ^/$ /fr/ permanent;
|
||||
}
|
||||
|
||||
# Redireg to each langages
|
||||
location /fr/ {
|
||||
try_files $uri $uri/ @rewrite;
|
||||
}
|
||||
location /en/ {
|
||||
try_files $uri $uri/ @rewrite;
|
||||
}
|
||||
|
||||
# Single file entrypoint
|
||||
location @rewrite {
|
||||
rewrite ^/(fr|en)/(.*)$ /$1/index.php?title=$2&$args;
|
||||
}
|
||||
|
||||
# Forbid direct access to cache and maintenance files
|
||||
location ^~ /(fr|en)/cache/ {
|
||||
deny all;
|
||||
}
|
||||
location ^~ /(fr|en)/maintenance/ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# Forward to php-fpm
|
||||
location ~ \.php$ {
|
||||
expires off;
|
||||
fastcgi_param PATH "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
|
||||
|
||||
# Forward to the festivalgo php-fpm container
|
||||
location ~ ^/FestivAlgo/.*\.php$ {
|
||||
try_files $uri =404;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass phpfpm-festivalgo:9000;
|
||||
fastcgi_pass phpfpm-wiki:9000;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
}
|
||||
|
||||
# If we still have php there, that's an error!
|
||||
location ~ \.php$ {
|
||||
return 500;
|
||||
# Cache configuration for assets
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
|
||||
try_files $uri @rewrite;
|
||||
expires max;
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
# ?
|
||||
location = /_.gif {
|
||||
expires max;
|
||||
empty_gif;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,29 @@
|
|||
ARG PHP_VERSION
|
||||
FROM php:${PHP_VERSION}-fpm
|
||||
|
||||
# Extensions config
|
||||
ARG PHP_EXT_PDO_MYSQL=0
|
||||
ARG PHP_EXT_MYSQL=0
|
||||
ARG PHP_EXT_GD=0
|
||||
ARG PHP_EXT_ZLIB=0
|
||||
ARG IMAGEMAGICK=0
|
||||
|
||||
# Install GD extension
|
||||
RUN apt-get update && apt-get install -y \
|
||||
RUN [ "${PHP_EXT_GD}" = "1" ] && apt-get update && apt-get install -y \
|
||||
libfreetype6-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libpng-dev \
|
||||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||
&& docker-php-ext-install -j$(nproc) gd
|
||||
&& docker-php-ext-install -j$(nproc) gd \
|
||||
|| true
|
||||
|
||||
# Install other extensions
|
||||
RUN [ "${PHP_EXT_PDO_MYSQL}" = "1" ] && docker-php-ext-install pdo pdo_mysql || true
|
||||
RUN [ "${PHP_EXT_MYSQL}" = "1" ] && docker-php-ext-install mysql || true
|
||||
|
||||
# Install imagemagick
|
||||
RUN [ "${IMAGEMAGICK}" = "1" ] && apt-get update && apt-get install -y imagemagick || true
|
||||
|
||||
# Install PDO mysql extension
|
||||
RUN docker-php-ext-install pdo pdo_mysql
|
||||
|
||||
# Set entrypoint
|
||||
COPY ./entrypoint.sh /entrypoint.sh
|
||||
|
|
|
@ -8,16 +8,18 @@ chmod -R a=rX /www/
|
|||
# SpriteCoder
|
||||
if [ -d /www/SpriteCoder ] ; then
|
||||
mkdir -p /www/SpriteCoder/upload
|
||||
chmod a+w /www/SpriteCoder/upload
|
||||
chmod -R a=rXw /www/SpriteCoder/upload
|
||||
fi
|
||||
# accent-remover
|
||||
if [ -d /www/accent-remover ] ; then
|
||||
if [ ! -f /www/accent-remover/count ] ; then
|
||||
echo "0" > /www/accent-remover/count
|
||||
fi
|
||||
chmod a+w /www/accent-remover/count
|
||||
mkdir -p /www/accent-remover/txt
|
||||
chmod a+w /www/accent-remover/txt
|
||||
# wiki
|
||||
if [ -d /www/wiki ] ; then
|
||||
mkdir -p /www/wiki/fr/cache/tmp
|
||||
chmod -R a=rXw /www/wiki/fr/cache
|
||||
mkdir -p /www/wiki/en/cache/tmp
|
||||
chmod -R a=rXw /www/wiki/en/cache
|
||||
mkdir -p /www/wiki/fr/images
|
||||
chmod -R a=rXw /www/wiki/fr/images
|
||||
mkdir -p /www/wiki/en/images
|
||||
chmod -R a=rXw /www/wiki/en/images
|
||||
fi
|
||||
|
||||
exec docker-php-entrypoint "$@"
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 0743bd8582bf8fce3167933fd13dc9ffddc5107d
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 943350b0f4e5927be9c23d5c9ebf8ed71ce60903
|
Loading…
Reference in New Issue