FEATURE REQUEST: Wiki HOWTO #45

Closed
opened 2020-11-01 17:33:10 +00:00 by Jessewebdotcom · 6 comments

Thanks for your work. I'm new to docker and can't figure out how to pull your image (since its not in the docker registry). Can you provide some guidance (and maybe add it to the wiki for others)?

Thanks in advance

Thanks for your work. I'm new to docker and can't figure out how to pull your image (since its not in the docker registry). Can you provide some guidance (and maybe add it to the wiki for others)? Thanks in advance
Author

Here are the steps I took:

  1. Git cloned your repo into a local directory
  2. Updated entrypoint.sh with my TMDB API key
  3. Built the image with:
    docker build --tag docker-flox:latest .
  4. Built/ran container with:
docker run -d \
  --name=flox \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=America/New_York \
  -p 8888:8888 \
  -p 8889:9000 \
  --restart unless-stopped \
  docker-flox:latest

The container starts and I see "NOTICE: ready to handle connections" but I can't access the server using any of the addresses:

Here are my complete logs:

CREATING .ENV FILE
GENERATING APP KEY
Migration table created successfully.
Migrating: 2016_08_01_121249_create_items_table
Migrated:  2016_08_01_121249_create_items_table (0.02 seconds)
Migrating: 2016_08_05_132344_create_users_table
Migrated:  2016_08_05_132344_create_users_table (0.01 seconds)
Migrating: 2016_10_18_063806_create_settings_table
Migrated:  2016_10_18_063806_create_settings_table (0.01 seconds)
Migrating: 2016_11_25_090131_create_episodes_table
Migrated:  2016_11_25_090131_create_episodes_table (0.01 seconds)
Migrating: 2016_11_29_110058_add_created_at_field
Migrated:  2016_11_29_110058_add_created_at_field (0 seconds)
Migrating: 2016_12_12_074211_add_episode_spoiler_protection_field
Migrated:  2016_12_12_074211_add_episode_spoiler_protection_field (0 seconds)
Migrating: 2016_12_15_112332_change_original_title_field
Migrated:  2016_12_15_112332_change_original_title_field (0.06 seconds)
Migrating: 2016_12_17_144415_add_src_field_for_episodes
Migrated:  2016_12_17_144415_add_src_field_for_episodes (0 seconds)
Migrating: 2016_12_18_195039_add_src_field_for_items
Migrated:  2016_12_18_195039_add_src_field_for_items (0 seconds)
Migrating: 2016_12_18_195742_create_alternative_titles_table
Migrated:  2016_12_18_195742_create_alternative_titles_table (0.01 seconds)
Migrating: 2017_01_05_111153_add_last_fetch_to_file_parser_field
Migrated:  2017_01_05_111153_add_last_fetch_to_file_parser_field (0 seconds)
Migrating: 2017_01_25_163036_add_subtitles_field_for_episodes_and_items
Migrated:  2017_01_25_163036_add_subtitles_field_for_episodes_and_items (0.01 seconds)
Migrating: 2017_02_01_122243_change_tmdb_id_field
Migrated:  2017_02_01_122243_change_tmdb_id_field (0.03 seconds)
Migrating: 2017_02_02_080109_add_fp_name_field_to_episodes_and_items
Migrated:  2017_02_02_080109_add_fp_name_field_to_episodes_and_items (0.01 seconds)
Migrating: 2017_02_22_083139_add_timestamps_to_episodes
Migrated:  2017_02_22_083139_add_timestamps_to_episodes (0.01 seconds)
Migrating: 2017_02_22_101320_add_timestamps_and_last_seen_at_to_items
Migrated:  2017_02_22_101320_add_timestamps_and_last_seen_at_to_items (0.03 seconds)
Migrating: 2017_02_23_081946_add_release_dates_to_episodes
Migrated:  2017_02_23_081946_add_release_dates_to_episodes (0 seconds)
Migrating: 2017_03_03_075703_add_subpage_fields_to_items_table
Migrated:  2017_03_03_075703_add_subpage_fields_to_items_table (0.02 seconds)
Migrating: 2017_07_24_180742_add_watchlist_field_to_items_tabe
Migrated:  2017_07_24_180742_add_watchlist_field_to_items_tabe (0 seconds)
Migrating: 2017_07_25_095610_add_show_watchlist_everywhere_field
Migrated:  2017_07_25_095610_add_show_watchlist_everywhere_field (0 seconds)
Migrating: 2017_08_15_082335_add_show_ratings_field
Migrated:  2017_08_15_082335_add_show_ratings_field (0 seconds)
Migrating: 2017_12_29_222510_create_genres_table
Migrated:  2017_12_29_222510_create_genres_table (0.14 seconds)
Migrating: 2017_12_29_222633_create_genre_item_table
Migrated:  2017_12_29_222633_create_genre_item_table (0.03 seconds)
Migrating: 2018_03_16_235550_add_refreshed_at_field
Migrated:  2018_03_16_235550_add_refreshed_at_field (0 seconds)
Migrating: 2018_04_29_162253_create_jobs_table
Migrated:  2018_04_29_162253_create_jobs_table (0.01 seconds)
Migrating: 2018_04_29_164313_create_failed_jobs_table
Migrated:  2018_04_29_164313_create_failed_jobs_table (0 seconds)
Migrating: 2018_11_10_180540_add_refresh_automatically_field
Migrated:  2018_11_10_180540_add_refresh_automatically_field (0 seconds)
Migrating: 2018_11_10_180653_add_reminders_send_to_field
Migrated:  2018_11_10_180653_add_reminders_send_to_field (0 seconds)
Migrating: 2018_11_10_180828_add_daily_and_weekly_fields
Migrated:  2018_11_10_180828_add_daily_and_weekly_fields (0.01 seconds)
Migrating: 2018_12_28_230635_add_homepage_field_to_items_table
Migrated:  2018_12_28_230635_add_homepage_field_to_items_table (0 seconds)
Migrating: 2019_12_23_122213_add_api_key_to_users
Migrated:  2019_12_23_122213_add_api_key_to_users (0.01 seconds)
Migrating: 2019_12_24_104600_add_released_timestamp_to_items
Migrated:  2019_12_24_104600_add_released_timestamp_to_items (0 seconds)
Migrating: 2020_01_09_210708_change_released_timestamp_to_datetime
Migrated:  2020_01_09_210708_change_released_timestamp_to_datetime (0.03 seconds)
Migrating: 2020_01_27_105656_drop_tmdb_id_unique_index
Migrated:  2020_01_27_105656_drop_tmdb_id_unique_index (0 seconds)
crond: crond (busybox 1.30.1) started, log level 0
[02-Nov-2020 18:01:04] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[02-Nov-2020 18:01:04] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[02-Nov-2020 18:01:04] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
[02-Nov-2020 18:01:04] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
[02-Nov-2020 18:01:04] NOTICE: fpm is running, pid 55
[02-Nov-2020 18:01:04] NOTICE: ready to handle connections
crond: wakeup dt=56
crond: wakeup dt=60
crond: wakeup dt=60
crond: wakeup dt=60
crond: wakeup dt=60
crond: wakeup dt=60
crond: wakeup dt=60
crond: wakeup dt=60

crond: wakeup dt=60
crond: wakeup dt=60
crond: wakeup dt=60
crond: wakeup dt=60
crond: wakeup dt=60
crond: wakeup dt=60
crond: wakeup dt=60
crond: wakeup dt=60
crond: wakeup dt=60
crond: wakeup dt=60
Here are the steps I took: 1. Git cloned your repo into a local directory 2. Updated entrypoint.sh with my TMDB API key 3. Built the image with: `docker build --tag docker-flox:latest .` 4. Built/ran container with: ``` docker run -d \ --name=flox \ -e PUID=1000 \ -e PGID=1000 \ -e TZ=America/New_York \ -p 8888:8888 \ -p 8889:9000 \ --restart unless-stopped \ docker-flox:latest ``` The container starts and I see "NOTICE: ready to handle connections" but I can't access the server using any of the addresses: * http://localhost:8888 * http://localhost:8889 * http://localhost:8888/flox/public * http://localhost:8889/flox/public * https://localhost:8888 * https://localhost:8889 * https://localhost:8888/flox/public * https://localhost:8889/flox/public Here are my complete logs: ``` CREATING .ENV FILE GENERATING APP KEY Migration table created successfully. Migrating: 2016_08_01_121249_create_items_table Migrated: 2016_08_01_121249_create_items_table (0.02 seconds) Migrating: 2016_08_05_132344_create_users_table Migrated: 2016_08_05_132344_create_users_table (0.01 seconds) Migrating: 2016_10_18_063806_create_settings_table Migrated: 2016_10_18_063806_create_settings_table (0.01 seconds) Migrating: 2016_11_25_090131_create_episodes_table Migrated: 2016_11_25_090131_create_episodes_table (0.01 seconds) Migrating: 2016_11_29_110058_add_created_at_field Migrated: 2016_11_29_110058_add_created_at_field (0 seconds) Migrating: 2016_12_12_074211_add_episode_spoiler_protection_field Migrated: 2016_12_12_074211_add_episode_spoiler_protection_field (0 seconds) Migrating: 2016_12_15_112332_change_original_title_field Migrated: 2016_12_15_112332_change_original_title_field (0.06 seconds) Migrating: 2016_12_17_144415_add_src_field_for_episodes Migrated: 2016_12_17_144415_add_src_field_for_episodes (0 seconds) Migrating: 2016_12_18_195039_add_src_field_for_items Migrated: 2016_12_18_195039_add_src_field_for_items (0 seconds) Migrating: 2016_12_18_195742_create_alternative_titles_table Migrated: 2016_12_18_195742_create_alternative_titles_table (0.01 seconds) Migrating: 2017_01_05_111153_add_last_fetch_to_file_parser_field Migrated: 2017_01_05_111153_add_last_fetch_to_file_parser_field (0 seconds) Migrating: 2017_01_25_163036_add_subtitles_field_for_episodes_and_items Migrated: 2017_01_25_163036_add_subtitles_field_for_episodes_and_items (0.01 seconds) Migrating: 2017_02_01_122243_change_tmdb_id_field Migrated: 2017_02_01_122243_change_tmdb_id_field (0.03 seconds) Migrating: 2017_02_02_080109_add_fp_name_field_to_episodes_and_items Migrated: 2017_02_02_080109_add_fp_name_field_to_episodes_and_items (0.01 seconds) Migrating: 2017_02_22_083139_add_timestamps_to_episodes Migrated: 2017_02_22_083139_add_timestamps_to_episodes (0.01 seconds) Migrating: 2017_02_22_101320_add_timestamps_and_last_seen_at_to_items Migrated: 2017_02_22_101320_add_timestamps_and_last_seen_at_to_items (0.03 seconds) Migrating: 2017_02_23_081946_add_release_dates_to_episodes Migrated: 2017_02_23_081946_add_release_dates_to_episodes (0 seconds) Migrating: 2017_03_03_075703_add_subpage_fields_to_items_table Migrated: 2017_03_03_075703_add_subpage_fields_to_items_table (0.02 seconds) Migrating: 2017_07_24_180742_add_watchlist_field_to_items_tabe Migrated: 2017_07_24_180742_add_watchlist_field_to_items_tabe (0 seconds) Migrating: 2017_07_25_095610_add_show_watchlist_everywhere_field Migrated: 2017_07_25_095610_add_show_watchlist_everywhere_field (0 seconds) Migrating: 2017_08_15_082335_add_show_ratings_field Migrated: 2017_08_15_082335_add_show_ratings_field (0 seconds) Migrating: 2017_12_29_222510_create_genres_table Migrated: 2017_12_29_222510_create_genres_table (0.14 seconds) Migrating: 2017_12_29_222633_create_genre_item_table Migrated: 2017_12_29_222633_create_genre_item_table (0.03 seconds) Migrating: 2018_03_16_235550_add_refreshed_at_field Migrated: 2018_03_16_235550_add_refreshed_at_field (0 seconds) Migrating: 2018_04_29_162253_create_jobs_table Migrated: 2018_04_29_162253_create_jobs_table (0.01 seconds) Migrating: 2018_04_29_164313_create_failed_jobs_table Migrated: 2018_04_29_164313_create_failed_jobs_table (0 seconds) Migrating: 2018_11_10_180540_add_refresh_automatically_field Migrated: 2018_11_10_180540_add_refresh_automatically_field (0 seconds) Migrating: 2018_11_10_180653_add_reminders_send_to_field Migrated: 2018_11_10_180653_add_reminders_send_to_field (0 seconds) Migrating: 2018_11_10_180828_add_daily_and_weekly_fields Migrated: 2018_11_10_180828_add_daily_and_weekly_fields (0.01 seconds) Migrating: 2018_12_28_230635_add_homepage_field_to_items_table Migrated: 2018_12_28_230635_add_homepage_field_to_items_table (0 seconds) Migrating: 2019_12_23_122213_add_api_key_to_users Migrated: 2019_12_23_122213_add_api_key_to_users (0.01 seconds) Migrating: 2019_12_24_104600_add_released_timestamp_to_items Migrated: 2019_12_24_104600_add_released_timestamp_to_items (0 seconds) Migrating: 2020_01_09_210708_change_released_timestamp_to_datetime Migrated: 2020_01_09_210708_change_released_timestamp_to_datetime (0.03 seconds) Migrating: 2020_01_27_105656_drop_tmdb_id_unique_index Migrated: 2020_01_27_105656_drop_tmdb_id_unique_index (0 seconds) crond: crond (busybox 1.30.1) started, log level 0 [02-Nov-2020 18:01:04] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root [02-Nov-2020 18:01:04] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root [02-Nov-2020 18:01:04] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root [02-Nov-2020 18:01:04] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root [02-Nov-2020 18:01:04] NOTICE: fpm is running, pid 55 [02-Nov-2020 18:01:04] NOTICE: ready to handle connections crond: wakeup dt=56 crond: wakeup dt=60 crond: wakeup dt=60 crond: wakeup dt=60 crond: wakeup dt=60 crond: wakeup dt=60 crond: wakeup dt=60 crond: wakeup dt=60 crond: wakeup dt=60 crond: wakeup dt=60 crond: wakeup dt=60 crond: wakeup dt=60 crond: wakeup dt=60 crond: wakeup dt=60 crond: wakeup dt=60 crond: wakeup dt=60 crond: wakeup dt=60 crond: wakeup dt=60 ```
Author

I found and switched to your mwalbeck/flox docker hub published image but I still get the same results as the above after adding my TMDB api KEY as environment variable

I found and switched to your mwalbeck/flox docker hub published image but I still get the same results as the above after adding my TMDB api KEY as environment variable
Owner

Hi,

There is actually a ready built image on Docker Hub here, https://hub.docker.com/r/mwalbeck/flox

I've been meaning to write a proper readme with usage instructions, I just haven't gotten around to it yet.

Firstly as a general note about docker images and specifying options, you will often see the option to configure images with environment variables, this allows you to configure the docker image when you run it without having to edit the build files. If you look in the entrypoint.sh file you can see a list of variables in the beginning those are the available environment variables that can be set at runtime. I'll get back to how to set them in a bit.

The second thing to take note of with this image is it doesn't actually have a webserver in it. It's only the php-fpm process that handles all the php stuff, so a separate webserver to actually access the application. The easiest way to put these things together is using docker-compose, where you can also specify any environment variables. So I can really recommend reading a bit about docker-compose and how to use it.

Here below is an example docker-compose file for setting this up. One thing to note is on the containers first run FLOX_DB_INIT should be set to true, that creates the database. Then you can shutdown the container and set it to false, or else the container will fail to start. You can change the rest of the environment variables as needed and add more from the list in entrypoint.sh

You can read more about the usage of the nginx container on the docker hub page, https://hub.docker.com/_/nginx

The last thing you need is a webserver config. You can find a basic one below. You can change the server_name as needed.

version: '2'

volumes:
  flox:

networks:
  frontend:

services:
  flox:
    image: mwalbeck/getgrav:latest
    restart: on-failure:5
    networks:
      - frontend
    volumes:
      - flox:/var/www/flox
    environment:
      FLOX_ADMIN_USER: "something"
      FLOX_ADMIN_PASS: "something"
	  FLOX_APP_URL: "something"
      TMDB_API_KEY: "something"
      FLOX_DB_INIT: true


  web:
    image: nginx:latest
    restart: on-failure:5
    networks:
      - frontend
    volumes:
      - /path/to/nginx:/etc/nginx:ro
    volumes_from:
      - flox:ro
    ports:
      - 80:80
      - 443:443

server {
    listen [::]:80;
    listen 80;
    server_name localhost;

    root /var/www/flox/public;

    index index.php;

    charset utf-8;

    location ~ /\. {
        access_log off;
        log_not_found off;
        deny all;
    }

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

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location = /index.php {
        fastcgi_pass flox:9000;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        try_files $fastcgi_script_name =404;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~ \.php$ { return 403; }
}

I hope that made sense as a basic overview. Also the configs should work, but I haven't tested them as I don't have the time right now.

Hi, There is actually a ready built image on Docker Hub here, https://hub.docker.com/r/mwalbeck/flox I've been meaning to write a proper readme with usage instructions, I just haven't gotten around to it yet. Firstly as a general note about docker images and specifying options, you will often see the option to configure images with environment variables, this allows you to configure the docker image when you run it without having to edit the build files. If you look in the entrypoint.sh file you can see a list of variables in the beginning those are the available environment variables that can be set at runtime. I'll get back to how to set them in a bit. The second thing to take note of with this image is it doesn't actually have a webserver in it. It's only the php-fpm process that handles all the php stuff, so a separate webserver to actually access the application. The easiest way to put these things together is using docker-compose, where you can also specify any environment variables. So I can really recommend reading a bit about docker-compose and how to use it. Here below is an example docker-compose file for setting this up. One thing to note is on the containers first run FLOX_DB_INIT should be set to true, that creates the database. Then you can shutdown the container and set it to false, or else the container will fail to start. You can change the rest of the environment variables as needed and add more from the list in entrypoint.sh You can read more about the usage of the nginx container on the docker hub page, https://hub.docker.com/_/nginx The last thing you need is a webserver config. You can find a basic one below. You can change the server_name as needed. ``` version: '2' volumes: flox: networks: frontend: services: flox: image: mwalbeck/getgrav:latest restart: on-failure:5 networks: - frontend volumes: - flox:/var/www/flox environment: FLOX_ADMIN_USER: "something" FLOX_ADMIN_PASS: "something" FLOX_APP_URL: "something" TMDB_API_KEY: "something" FLOX_DB_INIT: true web: image: nginx:latest restart: on-failure:5 networks: - frontend volumes: - /path/to/nginx:/etc/nginx:ro volumes_from: - flox:ro ports: - 80:80 - 443:443 ``` ``` server { listen [::]:80; listen 80; server_name localhost; root /var/www/flox/public; index index.php; charset utf-8; location ~ /\. { access_log off; log_not_found off; deny all; } location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } error_page 404 /index.php; location = /index.php { fastcgi_pass flox:9000; fastcgi_split_path_info ^(.+\.php)(/.+)$; try_files $fastcgi_script_name =404; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location ~ \.php$ { return 403; } } ``` I hope that made sense as a basic overview. Also the configs should work, but I haven't tested them as I don't have the time right now.
Author

THANK YOU - That was the missing piece for me (there's no web server in your image). I got everything up and running. Here's my compose file (I used your nginx.conf example exactly as above):

version: '2'

volumes:
  flox:

networks:
  shared:
    external: false

services:
  flox:
    image: mwalbeck/flox:latest
    container_name: flox    
    restart: unless-stopped   
    networks:
      - shared 
    volumes:
      - ${CONFIG}/flox:/var/www/flox
    environment:
      FLOX_ADMIN_USER: "${ADMINNAME}"
      FLOX_ADMIN_PASS: "${ADMINPASS}"
      FLOX_APP_URL: "http://localhost"
      TMDB_API_KEY: "${TVDBAPIKEY}"
      FLOX_DB_INIT: "true"


  web:
    image: nginx:latest
    container_name: flox_web    
    restart: unless-stopped   
    networks:
      - shared 
    volumes:
      - ${CONFIG}/flox_nginx/nginx.conf:/etc/nginx/conf.d/default.conf
    volumes_from:
      - flox:ro
    ports:
      - 8888:80
      - 8889:443
THANK YOU - That was the missing piece for me (there's no web server in your image). I got everything up and running. Here's my compose file (I used your nginx.conf example exactly as above): ``` version: '2' volumes: flox: networks: shared: external: false services: flox: image: mwalbeck/flox:latest container_name: flox restart: unless-stopped networks: - shared volumes: - ${CONFIG}/flox:/var/www/flox environment: FLOX_ADMIN_USER: "${ADMINNAME}" FLOX_ADMIN_PASS: "${ADMINPASS}" FLOX_APP_URL: "http://localhost" TMDB_API_KEY: "${TVDBAPIKEY}" FLOX_DB_INIT: "true" web: image: nginx:latest container_name: flox_web restart: unless-stopped networks: - shared volumes: - ${CONFIG}/flox_nginx/nginx.conf:/etc/nginx/conf.d/default.conf volumes_from: - flox:ro ports: - 8888:80 - 8889:443 ```
Owner

Great, happy to help.

Great, happy to help.
Author

For anyone else who finds this - don't forget to set FLOX_DB_INIT to "false" after your first successful boot.

For anyone else who finds this - don't forget to set FLOX_DB_INIT to "false" after your first successful boot.
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mwalbeck/docker-flox#45
No description provided.