developeregrem / fewohbee-dockerized

Dockerization of the hotel management software
https://www.fewohbee.de
MIT License
3 stars 1 forks source link

Setup without install.sh #4

Open PP-JN-RL opened 1 year ago

PP-JN-RL commented 1 year ago

First of all, this is a great tool, exactly what we have been looking for! Simple and effective.

The issue that we are having is that the setup for a docker environment is still quite complicated and using the install.sh makes it impossible to use under Docker Desktop for Windows.

Will there be a simpler docker-compose file that uses volumes rather than bind mounts and doesn't rely on the install.sh file?

Thank you for your help and keep the great work up.

developeregrem commented 1 year ago

Hi @PP-JN-RL thanks for your feedback :) Unfortunately, I'm not using windows at all. That's why the setup is focusing the linux/unix environment a bit ;)
But you are right, I will try to simplify things in order to make the setup more platform independent. Nevertheless, I would always recommend hosting the application on a dedicated device if you run it productively as described on this page https://github.com/developeregrem/fewohbee/wiki/Hardware

PP-JN-RL commented 1 year ago

Hi @developeregrem

I have got it working inside Portainer with the following docker compose file:

version: "3"
services:
    web:
        image: nginx:mainline-alpine
        ports:
            - 100:80
        volumes:
            - web_data:/var/www/html:cached
            - web_conf:/etc/nginx/conf.d/ #copy conf
        restart: always

    php:
        image: developeregrem/fewohbee-phpfpm:latest
        volumes:
            - web_data:/var/www/html:cached
            - php_conf:/usr/local/etc/php/conf.d/conf.ini #copy conf
        environment:
            - TZ=Europe/London
            - LOCALE=en
            - FEWOHBEE_VERSION=latest
            - APP_ENV=prod
            - APP_SECRET=ChangeMe!
            - DATABASE_URL=mysql://fewohbee:ChangeMe!@db:3306/fewohbee
            - FROM_MAIL=info@ChangeMe.com
            - FROM_NAME="ChangeMe"
            - RETURN_PATH=info@ChangeMe.com
            - MAILER_DSN=null://localhost
            - DB_SERVER_VERSION=mariadb-10.8.3
            - WEB_HOST=http://web:8080
            - REDIS_HOST=redis
            - REDIS_IDX=1
            - USE_PASSWORD_BLACKLIST=false
        restart: always

    db:
        image: mariadb:10.9
        restart: always
        volumes:
             - db_data:/var/lib/mysql:cached
        environment:
            MYSQL_ROOT_PASSWORD: ChangeMe!
            MYSQL_USER: fewohbee
            MYSQL_PASSWORD: ChangeMe!
            MYSQL_DATABASE: fewohbee
            MYSQL_BACKUP_PASSWORD: ChangeMe!
            MYSQL_BACKUP_USER: backupuser

    redis:
        image: redis:alpine
        restart: always
        volumes:
             - redis_data:/data/

volumes:
    web_data:
    web_conf:
    php_conf:
    db_data:
    redis_data:  

I have stripped out the SSL cert part, as its run behind Traefik, which will do the SSL part. The only bit that is needed is to adjust the NGINX config file with the following:

# NGINX
server {
    listen   80;
    listen  [::]:80;
    server_name  192.168.1.2;

    root /var/www/html/fewohbee/public;

    #add_header Strict-Transport-Security "max-age=15768000; includeSubDomains";
    add_header X-Content-Type-Options nosniff;
    add_header X-Frame-Options SAMEORIGIN;

    location / {
    # try to serve file directly, fallback to index.php
    try_files $uri /index.php$is_args$args;
    }

    location ~ ^/index\.php(/|$) {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass php:9000;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    fastcgi_param DOCUMENT_ROOT $realpath_root;
    internal;
    }
}

And change the PHP config file with:

# PHP Config
date.timezone=Europe/London
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1
opcache.jit_buffer_size=100M
session.save_handler = redis
session.save_path = "tcp://redis:6379"
expose_php = Off
display_errors = 0
error_reporting = E_ALL
log_errors = On

I will have a go a building a docker file that will contain a simple web server inside the fewohbee container. Hopefully this will make the setup simpler again.