darktohka / filerun-alpine

A FileRun Docker image built upon Alpine Linux.
0 stars 0 forks source link

docker-compose file? #1

Open gabrielwhite opened 3 years ago

gabrielwhite commented 3 years ago

Hi,

Do you have a docker-compose file you can share for this image?

Thanks!

Gabe

darktohka commented 3 years ago

Sure thing! Here's the docker-compose image I use.

I use the following folders:

./mariadb ==> MariaDB database is saved here ./www ==> Filerun PHP environment is saved here ./logs ==> Filerun PHP logs are saved here ./data ==> Filerun data is saved here, including user uploads

Using this docker-compose file will expose the following volume: filerun_socket which has the following socket: php-fpm.sock that you can connect to Nginx for example. For instance, if you mount filerun_socket to /sockets/filerun, you can use fastcgi_pass unix:/sockets/filerun/php-fpm.sock; in Nginx.


version: '3.8'

services:
  mariadb:
    image: mariadb
    restart: on-failure
    environment:
    - MYSQL_ROOT_PASSWORD=YOUR_DATABASE_PASSWORD
    volumes:
    - mariadb:/var/lib/mysql
    ports:
    - "3306:3306"
    networks:
    - filerun
  filerun:
    image: darktohka/filerun-alpine
    restart: on-failure
    environment:
    - FR_DB_HOST=mariadb
    - FR_DB_PORT=3306
    - FR_DB_NAME=filerun
    - FR_DB_USER=filerun
    - FR_DB_PASS=YOUR_DATABASE_PASSWORD
    volumes:
    - ./logs:/logs:rw
    - ./data:/user-files:rw
    - filerun-socket:/var/run/php:rw
    - filerun-www:/www-files:rw
    depends_on:
    - mariadb
    networks:
    - filerun

volumes:
  filerun-www:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: /star/filerun/www
  mariadb:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: ./mariadb
  filerun-socket:

networks:
  filerun:
    external: false
darktohka commented 3 years ago

Nginx docker-compose service, if you need it:

  nginx:
    image: nginx:mainline-alpine
    restart: on-failure
    ports:
    - "80:80"
    - "443:443"
    volumes:
    - ./nginx/sites-enabled:/etc/nginx/conf.d:ro
    - ./nginx/ssl:/etc/nginx/ssl:ro
    - ./nginx/snippets:/etc/nginx/snippets:ro
    - ./nginx/static:/etc/nginx/static:ro
    - ./nginx/passwd:/etc/nginx/passwd:ro
    - ./www:/static/filerun:ro
    - ./logs:/logs
    - filerun-socket:/sockets/filerun
    networks:
    - filerun

Nginx config included:

server {
    listen 80;
    server_name yourdomain.com;

    server_tokens off;

    root /static/filerun;
    index index.php;

    access_log /logs/filerun-nginx-access.log;
    error_log /logs/filerun-nginx-error.log;

    keepalive_requests    10;
    keepalive_timeout     60 60;

    client_max_body_size 800M;
    client_body_buffer_size 128k;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    # PHP configuration
    location ~ \.php(?:$|/) {
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        include fastcgi_params;

        fastcgi_param SCRIPT_FILENAME /www-files/$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;

        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

        #Avoid sending the security headers twice
        fastcgi_param modHeadersAvailable true;
        fastcgi_param front_controller_active true;
        fastcgi_intercept_errors on;
        fastcgi_request_buffering off;

        fastcgi_pass unix:/sockets/filerun/php-fpm.sock;
    }
}

Feel free to adjust those scripts to your own needs! Daniel

gabrielwhite commented 3 years ago

Thanks!

May be worth publishing this info on Docker Hub for others.