diff --git a/README.md b/README.md index abfb013..a26bb4f 100644 --- a/README.md +++ b/README.md @@ -108,15 +108,24 @@ Version: '5.6.46' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Comm To connect to the database, you can run a local mysql client if you already have one installed. You can use Docker to connect to the database. The commands required are long and tedious, so create a shell alias for it. Substitute your values for the password and other configurable settings into the aliases below and run these at a shell prompt: + ```shell -alias mysql-freezing='docker run -it --rm --network=host mysql:8.0 mysql --host=127.0.0.1 --port=3306 --user=freezing --password=please-change-me-as-this-is-a-default --database=freezing --default-character-set=utf8mb4' -alias mysql-freezing-non-interactive='docker run -i --rm --network=host mysql:8.0 mysql --host=127.0.0.1 --port=3306 --user=freezing --password=please-change-me-as-this-is-a-default --database=freezing --default-character-set=utf8mb4' -alias mysql-freezing-dump='docker run -i --rm --network=host mysql:8.0 mysqldump --host=127.0.0.1 --port=3306 --user=root --password=terrible-root-password-which-should-be-changed freezing --default-character-set=utf8mb4' -alias mysql-freezing-root='docker run -it --rm --network=host mysql:8.0 mysql --host=127.0.0.1 --port=3306 --user=root --password=terrible-root-password-which-should-be-changed --database=freezing --default-character-set=utf8mb4' -alias mysql-freezing-root-non-interactive='docker run -i --rm --network=host mysql:8.0 mysql --host=127.0.0.1 --port=3306 --user=root --password=terrible-root-password-which-should-be-changed --database=freezing --default-character-set=utf8mb4' +export MYSQL_VERSION=8.0 +export MYSQL_HOST=localhost +export MYSQL_PORT=3306 +export MYSQL_USER=freezing +export MYSQL_PASSWORD="please-change-me-as-this-is-a-default" +export MYSQL_ROOT_USER=root +export MYSQL_ROOT_PASSWORD="terrible-root-password-which-should-be-changed" +export MYSQL_DATABASE=freezing +alias mysqldump-freezing='docker run -i --rm --network=host mysql:$MYSQL_VERSION mysqldump --host=$MYSQL_HOST --port=$MYSQL_PORT --user=$MYSQL_ROOT_USER --password="$MYSQL_ROOT_PASSWORD" $MYSQL_DATABASE --default-character-set=utf8mb4' +alias mysql-freezing='docker run -it --rm --volume $HOME/.mysql_history:/root/.mysql_history --network=host mysql:$MYSQL_VERSION mysql --host=$MYSQL_HOST --port=$MYSQL_PORT --user=$MYSQL_USER --password="$MYSQL_PASSWORD" --database=$MYSQL_DATABASE --default-character-set=utf8mb4' +alias mysql-freezing-non-interactive='docker run -i --rm --volume $HOME/.mysql_history:/root/.mysql_history --network=host mysql:$MYSQL_VERSION mysql --host=$MYSQL_HOST --port=$MYSQL_PORT --user=$MYSQL_USER --password="$MYSQL_PASSWORD" --database=$MYSQL_DATABASE --default-character-set=utf8mb4' +alias mysql-freezing-root='docker run -it --rm --volume $HOME/.mysql_history:/root/.mysql_history --network=host mysql:$MYSQL_VERSION mysql --host=$MYSQL_HOST --port=$MYSQL_PORT --user=$MYSQL_ROOT_USER --password="$MYSQL_ROOT_PASSWORD" --database=$MYSQL_DATABASE --default-character-set=utf8mb4' +alias mysql-freezing-non-interactive-root='docker run -i --rm --volume $HOME/.mysql_history:/root/.mysql_history --network=host mysql:$MYSQL_VERSION mysql --host=$MYSQL_HOST --port=$MYSQL_PORT --user=$MYSQL_ROOT_USER --password="$MYSQL_ROOT_PASSWORD" --database=$MYSQL_DATABASE --default-character-set=utf8mb4' ``` -You can put these aliases in your `$HOME/.profile` or `$HOME/.bashrc` files to make them stick. +You can put these aliases in your shell configuration files such as `$HOME/.profile` or `$HOME/.bashrc` files to make them stick. ```shell $  mysql-freezing @@ -346,14 +355,13 @@ The current production setup assumes that you will use an external MySQL server, ### 2.1 Clone Repository -Clone the repository this repository onto a server that runs Docker and `docker-compose`. [freezingsaddles.org](https://freezingsaddles.org/) has run on CoreOS since 2018 but works but any modern operating system distribution that has Docker support will probably work. That includes CentOS 7 and 8, Ubuntu 16.04 and 18.04, and many others. +Clone the repository this repository onto a server that runs Docker and `docker-compose`. [freezingsaddles.org](https://freezingsaddles.org/) ran on CoreOS from 2018 to 2020, and today runs on Rocky Linux 9. Ths should works but any modern operating system distribution that has Docker support will probably work. That includes RHEL 7+ and open source derivatives such as Centos, Rocky Linux and Alma Linux, all Ubuntu LTS versions from 16.04 on, and so on. For example: ```shell -sudo git clone https://github.com/freezingsaddles/freezing-compose /opt/compose -# Change ownership back to your regular user so you can update it -sudo chown -R $(id -u):$(id -g) /opt/compose +git clone https://github.com/freezingsaddles/freezing-compose +ln -s "$PWD/freezing-compose" /opt/compose ``` ### 2.2 Create Persistent Docker Volumes diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index aba5c7a..048d449 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -40,12 +40,12 @@ services: # Thanks Javier Arias & Stack Overflow https://stackoverflow.com/a/50529359 command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci'] # yamllint disable-line rule:line-length environment: + MYSQL_DATABASE: ${MYSQL_DATABASE:-freezing} MYSQL_HOST: ${MYSQL_HOST:-mysql} + MYSQL_PASSWORD: ${MYSQL_PASSWORD:-please-change-me-as-this-is-a-default} MYSQL_PORT: ${MYSQL_PORT:-3306} MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-terrible-root-password-which-should-be-changed} # yamllint disable-line rule:line-length - MYSQL_DATABASE: ${MYSQL_DATABASE:-freezing} MYSQL_USER: ${MYSQL_USER:-freezing} - MYSQL_PASSWORD: ${MYSQL_PASSWORD:-please-change-me-as-this-is-a-default} #### Freezing Saddles containers @@ -57,6 +57,9 @@ services: BEANSTALKD_PORT: ${BEANSTALKD_PORT:-11300} MYSQL_HOST: ${MYSQL_HOST:-mysql} MYSQL_PORT: ${MYSQL_HOST:-3306} + #SQLALCHEMY_SILENCE_UBER_WARNING: ${SQLALCHEMY_SILENCE_UBER_WARNING:-0} + SQLALCHEMY_URL: ${SQLALCHEMY_URL} + SQLALCHEMY_WARN_20: ${SQLALCHEMY_WARN_20:-1} depends_on: - beanstalkd - mysql @@ -76,19 +79,21 @@ services: ports: - 8000:8000 environment: + COMPETITION_TITLE: ${COMPETITION_TITLE} + DEBUG: ${DEBUG} + END_DATE: ${END_DATE} ENVIRONMENT: ${ENVIRONMENT} - VIRTUAL_HOST: ${FREEZING_WEB_FQDN} - LETSENCRYPT_HOST: ${FREEZING_WEB_FQDN} LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL} + LETSENCRYPT_HOST: ${FREEZING_WEB_FQDN} + MAIN_TEAM: ${MAIN_TEAM} + OBSERVER_TEAMS: ${OBSERVER_TEAMS} SECRET_KEY: ${SECRET_KEY} - DEBUG: ${DEBUG} + #SQLALCHEMY_SILENCE_UBER_WARNING: ${SQLALCHEMY_SILENCE_UBER_WARNING:-0} SQLALCHEMY_URL: ${SQLALCHEMY_URL} + SQLALCHEMY_WARN_20: ${SQLALCHEMY_WARN_20:-1} + START_DATE: ${START_DATE} STRAVA_CLIENT_ID: ${STRAVA_CLIENT_ID} STRAVA_CLIENT_SECRET: ${STRAVA_CLIENT_SECRET} TEAMS: ${TEAMS} - OBSERVER_TEAMS: ${OBSERVER_TEAMS} - MAIN_TEAM: ${MAIN_TEAM} - START_DATE: ${START_DATE} - END_DATE: ${END_DATE} TIMEZONE: ${TIMEZONE:-America/New_York} - COMPETITION_TITLE: ${COMPETITION_TITLE} + VIRTUAL_HOST: ${FREEZING_WEB_FQDN} diff --git a/docker-compose.yml b/docker-compose.yml index 942cb09..2705c03 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,8 +31,8 @@ services: - /proc/:/host/proc/:ro - /sys/fs/cgroup/:/host/sys/fs/cgroup:ro environment: - SD_BACKEND: docker API_KEY: ${DATADOG_API_KEY} + SD_BACKEND: docker restart: unless-stopped logging: driver: json-file @@ -75,8 +75,8 @@ services: - "80:80" - '443:443' volumes: - - 'nginx-config:/etc/nginx/conf.d' - 'nginx-certs:/etc/nginx/certs' + - 'nginx-config:/etc/nginx/conf.d' - 'nginx-vhosts:/etc/nginx/vhost.d' - 'nginx-webroot:/usr/share/nginx/html' labels: @@ -99,11 +99,11 @@ services: # environment: # NGINX_DOCKER_GEN_CONTAINER: nginx-docker-gen volumes: - - 'nginx-config:/etc/nginx/conf.d' + - '/var/run/docker.sock:/var/run/docker.sock:ro' - 'nginx-certs:/etc/nginx/certs' + - 'nginx-config:/etc/nginx/conf.d' - 'nginx-vhosts:/etc/nginx/vhost.d' - 'nginx-webroot:/usr/share/nginx/html' - - '/var/run/docker.sock:/var/run/docker.sock:ro' restart: unless-stopped logging: driver: json-file @@ -117,12 +117,12 @@ services: hostname: nginx-docker-gen command: -notify-sighup nginx -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf # yamllint disable-line rule:line-length volumes: - - 'nginx-config:/etc/nginx/conf.d' + - './web/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl' + - '/var/run/docker.sock:/tmp/docker.sock:ro' - 'nginx-certs:/etc/nginx/certs' + - 'nginx-config:/etc/nginx/conf.d' - 'nginx-vhosts:/etc/nginx/vhost.d' - 'nginx-webroot:/usr/share/nginx/html' - - '/var/run/docker.sock:/tmp/docker.sock:ro' - - './web/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl' labels: - "com.github.jrcs.letsencrypt_nginx_proxy_companion.docker_gen" restart: unless-stopped @@ -144,24 +144,26 @@ services: - beanstalkd - datadog environment: - ENVIRONMENT: ${ENVIRONMENT} - DEBUG: ${DEBUG} BEANSTALKD_HOST: ${BEANSTALKD_HOST:-beanstalkd} BEANSTALKD_PORT: ${BEANSTALKD_PORT:-11300} + DATADOG_API_KEY: ${DATADOG_API_KEY} + DATADOG_APP_KEY: ${DATADOG_APP_KEY} + DATADOG_HOST: ${DATADOG_HOST:-datadog} + DATADOG_PORT: ${DATADOG_PORT:-8125} + DEBUG: ${DEBUG} + END_DATE: ${END_DATE} + ENVIRONMENT: ${ENVIRONMENT} + MAIN_TEAM: ${MAIN_TEAM} + OBSERVER_TEAMS: ${OBSERVER_TEAMS} + SQLALCHEMY_SILENCE_UBER_WARNING: ${SQLALCHEMY_SILENCE_UBER_WARNING:-false} SQLALCHEMY_URL: ${SQLALCHEMY_URL} + SQLALCHEMY_WARN_20: ${SQLALCHEMY_WARN_20:-true} + START_DATE: ${START_DATE} STRAVA_CLIENT_ID: ${STRAVA_CLIENT_ID} STRAVA_CLIENT_SECRET: ${STRAVA_CLIENT_SECRET} - VISUAL_CROSSING_API_KEY: ${VISUAL_CROSSING_API_KEY} TEAMS: ${TEAMS} - OBSERVER_TEAMS: ${OBSERVER_TEAMS} - MAIN_TEAM: ${MAIN_TEAM} - START_DATE: ${START_DATE} - END_DATE: ${END_DATE} - DATADOG_HOST: ${DATADOG_HOST:-datadog} - DATADOG_PORT: ${DATADOG_PORT:-8125} - DATADOG_API_KEY: ${DATADOG_API_KEY} - DATADOG_APP_KEY: ${DATADOG_APP_KEY} TIMEZONE: ${TIMEZONE:-America/New_York} + VISUAL_CROSSING_API_KEY: ${VISUAL_CROSSING_API_KEY} volumes: - ./sync-data:/data restart: unless-stopped @@ -172,18 +174,18 @@ services: max-size: 10m freezing-nq: - image: freezingsaddles/freezing-nq:latest + image: freezingsaddles/freezing-nq:${FREEZING_NQ_TAG:-latest} hostname: freezing-nq container_name: freezing-nq environment: - ENVIRONMENT: ${ENVIRONMENT} - VIRTUAL_HOST: ${FREEZING_NQ_FQDN} - LETSENCRYPT_HOST: ${FREEZING_NQ_FQDN} - LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL} - DEBUG: ${DEBUG} BEANSTALKD_HOST: ${BEANSTALKD_HOST:-beanstalkd} BEANSTALKD_PORT: ${BEANSTALKD_PORT:-11300} + DEBUG: ${DEBUG} + ENVIRONMENT: ${ENVIRONMENT} + LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL} + LETSENCRYPT_HOST: ${FREEZING_NQ_FQDN} STRAVA_VERIFY_TOKEN: ${STRAVA_VERIFY_TOKEN} + VIRTUAL_HOST: ${FREEZING_NQ_FQDN} restart: unless-stopped logging: driver: json-file @@ -200,22 +202,24 @@ services: depends_on: - beanstalkd environment: + COMPETITION_TITLE: ${COMPETITION_TITLE} + DEBUG: ${DEBUG} + END_DATE: ${END_DATE} ENVIRONMENT: ${ENVIRONMENT} - VIRTUAL_HOST: ${FREEZING_WEB_FQDN} - LETSENCRYPT_HOST: ${FREEZING_WEB_FQDN} LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL} + LETSENCRYPT_HOST: ${FREEZING_WEB_FQDN} + MAIN_TEAM: ${MAIN_TEAM} + OBSERVER_TEAMS: ${OBSERVER_TEAMS} SECRET_KEY: ${SECRET_KEY} - DEBUG: ${DEBUG} + SQLALCHEMY_SILENCE_UBER_WARNING: ${SQLALCHEMY_SILENCE_UBER_WARNING:-false} SQLALCHEMY_URL: ${SQLALCHEMY_URL} + SQLALCHEMY_WARN_20: ${SQLALCHEMY_WARN_20:-true} + START_DATE: ${START_DATE} STRAVA_CLIENT_ID: ${STRAVA_CLIENT_ID} STRAVA_CLIENT_SECRET: ${STRAVA_CLIENT_SECRET} TEAMS: ${TEAMS} - OBSERVER_TEAMS: ${OBSERVER_TEAMS} - MAIN_TEAM: ${MAIN_TEAM} - START_DATE: ${START_DATE} - END_DATE: ${END_DATE} TIMEZONE: ${TIMEZONE:-America/New_York} - COMPETITION_TITLE: ${COMPETITION_TITLE} + VIRTUAL_HOST: ${FREEZING_WEB_FQDN} restart: unless-stopped logging: driver: json-file @@ -230,13 +234,13 @@ services: - ./wordpress:/var/www/html restart: unless-stopped environment: - VIRTUAL_HOST: ${FREEZING_REGISTER_FQDN} - LETSENCRYPT_HOST: ${FREEZING_REGISTER_FQDN} LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL} + LETSENCRYPT_HOST: ${FREEZING_REGISTER_FQDN} + VIRTUAL_HOST: ${FREEZING_REGISTER_FQDN} WORDPRESS_DB_HOST: ${WORDPRESS_DB_HOST} - WORDPRESS_DB_USER: ${WORDPRESS_DB_USER} - WORDPRESS_DB_PASSWORD: ${WORDPRESS_DB_PASSWORD} WORDPRESS_DB_NAME: ${WORDPRESS_DB_NAME} + WORDPRESS_DB_PASSWORD: ${WORDPRESS_DB_PASSWORD} + WORDPRESS_DB_USER: ${WORDPRESS_DB_USER} logging: driver: json-file options: