├── .dictionary.txt ├── .gitignore ├── rootfs └── etc │ ├── s6-overlay │ ├── s6-rc.d │ │ ├── mysql │ │ │ ├── type │ │ │ ├── dependencies.d │ │ │ │ ├── 02-firstrun │ │ │ │ ├── 03-settings │ │ │ │ ├── 04-patch-fam │ │ │ │ └── 01-sanitycheck │ │ │ └── run │ │ ├── nginx │ │ │ ├── type │ │ │ ├── dependencies.d │ │ │ │ ├── 02-firstrun │ │ │ │ ├── 03-settings │ │ │ │ ├── 04-patch-fam │ │ │ │ └── 01-sanitycheck │ │ │ └── run │ │ ├── socat │ │ │ ├── type │ │ │ ├── dependencies.d │ │ │ │ ├── 02-firstrun │ │ │ │ ├── 03-settings │ │ │ │ ├── 04-patch-fam │ │ │ │ └── 01-sanitycheck │ │ │ └── run │ │ ├── user │ │ │ └── contents.d │ │ │ │ ├── mysql │ │ │ │ ├── nginx │ │ │ │ ├── php-fpm │ │ │ │ ├── socat │ │ │ │ ├── 02-firstrun │ │ │ │ ├── 03-settings │ │ │ │ ├── 04-patch-fam │ │ │ │ ├── daemon-acars │ │ │ │ ├── update_db │ │ │ │ ├── 01-sanitycheck │ │ │ │ └── daemon-spotter │ │ ├── 02-firstrun │ │ │ ├── type │ │ │ ├── dependencies.d │ │ │ │ └── 01-sanitycheck │ │ │ └── up │ │ ├── 03-settings │ │ │ ├── type │ │ │ ├── dependencies.d │ │ │ │ ├── 02-firstrun │ │ │ │ └── 01-sanitycheck │ │ │ └── up │ │ ├── php-fpm │ │ │ ├── type │ │ │ ├── dependencies.d │ │ │ │ ├── 01-sanitycheck │ │ │ │ ├── 02-firstrun │ │ │ │ ├── 03-settings │ │ │ │ └── 04-patch-fam │ │ │ └── run │ │ ├── update_db │ │ │ ├── type │ │ │ ├── dependencies.d │ │ │ │ ├── 02-firstrun │ │ │ │ ├── 03-settings │ │ │ │ └── 01-sanitycheck │ │ │ └── run │ │ ├── 01-sanitycheck │ │ │ ├── type │ │ │ └── up │ │ ├── 04-patch-fam │ │ │ ├── type │ │ │ ├── dependencies.d │ │ │ │ ├── 01-sanitycheck │ │ │ │ ├── 02-firstrun │ │ │ │ └── 03-settings │ │ │ └── up │ │ ├── daemon-acars │ │ │ ├── type │ │ │ ├── dependencies.d │ │ │ │ ├── 01-sanitycheck │ │ │ │ ├── 02-firstrun │ │ │ │ ├── 03-settings │ │ │ │ └── 04-patch-fam │ │ │ └── run │ │ └── daemon-spotter │ │ │ ├── type │ │ │ ├── dependencies.d │ │ │ ├── 02-firstrun │ │ │ ├── 03-settings │ │ │ ├── 04-patch-fam │ │ │ └── 01-sanitycheck │ │ │ └── run │ └── scripts │ │ ├── nginx │ │ ├── php-fpm │ │ ├── update_db │ │ ├── mysql │ │ ├── socat │ │ ├── daemon-acars │ │ ├── 04-patch-fam │ │ ├── 01-sanitycheck │ │ ├── daemon-spotter │ │ ├── 03-settings │ │ └── 02-firstrun │ ├── nginx │ ├── conf.d │ │ └── flightairmap.conf │ └── nginx.conf │ └── php │ └── 7.4 │ └── fpm │ └── pool.d │ └── flightairmap.conf ├── .github ├── workflows │ ├── pre-commit-updates.yaml │ ├── linting.yml │ └── deploy.yml ├── dependabot.yaml └── FUNDING.yml ├── .pre-commit-config.yaml ├── Dockerfile └── README.md /.dictionary.txt: -------------------------------------------------------------------------------- 1 | crate 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/mysql/type: -------------------------------------------------------------------------------- 1 | longrun 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/nginx/type: -------------------------------------------------------------------------------- 1 | longrun 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/socat/type: -------------------------------------------------------------------------------- 1 | longrun 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/mysql: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/nginx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/php-fpm: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/socat: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/02-firstrun/type: -------------------------------------------------------------------------------- 1 | oneshot 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/03-settings/type: -------------------------------------------------------------------------------- 1 | oneshot 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/php-fpm/type: -------------------------------------------------------------------------------- 1 | longrun 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/update_db/type: -------------------------------------------------------------------------------- 1 | longrun 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/02-firstrun: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/03-settings: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/04-patch-fam: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/daemon-acars: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/update_db: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/01-sanitycheck/type: -------------------------------------------------------------------------------- 1 | oneshot 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/04-patch-fam/type: -------------------------------------------------------------------------------- 1 | oneshot 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/daemon-acars/type: -------------------------------------------------------------------------------- 1 | longrun 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/daemon-spotter/type: -------------------------------------------------------------------------------- 1 | longrun 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/mysql/dependencies.d/02-firstrun: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/mysql/dependencies.d/03-settings: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/mysql/dependencies.d/04-patch-fam: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/nginx/dependencies.d/02-firstrun: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/nginx/dependencies.d/03-settings: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/nginx/dependencies.d/04-patch-fam: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/socat/dependencies.d/02-firstrun: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/socat/dependencies.d/03-settings: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/socat/dependencies.d/04-patch-fam: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/01-sanitycheck: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/daemon-spotter: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/03-settings/dependencies.d/02-firstrun: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/mysql/dependencies.d/01-sanitycheck: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/nginx/dependencies.d/01-sanitycheck: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/php-fpm/dependencies.d/01-sanitycheck: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/php-fpm/dependencies.d/02-firstrun: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/php-fpm/dependencies.d/03-settings: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/php-fpm/dependencies.d/04-patch-fam: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/socat/dependencies.d/01-sanitycheck: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/update_db/dependencies.d/02-firstrun: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/update_db/dependencies.d/03-settings: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/02-firstrun/dependencies.d/01-sanitycheck: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/03-settings/dependencies.d/01-sanitycheck: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/04-patch-fam/dependencies.d/01-sanitycheck: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/04-patch-fam/dependencies.d/02-firstrun: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/04-patch-fam/dependencies.d/03-settings: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/daemon-acars/dependencies.d/01-sanitycheck: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/daemon-acars/dependencies.d/02-firstrun: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/daemon-acars/dependencies.d/03-settings: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/daemon-acars/dependencies.d/04-patch-fam: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/daemon-spotter/dependencies.d/02-firstrun: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/daemon-spotter/dependencies.d/03-settings: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/daemon-spotter/dependencies.d/04-patch-fam: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/update_db/dependencies.d/01-sanitycheck: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/daemon-spotter/dependencies.d/01-sanitycheck: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/mysql/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /etc/s6-overlay/scripts/mysql 3 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/nginx/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /etc/s6-overlay/scripts/nginx 3 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/socat/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /etc/s6-overlay/scripts/socat 3 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /etc/s6-overlay/scripts/php-fpm 3 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/02-firstrun/up: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /etc/s6-overlay/scripts/02-firstrun 3 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/03-settings/up: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /etc/s6-overlay/scripts/03-settings 3 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/update_db/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /etc/s6-overlay/scripts/update_db 3 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/04-patch-fam/up: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /etc/s6-overlay/scripts/04-patch-fam 3 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/daemon-acars/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /etc/s6-overlay/scripts/daemon-acars 3 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/01-sanitycheck/up: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /etc/s6-overlay/scripts/01-sanitycheck 3 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/daemon-spotter/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /etc/s6-overlay/scripts/daemon-spotter 3 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/scripts/nginx: -------------------------------------------------------------------------------- 1 | #!/command/with-contenv bash 2 | # shellcheck shell=bash 3 | 4 | # shellcheck disable=SC1091,SC2086,SC2016 5 | source /scripts/common 6 | 7 | s6wrap=(s6wrap --quiet --prepend="$(basename "$0")" --timestamps --args) 8 | "${s6wrap[@]}" /usr/sbin/nginx -g 'daemon off;' 9 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/scripts/php-fpm: -------------------------------------------------------------------------------- 1 | #!/command/with-contenv bash 2 | # shellcheck shell=bash 3 | 4 | # shellcheck disable=SC1091,SC2086,SC2016 5 | source /scripts/common 6 | 7 | s6wrap=(s6wrap --quiet --prepend="$(basename "$0")" --timestamps --args) 8 | "${s6wrap[@]}" /usr/sbin/php-fpm7.4 --nodaemonize 9 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/scripts/update_db: -------------------------------------------------------------------------------- 1 | #!/command/with-contenv bash 2 | # shellcheck shell=bash 3 | 4 | # shellcheck disable=SC1091,SC2086,SC2016 5 | source /scripts/common 6 | 7 | s6wrap=(s6wrap --quiet --prepend="$(basename "$0")" --timestamps --args) 8 | "${s6wrap[@]}" sleep 1h 9 | "${s6wrap[@]}" s6-setuidgid "$WEBUSER" php /var/www/flightairmap/htdocs/scripts/update_db.php 10 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/scripts/mysql: -------------------------------------------------------------------------------- 1 | #!/command/with-contenv bash 2 | # shellcheck shell=bash 3 | 4 | # shellcheck disable=SC1091,SC2086,SC2016 5 | source /scripts/common 6 | 7 | s6wrap=(s6wrap --quiet --prepend="$(basename "$0")" --timestamps --args) 8 | 9 | # if using local database 10 | if [ -z "${MYSQLHOSTNAME}" ]; then 11 | "${s6wrap[@]}" /usr/sbin/mysqld --console --log-error='' --user=root 12 | else 13 | "${s6wrap[@]}" sleep 3600 14 | fi 15 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/scripts/socat: -------------------------------------------------------------------------------- 1 | #!/command/with-contenv bash 2 | # shellcheck shell=bash 3 | 4 | # shellcheck disable=SC1091,SC2086,SC2016 5 | source /scripts/common 6 | 7 | s6wrap=(s6wrap --quiet --prepend="$(basename "$0")" --timestamps --args) 8 | 9 | if [ -z "${BASESTATIONHOST}" ]; then 10 | "${s6wrap[@]}" sleep 3600 11 | else 12 | # shellcheck disable=SC2153 13 | "${s6wrap[@]}" socat -d -d TCP-LISTEN:30003,fork TCP:"${BASESTATIONHOST}":"${BASESTATIONPORT}" 14 | fi 15 | -------------------------------------------------------------------------------- /rootfs/etc/nginx/conf.d/flightairmap.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen *:80; 3 | server_name flightairmap; 4 | root /var/www/flightairmap/htdocs; 5 | proxy_read_timeout 1200s; 6 | index index.php index.htm index.html; 7 | location ~ \.php$ { 8 | fastcgi_pass 127.0.0.1:9000; 9 | fastcgi_index index.php; 10 | include /etc/nginx/fastcgi.conf; 11 | fastcgi_read_timeout 2400s; 12 | } 13 | include /etc/nginx/flightairmap-nginx-conf.include; 14 | } 15 | -------------------------------------------------------------------------------- /.github/workflows/pre-commit-updates.yaml: -------------------------------------------------------------------------------- 1 | name: Update pre-commit hooks 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: 0 0 * * 0 7 | 8 | jobs: 9 | pre-commit-update: 10 | runs-on: ubuntu-latest 11 | name: Updates 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v6.0.1 15 | - name: Update pre-commit hooks 16 | uses: brokenpip3/action-pre-commit-update@0.0.3 17 | with: 18 | github-token: ${{ secrets.GITHUB_TOKEN }} 19 | pr-targetbranch: master 20 | -------------------------------------------------------------------------------- /.github/dependabot.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 2 3 | 4 | updates: 5 | # Maintain dependencies for Docker 6 | - package-ecosystem: "docker" 7 | directory: "/" 8 | schedule: 9 | interval: "weekly" 10 | day: "saturday" 11 | time: "00:00" 12 | timezone: "Etc/UTC" 13 | assignees: 14 | - "mikenye" 15 | - "fredclausen" 16 | 17 | # Maintain dependencies for GitHub Actions 18 | - package-ecosystem: "github-actions" 19 | directory: "/" 20 | schedule: 21 | interval: "weekly" 22 | day: "saturday" 23 | time: "00:00" 24 | timezone: "Etc/UTC" 25 | assignees: 26 | - "mikenye" 27 | - "fredclausen" 28 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/scripts/daemon-acars: -------------------------------------------------------------------------------- 1 | #!/command/with-contenv bash 2 | # shellcheck shell=bash 3 | 4 | # shellcheck disable=SC1091,SC2086,SC2016 5 | source /scripts/common 6 | 7 | s6wrap=(s6wrap --quiet --prepend="$(basename "$0")" --timestamps --args) 8 | if chk_enabled $QUIET_FAM; then 9 | # shut up the logging of acars messages if it's enabled and it's a normal looking message 10 | "${s6wrap[@]}" s6-setuidgid "$WEBUSER" php /var/www/flightairmap/htdocs/scripts/daemon-acars.php 2>&1 | \ 11 | stdbuf -oL awk '! /freq/' | \ 12 | stdbuf -oL awk '{print $0}' 13 | else 14 | "${s6wrap[@]}" s6-setuidgid "$WEBUSER" php /var/www/flightairmap/htdocs/scripts/daemon-acars.php 15 | fi 16 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: ["https://paypal.me/mikenyegithub"] 13 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/scripts/04-patch-fam: -------------------------------------------------------------------------------- 1 | #!/command/with-contenv bash 2 | # shellcheck shell=bash 3 | 4 | # shellcheck disable=SC1091,SC2086,SC2016 5 | source /scripts/common 6 | 7 | # patch FAM 8 | 9 | sed -i '697s/\$matches as \$m/\$matches \?\? \[\] as \$m/' /var/www/flightairmap/htdocs/require/libs/simple_html_dom.php 10 | sed -i '1385s/w-/w\\-/' /var/www/flightairmap/htdocs/require/libs/simple_html_dom.php 11 | sed -i '689s/w-/w\\-/g' /var/www/flightairmap/htdocs/require/libs/simple_html_dom.php 12 | sed -i '4084s/\$owner_info\['\''owner'\''] != '\'''\''/isset\(\$owner_info\['\''owner'\''\]\) \&\& !empty\(\$owner_info\['\''owner'\''\]\)/' /var/www/flightairmap/htdocs/require/class.Spotter.php 13 | sed -i '2199s/count(\$row) > 0/isset\(\$row\['\''icao'\''\]\) \&\& !empty\(\$row\['\''icao'\''\]\)/' /var/www/flightairmap/htdocs/require/class.Spotter.php 14 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/scripts/01-sanitycheck: -------------------------------------------------------------------------------- 1 | #!/command/with-contenv /bin/bash 2 | #shellcheck shell=bash 3 | 4 | NOCOLOR='\033[0m' 5 | YELLOW='\033[1;33m' 6 | LIGHTRED='\033[1;31m' 7 | LIGHTBLUE='\033[1;34m' 8 | 9 | # Check to make sure the correct command line arguments have been set 10 | EXITCODE=0 11 | if [ -z "${FAM_INSTALLPASSWORD}" ]; then 12 | echo -e "${YELLOW}WARNING: FAM_INSTALLPASSWORD environment variable not set, using random password${NOCOLOR}" 13 | #EXITCODE=1 14 | fi 15 | 16 | # Make sure database hostname/password have been set OK 17 | if [ -z "${MYSQLHOSTNAME}" ]; then 18 | echo -e "${LIGHTBLUE}INFO: MYSQLHOSTNAME not set, using local database${NOCOLOR}" 19 | echo -e "${LIGHTRED}ERROR: local data base is not supported. Please set up an external mariadb instance for use.${NOCOLOR}" 20 | EXITCODE=1 21 | else 22 | if [ -z "${MYSQLPASSWORD}" ]; then 23 | echo -e "${LIGHTRED}ERROR: MYSQLHOSTNAME set, however MYSQLPASSWORD not set${NOCOLOR}" 24 | EXITCODE=1 25 | fi 26 | fi 27 | 28 | # If any sanity checks if failed, exit 29 | if [ "$EXITCODE" -ne 0 ]; then 30 | exit 1 31 | fi 32 | 33 | # Set up timezone 34 | ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" > /etc/timezone 35 | -------------------------------------------------------------------------------- /.github/workflows/linting.yml: -------------------------------------------------------------------------------- 1 | name: Linting 2 | 3 | on: 4 | push: 5 | pull_request: 6 | branches: [master] 7 | 8 | jobs: 9 | shellcheck: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v6.0.1 14 | - name: Pull koalaman/shellcheck:stable Image 15 | run: docker pull koalaman/shellcheck:stable 16 | - name: Run Shellcheck against shell scripts 17 | run: docker run --rm -i -v "$PWD:/mnt" koalaman/shellcheck:stable $(find . -type f -exec grep -m1 -l -E '^#!.*sh.*' {} \; | grep -v '/.git/') 18 | # docker run --rm -i -v "$PWD:/mnt" koalaman/shellcheck:stable $(find . -type f -exec grep -m1 -l -E '^#!.*execline.*' {} \; | grep -v '/.git/') 19 | 20 | hadolint: 21 | runs-on: ubuntu-latest 22 | 23 | steps: 24 | - uses: actions/checkout@v6.0.1 25 | - name: Pull hadolint/hadolint:latest Image 26 | run: docker pull hadolint/hadolint:latest 27 | - name: Run hadolint against Dockerfiles 28 | run: docker run --rm -i -v "$PWD":/workdir --workdir /workdir --entrypoint hadolint hadolint/hadolint --ignore DL3008 $(find . -type f -iname "Dockerfile*") 29 | 30 | markdownlint: 31 | runs-on: ubuntu-latest 32 | 33 | steps: 34 | - uses: actions/checkout@v6.0.1 35 | - name: Pull markdownlint/markdownlint:latest Image 36 | run: docker pull markdownlint/markdownlint:latest 37 | - name: Run markdownlint against *.md files 38 | run: docker run --rm -i -v "$(pwd)":/workdir --workdir /workdir markdownlint/markdownlint:latest --rules ~MD013,~MD038 $(find . -type f -iname '*.md' | grep -v '/.git/') 39 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/scripts/daemon-spotter: -------------------------------------------------------------------------------- 1 | #!/command/with-contenv bash 2 | # shellcheck shell=bash 3 | 4 | # shellcheck disable=SC1091,SC2086,SC2016 5 | source /scripts/common 6 | 7 | s6wrap=(s6wrap --quiet --prepend="$(basename "$0")" --timestamps --args) 8 | if chk_enabled $QUIET_FAM; then 9 | # shellcheck disable=SC1091,SC2086,SC2016 10 | "${s6wrap[@]}" s6-setuidgid "$WEBUSER" php /var/www/flightairmap/htdocs/scripts/daemon-spotter.php 2>&1 | \ 11 | stdbuf -oL awk '! /\\o\//' | \ 12 | stdbuf -oL awk '! /DATA : /' | \ 13 | stdbuf -oL awk '! /New flight.../' | \ 14 | stdbuf -oL awk '! /New aircraft hex/' | \ 15 | stdbuf -oL awk '! /in archive DB/' | \ 16 | stdbuf -oL awk '! /already in DB/' | \ 17 | stdbuf -oL awk '! /Getting schedule info/' | \ 18 | stdbuf -oL awk '! /old values and update latest data/' | \ 19 | stdbuf -oL awk '! /Check if aircraft is already in DB/' | \ 20 | stdbuf -oL awk '! /get arrival\/departure airport/' | \ 21 | stdbuf -oL awk '! /Deleting Live Spotter/' | \ 22 | stdbuf -oL awk '! /Calculated Speed/' | \ 23 | stdbuf -oL awk '! /Calculated Altitude/' | \ 24 | stdbuf -oL awk '! /Calculated Heading/' | \ 25 | stdbuf -oL awk '! /Schedule info/' | \ 26 | stdbuf -oL awk '! /Change departure airport/' | \ 27 | stdbuf -oL awk '! /Change arrival airport/' | \ 28 | stdbuf -oL awk '! /Update arrival/' | \ 29 | stdbuf -oL awk '! /Update departure/' | \ 30 | stdbuf -oL awk '! /Delete old values/' | \ 31 | stdbuf -oL awk '! /find arrival airport/' | \ 32 | stdbuf -oL awk '! /^\n/' | \ 33 | stdbuf -oL awk '! /^ \n/' | \ 34 | stdbuf -oL awk '! /^$/' | \ 35 | stdbuf -oL awk '! /Check Country/' | \ 36 | stdbuf -oL awk '! /Too much distance in short time/' | \ 37 | stdbuf -oL awk '! /Time :/' | \ 38 | stdbuf -oL awk '! /No Airport near/' | \ 39 | stdbuf -oL sed -e 's/\n\n/\n/g' | \ 40 | stdbuf -oL awk '{print $0}' 41 | else 42 | # shellcheck disable=SC1091,SC2086,SC2016 43 | "${s6wrap[@]}" s6-setuidgid "$WEBUSER" php /var/www/flightairmap/htdocs/scripts/daemon-spotter.php 44 | fi 45 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | # lint yaml, line and whitespace 3 | - repo: https://github.com/pre-commit/pre-commit-hooks 4 | rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0 5 | hooks: 6 | - id: check-yaml 7 | - id: end-of-file-fixer 8 | - id: trailing-whitespace 9 | - id: requirements-txt-fixer 10 | - id: mixed-line-ending 11 | - id: check-executables-have-shebangs 12 | - id: check-shebang-scripts-are-executable 13 | 14 | # lint the dockerfiles 15 | - repo: https://github.com/hadolint/hadolint 16 | rev: 4e697ba704fd23b2409b947a319c19c3ee54d24f # frozen: v2.14.0 17 | hooks: 18 | - id: hadolint 19 | 20 | # prettier 21 | - repo: https://github.com/pre-commit/mirrors-prettier 22 | rev: "f12edd9c7be1c20cfa42420fd0e6df71e42b51ea" # frozen: v4.0.0-alpha.8 23 | hooks: 24 | - id: prettier 25 | types_or: [file, bash, sh, javascript, jsx, ts, tsx] 26 | additional_dependencies: 27 | - prettier@2.5.1 28 | exclude: ^(Dockerfile*) 29 | 30 | - repo: https://github.com/codespell-project/codespell.git 31 | rev: "63c8f8312b7559622c0d82815639671ae42132ac" # frozen: v2.4.1 32 | hooks: 33 | - id: codespell 34 | types: [text] 35 | args: [--ignore-words=.dictionary.txt] 36 | exclude: ^(Dockerfile*) 37 | 38 | - repo: https://github.com/shellcheck-py/shellcheck-py 39 | rev: 745eface02aef23e168a8afb6b5737818efbea95 # frozen: v0.11.0.1 40 | hooks: 41 | - id: shellcheck 42 | 43 | - repo: https://github.com/sirosen/check-jsonschema 44 | rev: 16a6ad2fead09286ee6eb6b0a3fab55655a6c22a # frozen: 0.35.0 45 | hooks: 46 | - id: check-github-actions 47 | - id: check-github-workflows 48 | 49 | - repo: https://github.com/doublify/pre-commit-rust 50 | rev: eeee35a89e69d5772bdee97db1a6a898467b686e # frozen: v1.0 51 | hooks: 52 | - id: fmt 53 | - id: cargo-check 54 | 55 | # lint python formatting 56 | - repo: https://github.com/psf/black 57 | rev: 05f0a8ce1f71fbb36e1e032d3b518c7b945089a2 # frozen: 25.11.0 58 | hooks: 59 | - id: black 60 | 61 | - repo: https://github.com/pycqa/flake8 62 | rev: "d93590f5be797aabb60e3b09f2f52dddb02f349f" # frozen: 7.3.0 63 | hooks: 64 | - id: flake8 65 | args: ["--extend-ignore=W503,W504,E501"] 66 | -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Deploy 3 | 4 | on: 5 | workflow_dispatch: 6 | inputs: 7 | reason: 8 | required: true 9 | description: "Reason for running this workflow" 10 | use_test_image: 11 | required: false 12 | type: boolean 13 | description: "Use base image testpr" 14 | default: false 15 | 16 | # Set workflow-wide environment variables 17 | # - REPO: repo name on dockerhub 18 | # - IMAGE: image name on dockerhub 19 | env: 20 | GHCR_IMAGE: ${{ github.repository }} 21 | GHCR_REGISTRY: ghcr.io 22 | 23 | jobs: 24 | workflow-dispatch: 25 | name: Triggered via Workflow Dispatch? 26 | # only run this step if workflow dispatch triggered 27 | # log the reason the workflow dispatch was triggered 28 | if: | 29 | github.event_name == 'workflow_dispatch' && 30 | github.event.inputs.reason != '' 31 | runs-on: ubuntu-22.04 32 | steps: 33 | - name: Log dispatch reason 34 | env: 35 | INPUTS_REASON: ${{ github.event.inputs.reason }} 36 | INPUTS_USE_TEST_IMAGE: ${{ github.event.inputs.use_test_image }} 37 | run: | 38 | echo "Workflow dispatch reason: $INPUTS_REASON" 39 | echo "Use test image: $INPUTS_USE_TEST_IMAGE" 40 | 41 | hadolint: 42 | name: Run hadolint against docker files 43 | runs-on: ubuntu-22.04 44 | steps: 45 | - uses: actions/checkout@v6.0.1 46 | - name: Pull hadolint/hadolint:latest Image 47 | run: docker pull hadolint/hadolint:latest 48 | - name: Run hadolint against Dockerfiles 49 | run: docker run --rm -i -v "$PWD":/workdir --workdir /workdir --entrypoint hadolint hadolint/hadolint --ignore DL3003 --ignore DL3006 --ignore DL3010 --ignore DL4001 --ignore DL3007 --ignore DL3008 --ignore SC2068 --ignore DL3007 --ignore SC1091 --ignore DL3013 --ignore DL3010 $(find . -type f -iname "Dockerfile*") 50 | 51 | build_and_push: 52 | name: Image Build & Push 53 | uses: sdr-enthusiasts/common-github-workflows/.github/workflows/sdre.yml@main 54 | needs: [hadolint] 55 | with: 56 | push_enabled: true 57 | push_destinations: ghcr.io 58 | ghcr_repo_owner: ${{ github.repository_owner }} 59 | ghcr_repo: ${{ github.repository }} 60 | # set build_latest to true if github.event.inputs.use_test_image is false 61 | build_latest: ${{ github.event.inputs.use_test_image == 'false' || github.event.inputs.use_test_image == '' }} 62 | build_baseimage_test: ${{ github.event.inputs.use_test_image == 'true' }} 63 | build_baseimage_url: :base/:base-test-pr 64 | secrets: 65 | ghcr_token: ${{ secrets.GITHUB_TOKEN }} 66 | -------------------------------------------------------------------------------- /rootfs/etc/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | # /etc/nginx/nginx.conf 2 | 3 | user flightairmap; 4 | 5 | pid /var/run/nginx.pid; 6 | 7 | # Set number of worker processes automatically based on number of CPU cores. 8 | worker_processes auto; 9 | 10 | # Enables the use of JIT for regular expressions to speed-up their processing. 11 | pcre_jit on; 12 | 13 | # Includes files with directives to load dynamic modules. 14 | include /etc/nginx/modules/*.conf; 15 | 16 | 17 | events { 18 | # The maximum number of simultaneous connections that can be opened by 19 | # a worker process. 20 | worker_connections 1024; 21 | } 22 | 23 | http { 24 | # Includes mapping of file name extensions to MIME types of responses 25 | # and defines the default type. 26 | include /etc/nginx/mime.types; 27 | default_type application/octet-stream; 28 | 29 | # Log to stdout 30 | access_log /dev/stdout; 31 | error_log /dev/stdout info; 32 | 33 | # Name servers used to resolve names of upstream servers into addresses. 34 | # It's also needed when using tcpsocket and udpsocket in Lua modules. 35 | #resolver 208.67.222.222 208.67.220.220; 36 | 37 | # Don't tell nginx version to clients. 38 | server_tokens off; 39 | 40 | # Specifies the maximum accepted body size of a client request, as 41 | # indicated by the request header Content-Length. If the stated content 42 | # length is greater than this size, then the client receives the HTTP 43 | # error code 413. Set to 0 to disable. 44 | client_max_body_size 1m; 45 | 46 | # Timeout for keep-alive connections. Server will close connections after 47 | # this time. 48 | keepalive_timeout 65; 49 | 50 | # Sendfile copies data between one FD and other from within the kernel, 51 | # which is more efficient than read() + write(). 52 | sendfile on; 53 | 54 | # Don't buffer data-sends (disable Nagle algorithm). 55 | # Good for sending frequent small bursts of data in real time. 56 | tcp_nodelay on; 57 | 58 | # Causes nginx to attempt to send its HTTP response head in one packet, 59 | # instead of using partial frames. 60 | #tcp_nopush on; 61 | 62 | 63 | # Path of the file with Diffie-Hellman parameters for EDH ciphers. 64 | #ssl_dhparam /etc/ssl/nginx/dh2048.pem; 65 | 66 | # Specifies that our cipher suits should be preferred over client ciphers. 67 | # ssl_prefer_server_ciphers on; 68 | 69 | # Enables a shared SSL cache with size that can hold around 8000 sessions. 70 | # ssl_session_cache shared:SSL:2m; 71 | 72 | 73 | # Enable gzipping of responses. 74 | #gzip on; 75 | 76 | # Set the Vary HTTP header as defined in the RFC 2616. 77 | gzip_vary on; 78 | 79 | # Enable checking the existence of precompressed files. 80 | #gzip_static on; 81 | 82 | 83 | # Specifies the main log format. 84 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 85 | '$status $body_bytes_sent "$http_referer" ' 86 | '"$http_user_agent" "$http_x_forwarded_for"'; 87 | 88 | # Includes virtual hosts configs. 89 | include /etc/nginx/conf.d/*.conf; 90 | } 91 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ghcr.io/sdr-enthusiasts/docker-baseimage:base 2 | 3 | ENV BASESTATIONPORT="30003" \ 4 | FAM_BINGKEY="" \ 5 | FAM_BITLYACCESSTOKENAPI="" \ 6 | FAM_BRITISHAIRWAYSAPIKEY="" \ 7 | FAM_CORSPROXY="https://galvanize-cors-proxy.herokuapp.com/" \ 8 | FAM_FLIGHTAWAREPASSWORD="" \ 9 | FAM_FLIGHTAWAREUSERNAME="" \ 10 | FAM_GEOID_SOURCE="egm96-15" \ 11 | FAM_GLOBALSITENAME="My FlightAirMap Site" \ 12 | FAM_GOOGLEKEY="" \ 13 | FAM_GRAPHHOPPERAPIKEY="" \ 14 | FAM_HEREAPPCODE="" \ 15 | FAM_HEREAPPID="" \ 16 | FAM_LANGUAGE="EN" \ 17 | FAM_LATITUDECENTER="46.38" \ 18 | FAM_LATITUDEMAX="46.92" \ 19 | FAM_LATITUDEMIN="42.14" \ 20 | FAM_LIVEZOOM="9" \ 21 | FAM_LONGITUDECENTER="5.29" \ 22 | FAM_LONGITUDEMAX="6.2" \ 23 | FAM_LONGITUDEMIN="1.0" \ 24 | FAM_LUFTHANSAKEY="" \ 25 | FAM_LUFTHANSASECRET="" \ 26 | FAM_MAPBOXID="examples.map-i86nkdio" \ 27 | FAM_MAPBOXTOKEN="" \ 28 | FAM_MAPMATCHINGSOURCE="fam" \ 29 | FAM_MAPPROVIDER="OpenStreetMap" \ 30 | FAM_MAPQUESTKEY="" \ 31 | FAM_METARSOURCE="" \ 32 | FAM_NOTAMSOURCE="" \ 33 | FAM_OPENWEATHERMAPKEY="" \ 34 | FAM_SAILAWAYEMAIL="" \ 35 | FAM_SAILAWAYKEY="" \ 36 | FAM_SAILAWAYPASSWORD="" \ 37 | FAM_SQUAWK_COUNTRY="EU" \ 38 | MYSQLDATABASE=flightairmap \ 39 | MYSQLUSERNAME=flightairmap \ 40 | MYSQLPORT=3306 \ 41 | S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \ 42 | TZ=UTC \ 43 | WEBUSER=flightairmap \ 44 | QUIET_FAM=true 45 | 46 | SHELL ["/bin/bash", "-o", "pipefail", "-c"] 47 | 48 | # hadolint ignore=DL3008,SC2086,SC2039,SC2068 49 | RUN set -x && \ 50 | apt-get update -y && \ 51 | apt-get install -y --no-install-recommends \ 52 | ca-certificates \ 53 | curl \ 54 | file \ 55 | git \ 56 | html2text \ 57 | jq \ 58 | locales \ 59 | procps \ 60 | socat \ 61 | wget \ 62 | pwgen \ 63 | mariadb-client \ 64 | && \ 65 | useradd -d "/home/${WEBUSER}" -m -r -U "${WEBUSER}" && \ 66 | echo "========== Setup locales ==========" && \ 67 | echo "en_US ISO-8859-1" >> /etc/locale.gen && \ 68 | echo "de_DE ISO-8859-1" >> /etc/locale.gen && \ 69 | echo "es_ES ISO-8859-1" >> /etc/locale.gen && \ 70 | echo "fr_FR ISO-8859-1" >> /etc/locale.gen && \ 71 | locale-gen && \ 72 | echo "========== Deploy php ==========" && \ 73 | apt-get install software-properties-common ca-certificates lsb-release apt-transport-https gpg-agent -y --no-install-recommends && \ 74 | sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' && \ 75 | wget -qO - https://packages.sury.org/php/apt.gpg | apt-key add - && \ 76 | apt-get update -y && \ 77 | apt-get install -y --no-install-recommends \ 78 | php7.4 \ 79 | php7.4-curl \ 80 | php7.4-fpm \ 81 | php7.4-gd \ 82 | php7.4-gettext \ 83 | php7.4-json \ 84 | php7.4-mysql \ 85 | php7.4-xml \ 86 | php7.4-zip \ 87 | && \ 88 | sed -i '/;error_log/c\error_log = /proc/self/fd/2' /etc/php/7.4/fpm/php-fpm.conf && \ 89 | mkdir -p /run/php && \ 90 | #rm -vrf /etc/php/8.2/fpm/pool.d/* && \ 91 | echo "========== Deploy nginx ==========" && \ 92 | apt-get install -y --no-install-recommends \ 93 | nginx-light && \ 94 | rm -vf /etc/nginx/conf.d/default.conf && \ 95 | rm -vrf /var/www/* && \ 96 | usermod -aG www-data "${WEBUSER}" && \ 97 | echo "========== Deploy FlightAirMap ==========" && \ 98 | git clone --recursive https://github.com/Ysurac/FlightAirMap /var/www/flightairmap/htdocs && \ 99 | pushd /var/www/flightairmap/htdocs && \ 100 | cp -v /var/www/flightairmap/htdocs/install/flightairmap-nginx-conf.include /etc/nginx/flightairmap-nginx-conf.include && \ 101 | chown -vR "${WEBUSER}":"${WEBUSER}" /var/www/flightairmap && \ 102 | { git log | head -1 | tr -s " " "_" | tee /VERSION || true; } && \ 103 | rm -rf /var/www/flightairmap/htdocs/.git && \ 104 | echo "========== Clean up ==========" && \ 105 | apt-get autoremove -q -o APT::Autoremove::RecommendsImportant=0 -o APT::Autoremove::SuggestsImportant=0 -y \ 106 | file \ 107 | git \ 108 | && \ 109 | bash /scripts/clean-build.sh && \ 110 | rm -rf /var/lib/apt/lists/* /tmp/* /src 111 | 112 | # Copy config files 113 | COPY rootfs/ / 114 | 115 | EXPOSE 80 116 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/scripts/03-settings: -------------------------------------------------------------------------------- 1 | #!/command/with-contenv /bin/bash 2 | #shellcheck shell=bash 3 | 4 | #shellcheck disable=SC1091 5 | source /scripts/common 6 | 7 | NOCOLOR='\033[0m' 8 | LIGHTCYAN='\033[1;36m' 9 | 10 | echo "" 11 | echo -e "${LIGHTCYAN}Writing environment variables into require/settings.php...${NOCOLOR}" 12 | 13 | # If no install password given, generate a random one. User can always pull it from settings.php. 14 | if [ -z "${FAM_INSTALLPASSWORD}" ]; then 15 | FAM_INSTALLPASSWORD="$(pwgen -cns 30 999 | tail -1)" 16 | fi 17 | 18 | # Set database to mysql 19 | search="\$globalDBdriver = '" 20 | replace="\$globalDBdriver = 'mysql';" 21 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 22 | 23 | # Set database hostname 24 | if [ -z "${MYSQLHOSTNAME}" ]; then 25 | # if using local database 26 | search="\$globalDBhost = '" 27 | replace="\$globalDBhost = 'localhost';" 28 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 29 | else 30 | # if using external database 31 | search="\$globalDBhost = '" 32 | replace="\$globalDBhost = '${MYSQLHOSTNAME}';" 33 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 34 | fi 35 | 36 | # Set database username 37 | search="\$globalDBuser = '" 38 | replace="\$globalDBuser = '${MYSQLUSERNAME}';" 39 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 40 | 41 | # Set database password 42 | if [ -n "${MYSQLHOSTNAME}" ]; then 43 | # if using external database 44 | search="\$globalDBpass = '" 45 | replace="\$globalDBpass = '${MYSQLPASSWORD}';" 46 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 47 | fi 48 | 49 | # Set database name 50 | search="\$globalDBname = '" 51 | replace="\$globalDBname = '${MYSQLDATABASE}';" 52 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 53 | 54 | # Set database port 55 | search="\$globalDBport = '" 56 | replace="\$globalDBport = '${MYSQLPORT}';" 57 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 58 | 59 | # Set database transaction support 60 | search="\$globalTransaction = '" 61 | replace="\$globalTransaction = TRUE;" 62 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 63 | 64 | search="\$globalInstalled = FALSE;" 65 | replace="\$globalInstalled = TRUE;" 66 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 67 | 68 | 69 | # Remove any encasing quotes in FAM_INSTALLPASSWORD 70 | if echo "${FAM_INSTALLPASSWORD}" | grep -P '^".*"$'; then 71 | FAM_INSTALLPASSWORD=${FAM_INSTALLPASSWORD:1:-1} 72 | fi 73 | 74 | # Set install password 75 | search="\$globalInstallPassword = '" 76 | replace="\$globalInstallPassword = '${FAM_INSTALLPASSWORD}';" 77 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 78 | 79 | search="\$globalName = '" 80 | replace="\$globalName = '${FAM_GLOBALSITENAME}';" 81 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 82 | 83 | search="\$globalLanguage = '" 84 | replace="\$globalLanguage = '${FAM_LANGUAGE}';" 85 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 86 | 87 | search="\$globalMapProvider = '" 88 | replace="\$globalMapProvider = '${FAM_MAPPROVIDER}'; // Can be Mapbox, OpenStreetMap, MapQuest-OSM or MapQuest-Aerial" 89 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 90 | 91 | search="\$globalMapboxId = '" 92 | replace="\$globalMapboxId = '${FAM_MAPBOXID}'; // Mapbox id" 93 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 94 | 95 | search="\$globalMapboxToken = '" 96 | replace="\$globalMapboxToken = '${FAM_MAPBOXTOKEN}'; // Mapbox token" 97 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 98 | 99 | search="\$globalGoogleAPIKey = '" 100 | replace="\$globalGoogleAPIKey = '${FAM_GOOGLEKEY}';" 101 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 102 | 103 | search="\$globalBingMapKey = '" 104 | replace="\$globalBingMapKey = '${FAM_BINGKEY}';" 105 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 106 | 107 | search="\$globalHereappID = '" 108 | replace="\$globalHereappID = '${FAM_HEREAPPID}';" 109 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 110 | 111 | search="\$globalHereappCode = '" 112 | replace="\$globalHereappCode = '${FAM_HEREAPPCODE}';" 113 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 114 | 115 | search="\$globalMapQuestKey = '" 116 | replace="\$globalMapQuestKey = '${FAM_MAPQUESTKEY}';" 117 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 118 | 119 | search="\$globalOpenWeatherMapKey = '" 120 | replace="\$globalOpenWeatherMapKey = '${FAM_OPENWEATHERMAPKEY}';" 121 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 122 | 123 | search="\$globalLatitudeMax = '" 124 | replace="\$globalLatitudeMax = '${FAM_LATITUDEMAX}';" 125 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 126 | 127 | search="\$globalLatitudeMin = '" 128 | replace="\$globalLatitudeMin = '${FAM_LATITUDEMIN}';" 129 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 130 | 131 | search="\$globalLongitudeMax = '" 132 | replace="\$globalLongitudeMax = '${FAM_LONGITUDEMAX}';" 133 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 134 | 135 | search="\$globalLongitudeMin = '" 136 | replace="\$globalLongitudeMin = '${FAM_LONGITUDEMIN}';" 137 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 138 | 139 | search="\$globalCenterLatitude = '" 140 | replace="\$globalCenterLatitude = '${FAM_LATITUDECENTER}';" 141 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 142 | 143 | search="\$globalCenterLongitude = '" 144 | replace="\$globalCenterLongitude = '${FAM_LONGITUDECENTER}';" 145 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 146 | 147 | search="\$globalLiveZoom = '" 148 | replace="\$globalLiveZoom = '${FAM_LIVEZOOM}';" 149 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 150 | 151 | search="\$globalSquawkCountry = '" 152 | replace="\$globalSquawkCountry = '${FAM_SQUAWK_COUNTRY}';" 153 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 154 | 155 | search="\$globalSailaway = array('" 156 | replace="\$globalSailaway = array('email' => '${FAM_SAILAWAYEMAIL}','password' => '${FAM_SAILAWAYPASSWORD}','key' => '${FAM_SAILAWAYKEY}');" 157 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 158 | 159 | search="\$globalBritishAirwaysKey = '" 160 | replace="\$globalBritishAirwaysKey = '${FAM_BRITISHAIRWAYSAPIKEY}';" 161 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 162 | 163 | search="\$globalCORSproxy = '" 164 | replace="\$globalCORSproxy = '${FAM_CORSPROXY}';" 165 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 166 | 167 | search="\$globalLufthansaKey = array('" 168 | replace="\$globalLufthansaKey = array('key' => '${FAM_LUFTHANSAKEY}','secret' => '${FAM_LUFTHANSASECRET}');" 169 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 170 | 171 | search="\$globalFlightAwareUsername = '" 172 | replace="\$globalFlightAwareUsername = '${FAM_FLIGHTAWAREUSERNAME}'; //FlightAware Username" 173 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 174 | 175 | search="\$globalFlightAwarePassword = '" 176 | replace="\$globalFlightAwarePassword = '${FAM_FLIGHTAWAREPASSWORD}'; //FlightAware Password/API key" 177 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 178 | 179 | search="\$globalMapMatchingSource = '" 180 | replace="\$globalMapMatchingSource = '${FAM_MAPMATCHINGSOURCE}';" 181 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 182 | 183 | search="\$globalGraphHopperKey = '" 184 | replace="\$globalGraphHopperKey = '${FAM_GRAPHHOPPERAPIKEY}';" 185 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 186 | 187 | search="\$globalNOTAMSource = '" 188 | replace="\$globalNOTAMSource = '${FAM_NOTAMSOURCE}';" 189 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 190 | 191 | search="\$globalMETARurl = '" 192 | replace="\$globalMETARurl = '${FAM_METARSOURCE}';" 193 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 194 | 195 | search="\$globalBitlyAccessToken = '" 196 | replace="\$globalBitlyAccessToken = '${FAM_BITLYACCESSTOKENAPI}'; //the access token from the bit.ly API" 197 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 198 | 199 | search="\$globalGeoidSource = '" 200 | replace="\$globalGeoidSource = '${FAM_GEOID_SOURCE}';" 201 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 202 | 203 | if chk_enabled "${FAM_ENABLE_ACARS}"; then 204 | search="\$globalACARS = FALSE;" 205 | replace="\$globalACARS = TRUE;" 206 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 207 | fi 208 | 209 | if [[ -n "${FAM_GLOBAL_URL}" ]]; then 210 | search="\$globalURL = '" 211 | replace="\$globalURL = '${FAM_GLOBAL_URL}';" 212 | sed -i "/${search}/c\\${replace}" /var/www/flightairmap/htdocs/require/settings.php 213 | fi 214 | 215 | echo "" 216 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/scripts/02-firstrun: -------------------------------------------------------------------------------- 1 | #!/command/with-contenv /bin/bash 2 | #shellcheck shell=bash 3 | 4 | if [ -n "${VERBOSE_LOGGING}" ]; then 5 | set -x 6 | fi 7 | 8 | NOCOLOR='\033[0m' 9 | LIGHTGREEN='\033[1;32m' 10 | LIGHTCYAN='\033[1;36m' 11 | LIGHTRED='\033[1;31m' 12 | # YELLOW='\033[1;33m' 13 | 14 | if [ -n "${MYSQLHOSTNAME}" ]; then 15 | # if using external database 16 | echo "Waiting for database..." 17 | while : 18 | do 19 | if mysqladmin \ 20 | --host="${MYSQLHOSTNAME}" \ 21 | --port="${MYSQLPORT}" \ 22 | --user="${MYSQLUSERNAME}" \ 23 | --password="${MYSQLPASSWORD}" \ 24 | status > /dev/null 2>&1; then 25 | echo "" 26 | break 27 | fi 28 | echo -n "." 29 | sleep 1 30 | done 31 | echo "Database ready." 32 | fi 33 | 34 | # Only run the following commands if using local database 35 | if [ -z "${MYSQLHOSTNAME}" ]; then 36 | # Check if the flightairmap database exists 37 | # Start mysqld without permissions 38 | /usr/sbin/mysqld --skip-networking --console --log-error='' --skip-grant-tables --silent-startup --user=root & 39 | # Wait for mysqld to init 40 | while : 41 | do 42 | if mysqladmin status > /dev/null 2>&1; then 43 | break 44 | fi 45 | sleep 0.5 46 | done 47 | fi 48 | 49 | # See if flightairmap database exists 50 | if [ -z "${MYSQLHOSTNAME}" ]; then 51 | # if using local database 52 | if mysqlshow "${MYSQLDATABASE}" > /dev/null 2>&1; then 53 | # if it does, do nothing 54 | mysqladmin shutdown 55 | exit 0 56 | fi 57 | else 58 | # if using external database 59 | NUMTABLES=$(mysqlanalyze \ 60 | --host="${MYSQLHOSTNAME}" \ 61 | --port="${MYSQLPORT}" \ 62 | --user="${MYSQLUSERNAME}" \ 63 | --password="${MYSQLPASSWORD}" \ 64 | "${MYSQLDATABASE}" | wc -l) 65 | if [ "$NUMTABLES" -gt 0 ]; then 66 | # if it does, do nothing 67 | exit 0 68 | fi 69 | fi 70 | 71 | # if it doesn't, then do the first run tasks 72 | echo -e "${LIGHTCYAN}" 73 | echo "New installation detected. Performing first-run tasks..." 74 | echo "This takes a very long time, please be patient!" 75 | echo -e "${NOCOLOR}" 76 | 77 | # Start temporary services 78 | echo -e "${LIGHTCYAN}Starting temporary services... ${NOCOLOR}" 79 | 80 | if [ -z "${MYSQLHOSTNAME}" ]; then 81 | # if using local database 82 | # Generate random passwords 83 | MYSQLROOTPASSWORD="$(pwgen -cns 30 999 | tail -1)" 84 | MYSQLPASSWORD="$(pwgen -cns 30 999 | tail -1)" 85 | 86 | mysqladmin shutdown 87 | /usr/sbin/mysqld --console --log-error='' --silent-startup --user=root & 88 | # Wait for mysqld to init 89 | echo "Waiting for database..." 90 | while : 91 | do 92 | if mysqladmin status > /dev/null 2>&1; then 93 | echo "" 94 | break 95 | fi 96 | echo -n "." 97 | sleep 1 98 | done 99 | echo "Database ready." 100 | fi 101 | 102 | # temporarily disable nginx logging 103 | sed -i 's/access_log\ \/dev\/stdout\;/#&/' /etc/nginx/nginx.conf 104 | sed -i 's/error_log\ \/dev\/stdout/#&/' /etc/nginx/nginx.conf 105 | 106 | # Start temporary services 107 | /usr/sbin/php-fpm7.4 --daemonize 108 | /usr/sbin/nginx -g "daemon on; error_log /dev/null crit;" 109 | 110 | # re-enable nginx access log 111 | sed -i '/#access_log\ \/dev\/stdout\;/s/#//' /etc/nginx/nginx.conf 112 | sed -i '/#error_log\ \/dev\/stdout/s/#//' /etc/nginx/nginx.conf 113 | 114 | # if using local database 115 | if [ -z "${MYSQLHOSTNAME}" ]; then 116 | # Set mysql root password 117 | mysqladmin -u root password "${MYSQLROOTPASSWORD}" 118 | mysql -u root -D mysql --password="${MYSQLROOTPASSWORD}" -e "GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ;" 119 | mysql -u root -D mysql --password="${MYSQLROOTPASSWORD}" -e "FLUSH PRIVILEGES ;" 120 | fi 121 | 122 | ########## Running install/index.php ########## 123 | echo -e "${LIGHTCYAN}Running install/index.php${NOCOLOR}" 124 | 125 | # Initial visit to install/index.php to set up session cookie 126 | curl 'http://127.0.0.1/install/index.php' \ 127 | -v \ 128 | --cookie-jar /tmp/install_process_cookies \ 129 | --compressed > /tmp/curl_install_01.log 2>&1 130 | 131 | # If no install password given, generate a random one. User can always pull it from settings.php. 132 | if [ -z "${FAM_INSTALLPASSWORD}" ]; then 133 | FAM_INSTALLPASSWORD="$(pwgen -cns 30 999 | tail -1)" 134 | fi 135 | 136 | # Prepare install/index.php POST data 137 | INSTALLPOSTDATA="installpass=" 138 | INSTALLPOSTDATA+=$(php -r "echo urlencode('$FAM_INSTALLPASSWORD');") 139 | INSTALLPOSTDATA+="&dbtype=mysql" 140 | if [ -z "${MYSQLHOSTNAME}" ]; then 141 | # if using local database 142 | INSTALLPOSTDATA+="&createdb=createdb" 143 | fi 144 | INSTALLPOSTDATA+="&dbroot=" 145 | if [ -z "${MYSQLHOSTNAME}" ]; then 146 | # if using local database 147 | INSTALLPOSTDATA+=$(php -r "echo urlencode('root');") 148 | fi 149 | INSTALLPOSTDATA+="&dbrootpass=" 150 | if [ -z "${MYSQLHOSTNAME}" ]; then 151 | # if using local database 152 | INSTALLPOSTDATA+=$(php -r "echo urlencode('$MYSQLROOTPASSWORD');") 153 | fi 154 | INSTALLPOSTDATA+="&dbhost=" 155 | if [ -z "${MYSQLHOSTNAME}" ]; then 156 | # if using local database 157 | INSTALLPOSTDATA+=$(php -r "echo urlencode('localhost');") 158 | else 159 | # if using external database 160 | INSTALLPOSTDATA+=$(php -r "echo urlencode('$MYSQLHOSTNAME');") 161 | fi 162 | INSTALLPOSTDATA+="&dbport=" 163 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${MYSQLPORT}');") 164 | INSTALLPOSTDATA+="&dbname=" 165 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${MYSQLDATABASE}');") 166 | INSTALLPOSTDATA+="&dbuser=" 167 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${MYSQLUSERNAME}');") 168 | INSTALLPOSTDATA+="&dbuserpass=" 169 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${MYSQLPASSWORD}');") 170 | INSTALLPOSTDATA+="&sitename=" 171 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_GLOBALSITENAME}');") 172 | INSTALLPOSTDATA+="&siteurl=&timezone=" 173 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${TZ}');") 174 | INSTALLPOSTDATA+="&language=" 175 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_LANGUAGE}');") 176 | INSTALLPOSTDATA+="&mapprovider=" 177 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_MAPPROVIDER}');") 178 | INSTALLPOSTDATA+="&mapboxid=" 179 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_MAPBOXID}');") 180 | INSTALLPOSTDATA+="&mapboxtoken=" 181 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_MAPBOXTOKEN}');") 182 | INSTALLPOSTDATA+="&googlekey=" 183 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_GOOGLEKEY}');") 184 | INSTALLPOSTDATA+="&bingkey=" 185 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_BINGKEY}');") 186 | INSTALLPOSTDATA+="&mapquestkey=" 187 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_MAPQUESTKEY}');") 188 | INSTALLPOSTDATA+="&hereappid=" 189 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_HEREAPPID}');") 190 | INSTALLPOSTDATA+="&hereappcode=" 191 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_HEREAPPCODE}');") 192 | INSTALLPOSTDATA+="&openweathermapkey=" 193 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_OPENWEATHERMAPKEY}');") 194 | INSTALLPOSTDATA+="&latitudemax=" 195 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_LATITUDEMAX}');") 196 | INSTALLPOSTDATA+="&latitudemin=" 197 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_LATITUDEMIN}');") 198 | INSTALLPOSTDATA+="&longitudemax=" 199 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_LONGITUDEMAX}');") 200 | INSTALLPOSTDATA+="&longitudemin=" 201 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_LONGITUDEMIN}');") 202 | INSTALLPOSTDATA+="&latitudecenter=" 203 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_LATITUDECENTER}');") 204 | INSTALLPOSTDATA+="&longitudecenter=" 205 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_LONGITUDECENTER}');") 206 | INSTALLPOSTDATA+="&livezoom=" 207 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_LIVEZOOM}');") 208 | INSTALLPOSTDATA+="&squawk_country=" 209 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_SQUAWK_COUNTRY}');") 210 | INSTALLPOSTDATA+="&zoilatitude=&zoilongitude=&zoidistance=&source_name%5B%5D=&source_latitude%5B%5D=&source_longitude%5B%5D=&source_altitude%5B%5D=&source_city%5B%5D=&source_country%5B%5D=&source_ref%5B%5D=&globalaircraft=aircraft&globalsbs=sbs&sailawayemail=" 211 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_SAILAWAYEMAIL}');") 212 | INSTALLPOSTDATA+="&sailawaypassword=" 213 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_SAILAWAYPASSWORD}');") 214 | INSTALLPOSTDATA+="&sailawaykey=" 215 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_SAILAWAYKEY}');") 216 | INSTALLPOSTDATA+="&host%5B%5D=127.0.0.1&port%5B%5D=30003&format%5B%5D=auto&name%5B%5D=&timezones%5B%5D=UTC&host%5B%5D=&port%5B%5D=&format%5B%5D=auto&name%5B%5D=&timezones%5B%5D=UTC&acarshost=0.0.0.0&acarsport=9999&newsurl%5B%5D=&newslang%5B%5D=en&newstype%5B%5D=global&crash=crash&map3d=map3d&map3dtileset=&map3dshadows=map3dshadows&corsproxy=https%3A%2F%2Fgalvanize-cors-proxy.herokuapp.com%2F&translate=translate&estimation=estimation&unitdistance=km&unitaltitude=m&unitspeed=kmh&schedules=schedules&britishairways=" 217 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_BRITISHAIRWAYSAPIKEY}');") 218 | INSTALLPOSTDATA+="&corsproxy=" 219 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_CORSPROXY}');") 220 | INSTALLPOSTDATA+="&lufthansakey=" 221 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_LUFTHANSAKEY}');") 222 | INSTALLPOSTDATA+="&lufthansasecret=" 223 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_LUFTHANSASECRET}');") 224 | INSTALLPOSTDATA+="&flightawareusername=" 225 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_FLIGHTAWAREUSERNAME}');") 226 | INSTALLPOSTDATA+="&flightawarepassword=" 227 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_FLIGHTAWAREPASSWORD}');") 228 | INSTALLPOSTDATA+="&mapmatchingsource=" 229 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_MAPMATCHINGSOURCE}');") 230 | INSTALLPOSTDATA+="&graphhopper=" 231 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_GRAPHHOPPERAPIKEY}');") 232 | INSTALLPOSTDATA+="¬am=notam¬amsource=" 233 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_NOTAMSOURCE}');") 234 | INSTALLPOSTDATA+="&metar=metar&metarcycle=metarcycle&metarsource=" 235 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_METARSOURCE}');") 236 | INSTALLPOSTDATA+="&bitly=" 237 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_BITLYACCESSTOKENAPI}');") 238 | INSTALLPOSTDATA+="&waypoints=waypoints&geoid=geoid&geoid_source=" 239 | INSTALLPOSTDATA+=$(php -r "echo urlencode('${FAM_GEOID_SOURCE}');") 240 | INSTALLPOSTDATA+="&resetyearstats=1&archiveresults=archiveresults&archivemonths=0&archivekeepmonths=0&archivekeeptrackmonths=0&daemon=daemon&cronend=0&colormap=colormap&flightroute=flightroute&flightremainingroute=flightremainingroute&allflights=allflights&refresh=200&maprefresh=30&mapidle=30&minfetch=50&closestmindist=50&aircraftsize=&airportzoom=7&customcss=&submit=Create%2FUpdate+database+%26+write+setup" 241 | 242 | # Mimic filling out install/index.php form and submitting 243 | curl 'http://127.0.0.1/install/index.php' \ 244 | -v \ 245 | --cookie /tmp/install_process_cookies \ 246 | --cookie-jar /tmp/install_process_cookies \ 247 | --compressed \ 248 | -H 'Referer: http://127.0.0.1/install/index.php' \ 249 | -H 'Connection: keep-alive' \ 250 | -H 'Content-Type: application/x-www-form-urlencoded' \ 251 | --data "${INSTALLPOSTDATA}" > /tmp/curl_install_02.log 2>&1 252 | 253 | # Get the next location from the output of previous command 254 | NEXTLOCATION=$(grep -oP "window\.location\s+=\s+'.*'" /tmp/curl_install_02.log | cut -d "'" -f 2) 255 | 256 | # Visit the next location 257 | curl "http://127.0.0.1/install/${NEXTLOCATION}" \ 258 | -v \ 259 | --cookie /tmp/install_process_cookies \ 260 | --cookie-jar /tmp/install_process_cookies \ 261 | -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' \ 262 | --compressed \ 263 | -H 'Connection: keep-alive' \ 264 | -H 'Referer: http://127.0.0.1/install/index.php' >> /tmp/curl_install_03.log 2>&1 265 | 266 | # Wait for the install to finish... 267 | while : 268 | do 269 | 270 | # Get JSON status of install, output to temp file 271 | if [ -n "${VERBOSE_LOGGING}" ]; then 272 | date 273 | curl 'http://127.0.0.1/install/install-action.php' \ 274 | --verbose \ 275 | --progress-bar \ 276 | --cookie /tmp/install_process_cookies \ 277 | --cookie-jar /tmp/install_process_cookies \ 278 | -H 'Accept: application/json, text/javascript, */*; q=0.01' \ 279 | -H "Referer: http://127.0.0.1/install/${NEXTLOCATION}" \ 280 | --compressed \ 281 | -H 'X-Requested-With: XMLHttpRequest' \ 282 | -H 'Connection: keep-alive' \ 283 | --cookie-jar /tmp/install_process_cookies > /tmp/install_process_status_json 284 | date 285 | echo "Response JSON:" 286 | cat /tmp/install_process_status_json 287 | echo "End response JSON." 288 | else 289 | curl 'http://127.0.0.1/install/install-action.php' \ 290 | --silent \ 291 | --cookie /tmp/install_process_cookies \ 292 | --cookie-jar /tmp/install_process_cookies \ 293 | -H 'Accept: application/json, text/javascript, */*; q=0.01' \ 294 | -H "Referer: http://127.0.0.1/install/${NEXTLOCATION}" \ 295 | --compressed \ 296 | -H 'X-Requested-With: XMLHttpRequest' \ 297 | -H 'Connection: keep-alive' \ 298 | --cookie-jar /tmp/install_process_cookies > /tmp/install_process_status_json 299 | fi 300 | 301 | # # check to make sure the json is valid 302 | # if ! jq "." < /tmp/install_process_status_json > /dev/null 2>&1; then 303 | # echo "" 304 | # echo -e "${YELLOW}WARNING: Invalid JSON returned:${NOCOLOR}" 305 | # cat /tmp/install_process_status_json 306 | # echo "" 307 | # echo -e "${YELLOW}Attempting to continue...${NOCOLOR}" 308 | # echo "" 309 | # break 310 | # fi 311 | 312 | # Get info from json 313 | INSTALLERROR=$(jq ".error" < /tmp/install_process_status_json) 314 | INSTALLNEXT=$(jq ".next" < /tmp/install_process_status_json) 315 | INSTALLPHASE=$(jq ".install" < /tmp/install_process_status_json) 316 | 317 | # Check for errors with install 318 | if [ "${INSTALLERROR}" = '""' ] 319 | then 320 | 321 | # If no error, then print status and wait until finished 322 | echo -e "${LIGHTCYAN} - Installation status: ${INSTALLPHASE} / ${INSTALLNEXT}${NOCOLOR}" 323 | if [ "$INSTALLNEXT" = '"finish"' ] 324 | then 325 | if [ "$INSTALLPHASE" = '"finish"' ] 326 | then 327 | echo -e "${LIGHTCYAN}Running install/index.php completed successfully!${NOCOLOR}" 328 | break 329 | fi 330 | fi 331 | 332 | else 333 | # If error, output json and exit 334 | jq "." < /tmp/install_process_status_json 335 | echo "" 336 | echo -e "${LIGHTRED}${INSTALLERROR}${NOCOLOR}" 337 | echo "" 338 | exit 1 339 | fi 340 | 341 | sleep 1 342 | done 343 | 344 | # Get final status of install 345 | curl 'http://127.0.0.1/install/index.php?next=finish' \ 346 | --silent \ 347 | --cookie /tmp/install_process_cookies \ 348 | --cookie-jar /tmp/install_process_cookies \ 349 | -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' \ 350 | --compressed \ 351 | -H 'Connection: keep-alive' \ 352 | -H "Referer: http://127.0.0.1/install/${NEXTLOCATION}" > /tmp/curl_install_04.log 353 | 354 | # Output status of install 355 | html2text /tmp/curl_install_04.log | grep "\* " 356 | 357 | # Initial run of scripts/update_db.php 358 | echo -e "${LIGHTCYAN}Performing first-run of scripts/update_db.php, this will take a very long time...${NOCOLOR}" 359 | s6-setuidgid "${WEBUSER}" php /var/www/flightairmap/htdocs/scripts/update_db.php 2>&1 | \ 360 | mawk -W Interactive '! / Parameter must be an array or an object that implements Countable in /' 361 | 362 | # Stop temporary services 363 | echo -e "${LIGHTCYAN} - Stopping temporary services... ${NOCOLOR}" 364 | pkill nginx 365 | pkill php-fpm 366 | # if using local database 367 | if [ -z "${MYSQLHOSTNAME}" ]; then 368 | mysqladmin -u root --password="${MYSQLROOTPASSWORD}" shutdown 369 | fi 370 | 371 | echo -e "${LIGHTGREEN}First-run tasks finished OK (finally!)...${NOCOLOR}" 372 | echo "" 373 | -------------------------------------------------------------------------------- /rootfs/etc/php/7.4/fpm/pool.d/flightairmap.conf: -------------------------------------------------------------------------------- 1 | ; Start a new pool named 'www'. 2 | ; the variable $pool can be used in any directive and will be replaced by the 3 | ; pool name ('www' here) 4 | [flightairmap] 5 | 6 | ; Per pool prefix 7 | ; It only applies on the following directives: 8 | ; - 'access.log' 9 | ; - 'slowlog' 10 | ; - 'listen' (unixsocket) 11 | ; - 'chroot' 12 | ; - 'chdir' 13 | ; - 'php_values' 14 | ; - 'php_admin_values' 15 | ; When not set, the global prefix (or /usr) applies instead. 16 | ; Note: This directive can also be relative to the global prefix. 17 | ; Default Value: none 18 | ;prefix = /path/to/pools/$pool 19 | 20 | ; Unix user/group of processes 21 | ; Note: The user is mandatory. If the group is not set, the default user's group 22 | ; will be used. 23 | user = flightairmap 24 | group = flightairmap 25 | 26 | ; The address on which to accept FastCGI requests. 27 | ; Valid syntaxes are: 28 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on 29 | ; a specific port; 30 | ; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on 31 | ; a specific port; 32 | ; 'port' - to listen on a TCP socket to all addresses 33 | ; (IPv6 and IPv4-mapped) on a specific port; 34 | ; '/path/to/unix/socket' - to listen on a unix socket. 35 | ; Note: This value is mandatory. 36 | listen = 127.0.0.1:9000 37 | 38 | ; Set listen(2) backlog. 39 | ; Default Value: 511 (-1 on FreeBSD and OpenBSD) 40 | ;listen.backlog = 511 41 | 42 | ; Set permissions for unix socket, if one is used. In Linux, read/write 43 | ; permissions must be set in order to allow connections from a web server. Many 44 | ; BSD-derived systems allow connections regardless of permissions. 45 | ; Default Values: user and group are set as the running user 46 | ; mode is set to 0660 47 | ;listen.owner = nobody 48 | ;listen.group = nobody 49 | ;listen.mode = 0660 50 | ; When POSIX Access Control Lists are supported you can set them using 51 | ; these options, value is a comma separated list of user/group names. 52 | ; When set, listen.owner and listen.group are ignored 53 | ;listen.acl_users = 54 | ;listen.acl_groups = 55 | 56 | ; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. 57 | ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original 58 | ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address 59 | ; must be separated by a comma. If this value is left blank, connections will be 60 | ; accepted from any ip address. 61 | ; Default Value: any 62 | ;listen.allowed_clients = 127.0.0.1 63 | 64 | ; Specify the nice(2) priority to apply to the pool processes (only if set) 65 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 66 | ; Note: - It will only work if the FPM master process is launched as root 67 | ; - The pool processes will inherit the master process priority 68 | ; unless it specified otherwise 69 | ; Default Value: no set 70 | ; process.priority = -19 71 | 72 | ; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user 73 | ; or group is different than the master process user. It allows to create process 74 | ; core dump and ptrace the process for the pool user. 75 | ; Default Value: no 76 | ; process.dumpable = yes 77 | 78 | ; Choose how the process manager will control the number of child processes. 79 | ; Possible Values: 80 | ; static - a fixed number (pm.max_children) of child processes; 81 | ; dynamic - the number of child processes are set dynamically based on the 82 | ; following directives. With this process management, there will be 83 | ; always at least 1 children. 84 | ; pm.max_children - the maximum number of children that can 85 | ; be alive at the same time. 86 | ; pm.start_servers - the number of children created on startup. 87 | ; pm.min_spare_servers - the minimum number of children in 'idle' 88 | ; state (waiting to process). If the number 89 | ; of 'idle' processes is less than this 90 | ; number then some children will be created. 91 | ; pm.max_spare_servers - the maximum number of children in 'idle' 92 | ; state (waiting to process). If the number 93 | ; of 'idle' processes is greater than this 94 | ; number then some children will be killed. 95 | ; ondemand - no children are created at startup. Children will be forked when 96 | ; new requests will connect. The following parameter are used: 97 | ; pm.max_children - the maximum number of children that 98 | ; can be alive at the same time. 99 | ; pm.process_idle_timeout - The number of seconds after which 100 | ; an idle process will be killed. 101 | ; Note: This value is mandatory. 102 | pm = dynamic 103 | 104 | ; The number of child processes to be created when pm is set to 'static' and the 105 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 106 | ; This value sets the limit on the number of simultaneous requests that will be 107 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 108 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 109 | ; CGI. The below defaults are based on a server without much resources. Don't 110 | ; forget to tweak pm.* to fit your needs. 111 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 112 | ; Note: This value is mandatory. 113 | pm.max_children = 5 114 | 115 | ; The number of child processes created on startup. 116 | ; Note: Used only when pm is set to 'dynamic' 117 | ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 118 | pm.start_servers = 2 119 | 120 | ; The desired minimum number of idle server processes. 121 | ; Note: Used only when pm is set to 'dynamic' 122 | ; Note: Mandatory when pm is set to 'dynamic' 123 | pm.min_spare_servers = 1 124 | 125 | ; The desired maximum number of idle server processes. 126 | ; Note: Used only when pm is set to 'dynamic' 127 | ; Note: Mandatory when pm is set to 'dynamic' 128 | pm.max_spare_servers = 3 129 | 130 | ; The number of seconds after which an idle process will be killed. 131 | ; Note: Used only when pm is set to 'ondemand' 132 | ; Default Value: 10s 133 | ;pm.process_idle_timeout = 10s; 134 | 135 | ; The number of requests each child process should execute before respawning. 136 | ; This can be useful to work around memory leaks in 3rd party libraries. For 137 | ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. 138 | ; Default Value: 0 139 | ;pm.max_requests = 500 140 | 141 | ; The URI to view the FPM status page. If this value is not set, no URI will be 142 | ; recognized as a status page. It shows the following information: 143 | ; pool - the name of the pool; 144 | ; process manager - static, dynamic or ondemand; 145 | ; start time - the date and time FPM has started; 146 | ; start since - number of seconds since FPM has started; 147 | ; accepted conn - the number of request accepted by the pool; 148 | ; listen queue - the number of request in the queue of pending 149 | ; connections (see backlog in listen(2)); 150 | ; max listen queue - the maximum number of requests in the queue 151 | ; of pending connections since FPM has started; 152 | ; listen queue len - the size of the socket queue of pending connections; 153 | ; idle processes - the number of idle processes; 154 | ; active processes - the number of active processes; 155 | ; total processes - the number of idle + active processes; 156 | ; max active processes - the maximum number of active processes since FPM 157 | ; has started; 158 | ; max children reached - number of times, the process limit has been reached, 159 | ; when pm tries to start more children (works only for 160 | ; pm 'dynamic' and 'ondemand'); 161 | ; Value are updated in real time. 162 | ; Example output: 163 | ; pool: www 164 | ; process manager: static 165 | ; start time: 01/Jul/2011:17:53:49 +0200 166 | ; start since: 62636 167 | ; accepted conn: 190460 168 | ; listen queue: 0 169 | ; max listen queue: 1 170 | ; listen queue len: 42 171 | ; idle processes: 4 172 | ; active processes: 11 173 | ; total processes: 15 174 | ; max active processes: 12 175 | ; max children reached: 0 176 | ; 177 | ; By default the status page output is formatted as text/plain. Passing either 178 | ; 'html', 'xml' or 'json' in the query string will return the corresponding 179 | ; output syntax. Example: 180 | ; http://www.foo.bar/status 181 | ; http://www.foo.bar/status?json 182 | ; http://www.foo.bar/status?html 183 | ; http://www.foo.bar/status?xml 184 | ; 185 | ; By default the status page only outputs short status. Passing 'full' in the 186 | ; query string will also return status for each pool process. 187 | ; Example: 188 | ; http://www.foo.bar/status?full 189 | ; http://www.foo.bar/status?json&full 190 | ; http://www.foo.bar/status?html&full 191 | ; http://www.foo.bar/status?xml&full 192 | ; The Full status returns for each process: 193 | ; pid - the PID of the process; 194 | ; state - the state of the process (Idle, Running, ...); 195 | ; start time - the date and time the process has started; 196 | ; start since - the number of seconds since the process has started; 197 | ; requests - the number of requests the process has served; 198 | ; request duration - the duration in µs of the requests; 199 | ; request method - the request method (GET, POST, ...); 200 | ; request URI - the request URI with the query string; 201 | ; content length - the content length of the request (only with POST); 202 | ; user - the user (PHP_AUTH_USER) (or '-' if not set); 203 | ; script - the main script called (or '-' if not set); 204 | ; last request cpu - the %cpu the last request consumed 205 | ; it's always 0 if the process is not in Idle state 206 | ; because CPU calculation is done when the request 207 | ; processing has terminated; 208 | ; last request memory - the max amount of memory the last request consumed 209 | ; it's always 0 if the process is not in Idle state 210 | ; because memory calculation is done when the request 211 | ; processing has terminated; 212 | ; If the process is in Idle state, then information are related to the 213 | ; last request the process has served. Otherwise information are related to 214 | ; the current request being served. 215 | ; Example output: 216 | ; ************************ 217 | ; pid: 31330 218 | ; state: Running 219 | ; start time: 01/Jul/2011:17:53:49 +0200 220 | ; start since: 63087 221 | ; requests: 12808 222 | ; request duration: 1250261 223 | ; request method: GET 224 | ; request URI: /test_mem.php?N=10000 225 | ; content length: 0 226 | ; user: - 227 | ; script: /home/fat/web/docs/php/test_mem.php 228 | ; last request cpu: 0.00 229 | ; last request memory: 0 230 | ; 231 | ; Note: There is a real-time FPM status monitoring sample web page available 232 | ; It's available in: /usr/share/php7/fpm/status.html 233 | ; 234 | ; Note: The value must start with a leading slash (/). The value can be 235 | ; anything, but it may not be a good idea to use the .php extension or it 236 | ; may conflict with a real PHP file. 237 | ; Default Value: not set 238 | ;pm.status_path = /status 239 | 240 | ; The ping URI to call the monitoring page of FPM. If this value is not set, no 241 | ; URI will be recognized as a ping page. This could be used to test from outside 242 | ; that FPM is alive and responding, or to 243 | ; - create a graph of FPM availability (rrd or such); 244 | ; - remove a server from a group if it is not responding (load balancing); 245 | ; - trigger alerts for the operating team (24/7). 246 | ; Note: The value must start with a leading slash (/). The value can be 247 | ; anything, but it may not be a good idea to use the .php extension or it 248 | ; may conflict with a real PHP file. 249 | ; Default Value: not set 250 | ;ping.path = /ping 251 | 252 | ; This directive may be used to customize the response of a ping request. The 253 | ; response is formatted as text/plain with a 200 response code. 254 | ; Default Value: pong 255 | ;ping.response = pong 256 | 257 | ; The access log file 258 | ; Default: not set 259 | ;access.log = log/php7/$pool.access.log 260 | 261 | ; The access log format. 262 | ; The following syntax is allowed 263 | ; %%: the '%' character 264 | ; %C: %CPU used by the request 265 | ; it can accept the following format: 266 | ; - %{user}C for user CPU only 267 | ; - %{system}C for system CPU only 268 | ; - %{total}C for user + system CPU (default) 269 | ; %d: time taken to serve the request 270 | ; it can accept the following format: 271 | ; - %{seconds}d (default) 272 | ; - %{milliseconds}d 273 | ; - %{mili}d 274 | ; - %{microseconds}d 275 | ; - %{micro}d 276 | ; %e: an environment variable (same as $_ENV or $_SERVER) 277 | ; it must be associated with embraces to specify the name of the env 278 | ; variable. Some examples: 279 | ; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e 280 | ; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e 281 | ; %f: script filename 282 | ; %l: content-length of the request (for POST request only) 283 | ; %m: request method 284 | ; %M: peak of memory allocated by PHP 285 | ; it can accept the following format: 286 | ; - %{bytes}M (default) 287 | ; - %{kilobytes}M 288 | ; - %{kilo}M 289 | ; - %{megabytes}M 290 | ; - %{mega}M 291 | ; %n: pool name 292 | ; %o: output header 293 | ; it must be associated with embraces to specify the name of the header: 294 | ; - %{Content-Type}o 295 | ; - %{X-Powered-By}o 296 | ; - %{Transfert-Encoding}o 297 | ; - .... 298 | ; %p: PID of the child that serviced the request 299 | ; %P: PID of the parent of the child that serviced the request 300 | ; %q: the query string 301 | ; %Q: the '?' character if query string exists 302 | ; %r: the request URI (without the query string, see %q and %Q) 303 | ; %R: remote IP address 304 | ; %s: status (response code) 305 | ; %t: server time the request was received 306 | ; it can accept a strftime(3) format: 307 | ; %d/%b/%Y:%H:%M:%S %z (default) 308 | ; The strftime(3) format must be encapsuled in a %{}t tag 309 | ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t 310 | ; %T: time the log has been written (the request has finished) 311 | ; it can accept a strftime(3) format: 312 | ; %d/%b/%Y:%H:%M:%S %z (default) 313 | ; The strftime(3) format must be encapsuled in a %{}t tag 314 | ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t 315 | ; %u: remote user 316 | ; 317 | ; Default: "%R - %u %t \"%m %r\" %s" 318 | ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" 319 | 320 | ; The log file for slow requests 321 | ; Default Value: not set 322 | ; Note: slowlog is mandatory if request_slowlog_timeout is set 323 | ;slowlog = log/php7/$pool.slow.log 324 | 325 | ; The timeout for serving a single request after which a PHP backtrace will be 326 | ; dumped to the 'slowlog' file. A value of '0s' means 'off'. 327 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 328 | ; Default Value: 0 329 | ;request_slowlog_timeout = 0 330 | 331 | ; Depth of slow log stack trace. 332 | ; Default Value: 20 333 | ;request_slowlog_trace_depth = 20 334 | 335 | ; The timeout for serving a single request after which the worker process will 336 | ; be killed. This option should be used when the 'max_execution_time' ini option 337 | ; does not stop script execution for some reason. A value of '0' means 'off'. 338 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 339 | ; Default Value: 0 340 | ;request_terminate_timeout = 0 341 | 342 | ; The timeout set by 'request_terminate_timeout' ini option is not engaged after 343 | ; application calls 'fastcgi_finish_request' or when application has finished and 344 | ; shutdown functions are being called (registered via register_shutdown_function). 345 | ; This option will enable timeout limit to be applied unconditionally 346 | ; even in such cases. 347 | ; Default Value: no 348 | ;request_terminate_timeout_track_finished = no 349 | 350 | ; Set open file descriptor rlimit. 351 | ; Default Value: system defined value 352 | ;rlimit_files = 1024 353 | 354 | ; Set max core size rlimit. 355 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 356 | ; Default Value: system defined value 357 | ;rlimit_core = 0 358 | 359 | ; Chroot to this directory at the start. This value must be defined as an 360 | ; absolute path. When this value is not set, chroot is not used. 361 | ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one 362 | ; of its subdirectories. If the pool prefix is not set, the global prefix 363 | ; will be used instead. 364 | ; Note: chrooting is a great security feature and should be used whenever 365 | ; possible. However, all PHP paths will be relative to the chroot 366 | ; (error_log, sessions.save_path, ...). 367 | ; Default Value: not set 368 | ;chroot = 369 | 370 | ; Chdir to this directory at the start. 371 | ; Note: relative path can be used. 372 | ; Default Value: current directory or / when chroot 373 | ;chdir = /var/www 374 | 375 | ; Redirect worker stdout and stderr into main error log. If not set, stdout and 376 | ; stderr will be redirected to /dev/null according to FastCGI specs. 377 | ; Note: on highloaded environment, this can cause some delay in the page 378 | ; process time (several ms). 379 | ; Default Value: no 380 | ;catch_workers_output = yes 381 | 382 | ; Decorate worker output with prefix and suffix containing information about 383 | ; the child that writes to the log and if stdout or stderr is used as well as 384 | ; log level and time. This options is used only if catch_workers_output is yes. 385 | ; Settings to "no" will output data as written to the stdout or stderr. 386 | ; Default value: yes 387 | ;decorate_workers_output = no 388 | 389 | ; Clear environment in FPM workers 390 | ; Prevents arbitrary environment variables from reaching FPM worker processes 391 | ; by clearing the environment in workers before env vars specified in this 392 | ; pool configuration are added. 393 | ; Setting to "no" will make all environment variables available to PHP code 394 | ; via getenv(), $_ENV and $_SERVER. 395 | ; Default Value: yes 396 | ;clear_env = no 397 | 398 | ; Limits the extensions of the main script FPM will allow to parse. This can 399 | ; prevent configuration mistakes on the web server side. You should only limit 400 | ; FPM to .php extensions to prevent malicious users to use other extensions to 401 | ; execute php code. 402 | ; Note: set an empty value to allow all extensions. 403 | ; Default Value: .php 404 | ;security.limit_extensions = .php .php3 .php4 .php5 .php7 405 | 406 | ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from 407 | ; the current environment. 408 | ; Default Value: clean env 409 | ;env[HOSTNAME] = $HOSTNAME 410 | ;env[PATH] = /usr/local/bin:/usr/bin:/bin 411 | ;env[TMP] = /tmp 412 | ;env[TMPDIR] = /tmp 413 | ;env[TEMP] = /tmp 414 | 415 | ; Additional php.ini defines, specific to this pool of workers. These settings 416 | ; overwrite the values previously defined in the php.ini. The directives are the 417 | ; same as the PHP SAPI: 418 | ; php_value/php_flag - you can set classic ini defines which can 419 | ; be overwritten from PHP call 'ini_set'. 420 | ; php_admin_value/php_admin_flag - these directives won't be overwritten by 421 | ; PHP call 'ini_set' 422 | ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. 423 | 424 | ; Defining 'extension' will load the corresponding shared extension from 425 | ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not 426 | ; overwrite previously defined php.ini values, but will append the new value 427 | ; instead. 428 | 429 | ; Note: path INI options can be relative and will be expanded with the prefix 430 | ; (pool, global or /usr) 431 | 432 | ; Default Value: nothing is defined by default except the values in php.ini and 433 | ; specified at startup with the -d argument 434 | ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com 435 | ;php_flag[display_errors] = off 436 | ;php_admin_value[error_log] = /var/log/php7/$pool.error.log 437 | ;php_admin_flag[log_errors] = on 438 | ;php_admin_value[memory_limit] = 32M 439 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mikenye/flightairmap 2 | 3 | Docker container for [FlightAirMap](http://flightairmap.com). 4 | 5 | Builds and runs on x86_64, arm32v7 and arm64v8 6 | 7 | --- 8 | 9 | FlightAirMap is a fork of [barriespotter/Web_App](https://github.com/barriespotter/Web_App) with map, airspaces, PDO and ADS-B support. 10 | 11 | Browse through the data based on a particular aircraft, airline or airport or search through the database. See extensive statistics such as most common aircraft type, airline, departure & arrival airport and busiest time of the day, or just explore flights. 12 | 13 | Flights are displayed on 2D or 3D map with layer from : OpenStreetMap, Mapbox, MapQuest, Yandex, Bing, Google,... 14 | 15 | Satellites can also be displayed on 3D map. 16 | 17 | FlightAirMap also support marine (via AIS) and trackers. 18 | 19 | You MUST have a source. No default sources are provided. 20 | 21 | It can use as source ADS-B extended with format tsv, SBS (port 30003), raw (alpha support), VRS (aircraftlist.json), deltadb.txt from Radarcape and IVAO with format from phpVMS (/action.php/acars/data), whazzup, Virtual Airlines Manager,... 22 | 23 | It also support glidernet APRS source. 24 | 25 | This container is designed to work in conjunction with a Mode-S / BEAST provider. Check out https://sdr-enthusiasts.gitbook.io/ads-b/ for this. 26 | It's easiest to place the services in the same yml file as ultrafeeder to provide connectivity via docker networking. 27 | 28 | --- 29 | 30 | ## Container notes 31 | 32 | On the first run of the container, the database will be created & populated and data will be downloaded from the internet. This process can take quite some time. On my system, around 30 minutes. Once the first run processes are finished, to access FlightAirMap, you can: 33 | 34 | - Browse to `http://dockerhost:8087/` to access the FlightAirMap GUI. 35 | - Browse to `http://dockerhost:8087/install/` to access the FlightAirMap settings area. (not supported, use env vars) 36 | 37 | With regards to settings - where one exists, you should use an environment variable to set your desired setting. The environment variables get written to the `require/settings.php` file on container start, so any configuration items applied via `/install/` area may be overwritten. Long story short, your first port of call for configuration should be environment variables. 38 | 39 | ## Quick Start with `docker-compose` using external database 40 | 41 | **NOTE**: The Docker command provided in this quick start is given as an example and parameters should be adjusted to suit your needs. 42 | 43 | An example `docker-compose.yml` file is as follows: 44 | 45 | ```yaml 46 | services: 47 | flightairmap_db: 48 | image: lscr.io/linuxserver/mariadb:latest 49 | container_name: flightairmap_db 50 | restart: unless-stopped 51 | environment: 52 | - PUID=0 53 | - PGID=0 54 | - MYSQL_ROOT_PASSWORD=shai5Eisah7phe0aic5foote 55 | - MYSQL_DATABASE=flightairmap 56 | - MYSQL_USER=flightairmap 57 | - TZ=${FEEDER_TZ} 58 | - MYSQL_PASSWORD=xi6Paig4yeitae3Pah9aew3j 59 | volumes: 60 | - ./fam_db:/config 61 | 62 | flightairmap: 63 | image: ghcr.io/sdr-enthusiasts/docker-flightairmap:latest 64 | container_name: flightairmap 65 | restart: unless-stopped 66 | ports: 67 | - 8087:80 68 | environment: 69 | - TZ=${FEEDER_TZ} 70 | - BASESTATIONHOST=ultrafeeder 71 | - FAM_INSTALLPASSWORD="very_secure_password_12345" 72 | - MYSQLHOSTNAME=flightairmap_db 73 | - MYSQLDATABASE=flightairmap 74 | - MYSQLUSERNAME=flightairmap 75 | - MYSQLPASSWORD=xi6Paig4yeitae3Pah9aew3j 76 | - MYSQLROOTPASSWORD=shai5Eisah7phe0aic5foote 77 | depends_on: 78 | - flightairmap_db 79 | ``` 80 | 81 | ### Environment Variables 82 | 83 | To customize some properties of the container, the following environment 84 | variables can be passed via the `-e` parameter (one for each variable). Value 85 | of this parameter has the format `=`. 86 | 87 | | Name | Description | Default | Required | 88 | | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | --------- | 89 | | `TZ` | Your local timezone in "TZ database name" format [List-of-tz-database-time-zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). | `UTC` | Optional. | 90 | | `FAM_INSTALLPASSWORD` | Sets the `$globalInstallPassword` variable in `require/settings.php`. The password to access the install area. If not given, a randomly password will be generated and used. To obtain the generated password, you can issue the command `docker exec flightairmap cat /var/www/flightairmap/htdocs/require/settings.php \| grep globalInstallPassword`. | `unset` | Optional | 91 | | `BASESTATIONHOST` | You can specify the IP or hostname of a host/container running `readsb` or `dump1090`. See [sdre-enthusiasts/docker-readsb-protobuf](https://github.com/sdr-enthusiasts/docker-readsb-protobuf/). If given, FlightAirMap will pull ADS-B data from the specified host/container. Without this, you'll need to set up your own sources via the install area. | `unset` | Optional | 92 | | `BASESTATIONPORT` | If your `readsb` or `dump1090` is running on a non-standard TCP port, you can change it here. | `30003` | Optional | 93 | | `QUIET_FAM` | If set to `true`, will suppress the output of FAM in the logs. | `true` | Optional | 94 | | `FAM_GLOBALSITENAME` | Sets the `$globalName` variable in `require/settings.php`.The name of your site | `My FlightAirMap Site` | Optional | 95 | | `FAM_LANGUAGE` | Sets the `$globalLanguage` variable in `require/settings.php`. Interface language. Can be set to `EN`, `DE` or `FR` | `EN` | Optional | 96 | | `FAM_MAPPROVIDER` | Sets the `$globalMapProvider` variable in `require/settings.php`. Can be `Mapbox`, `OpenStreetMap`, `MapQuest-OSM` or `MapQuest-Aerial` | `OpenStreetMap` | Optional | 97 | | `FAM_MAPBOXID` | Sets the `$globalMapboxId` variable in `require/settings.php` | `examples.map-i86nkdio` | Optional | 98 | | `FAM_MAPBOXTOKEN` | Sets the `$globalMapboxToken` variable in `require/settings.php` | `unset` | Optional | 99 | | `FAM_GOOGLEKEY` | Sets the `$globalGoogleAPIKey` variable in `require/settings.php` | `unset` | Optional | 100 | | `FAM_BINGKEY` | Sets the `$globalBingMapKey` variable in `require/settings.php` | `unset` | Optional | 101 | | `FAM_MAPQUESTKEY` | Sets the `$globalMapQuestKey` variable in `require/settings.php` | `unset` | Optional | 102 | | `FAM_HEREAPPID` | Sets the `$globalHereappID` variable in `require/settings.php` | `unset` | Optional | 103 | | `FAM_HEREAPPCODE` | Sets the `$globalHereappCode` variable in `require/settings.php` | `unset` | Optional | 104 | | `FAM_OPENWEATHERMAPKEY` | Sets the `$globalOpenWeatherMapKey` variable in `require/settings.php` | `unset` | Optional | 105 | | `FAM_LATITUDEMAX` | Sets the `$globalLatitudeMax` variable in `require/settings.php` | `46.92` | Optional | 106 | | `FAM_LATITUDEMIN` | Sets the `$globalLatitudeMin` variable in `require/settings.php` | 42.14` | Optional | 107 | | `FAM_LONGITUDEMAX` | Sets the `$globalLongitudeMax` variable in `require/settings.php` | `6.2` | Optional | 108 | | `FAM_LONGITUDEMIN` | Sets the `$globalLongitudeMin` variable in `require/settings.php` | `1.0` | Optional | 109 | | `FAM_LATITUDECENTER` | Sets the `$globalCenterLatitude` variable in `require/settings.php` | `46.38` | Optional | 110 | | `FAM_LONGITUDECENTER` | Sets the `$globalCenterLongitude` variable in `require/settings.php` | `5.29` | Optional | 111 | | `FAM_LIVEZOOM` | Sets the `$globalLiveZoom` variable in `require/settings.php` | `9` | Optional | 112 | | `FAM_SQUAWK_COUNTRY` | Sets the `$globalSquawkCountry` variable in `require/settings.php`. Can be set to `UK`, `NZ`, `US`, `AU`, `NL`, `FR` or `TR` | `EU` | Optional | 113 | | `FAM_SAILAWAYEMAIL` | Sets the `$globalSailaway` array's `email` value in `require/settings.php` | `unset` | Optional | 114 | | `FAM_SAILAWAYPASSWORD` | Sets the `$globalSailaway` array's `password` value in `require/settings.php` | `unset` | Optional | 115 | | `FAM_SAILAWAYKEY` | Sets the `$globalSailaway` array's `key` value in `require/settings.php` | `unset` | Optional | 116 | | `FAM_BRITISHAIRWAYSAPIKEY` | Sets the `$globalBritishAirwaysKey` variable in `require/settings.php` | `unset` | Optional | 117 | | `FAM_CORSPROXY` | Sets the `$globalCORSproxy` variable in `require/settings.php` | [cors](https://galvanize-cors-proxy.herokuapp.com/) | Optional | 118 | | `FAM_LUFTHANSAKEY` | Sets the `$globalLufthansaKey` array's `key` value in `require/settings.php` | `unset` | Optional | 119 | | `FAM_LUFTHANSASECRET` | Sets the `$globalLufthansaKey` array's `secret` value in `require/settings.php` | `unset` | Optional | 120 | | `FAM_FLIGHTAWAREUSERNAME` | Sets the `$globalFlightAwareUsername` variable in `require/settings.php` | `unset` | Optional | 121 | | `FAM_FLIGHTAWAREPASSWORD` | Sets the `$globalFlightAwarePassword` variable in `require/settings.php` | `unset` | Optional | 122 | | `FAM_MAPMATCHINGSOURCE` | Sets the `$globalMapMatchingSource` variable in `require/settings.php` | `fam` | Optional | 123 | | `FAM_GRAPHHOPPERAPIKEY` | Sets the `$globalGraphHopperKey` variable in `require/settings.php` | `unset` | Optional | 124 | | `FAM_NOTAMSOURCE` | Sets the `$globalNOTAMSource` variable in `require/settings.php` | `unset` | Optional | 125 | | `FAM_METARSOURCE` | Sets the `$globalMETARurl` variable in `require/settings.php` | `unset` | Optional | 126 | | `FAM_BITLYACCESSTOKENAPI` | Sets the `$globalBitlyAccessToken` variable in `require/settings.php` | `unset` | Optional | 127 | | `FAM_GEOID_SOURCE` | Sets the `$globalGeoidSource` variable in `require/settings.php` | `egm96-15` | Optional | 128 | | `FAM_ENABLE_ACARS` | Sets the `$globalACARS` variable in `require/settings.php` | `false` | Optional | 129 | | `FAM_GLOBAL_URL` | Sets the `$globalURL` variable in `require/settings.php`. Default is unset. Sets the URL pathing for asset requests. Useful for running FAM behind a proxy. No trailing `/` | `unset` | Optional | 130 | 131 | If you wish to use an external database: 132 | 133 | | Name | Description | Default | Required | 134 | | --------------- | --------------------------------------------------- | --------------- | -------------------------------------------------------- | 135 | | `MYSQLHOSTNAME` | Sets the hostname of the mysql/mariadb server. | `unset` | Required for external databases, else please leave unset | 136 | | `MYSQLPORT` | Sets the port used to communicate to mysql/mariadb. | `3306` | Required for external databases, else please leave unset | 137 | | `MYSQLDATABASE` | Sets the mysql/mariadb database name. | `flightairmap`. | Required for external databases, else please leave unset | 138 | | `MYSQLUSERNAME` | Sets the mysql/mariadb user name. | `flightairmap`. | Required for external databases, else please leave unset | 139 | | `MYSQLPASSWORD` | Sets the mysql/mariadb password. | `unset` | Required for external databases, else please leave unset | 140 | 141 | ### Ports 142 | 143 | Here is the list of ports used by the container. They can be mapped to the host 144 | via the `-p` parameter (one per port mapping). Each mapping is defined in the 145 | following format: `:`. The port number inside the 146 | ainer cannot be changed, but you are free to use any port on the host side. 147 | 148 | | Container Port | Purpose | 149 | | -------------- | -------------------------------------------------------------------------------------------------------- | 150 | | 80 (tcp) | FlightAirMap application, web server | 151 | | 9999 (udp) | [ACARS UDP Messages](https://github.com/valeriosouza/FlightAirMap#acars-only-messages-from-real-flights) | 152 | 153 | ## Getting Help 154 | 155 | Having troubles with the container or have questions? Please [create a new issue](https://github.com/sdr-enthusiasts/docker-flightairmap/issues). 156 | 157 | I also have a [Discord channel](https://discord.gg/sTf9uYF), feel free to [join](https://discord.gg/sTf9uYF) and converse. 158 | --------------------------------------------------------------------------------