diff --git a/Makefile b/Makefile index a40cafd093e..b329bd6c9a4 100644 --- a/Makefile +++ b/Makefile @@ -56,6 +56,7 @@ up: require create-if-missing.env ../owid-content tmp-downloads/owid_metadata.sq yarn run tsc -b @echo '==> Starting dev environment' + @mkdir -p logs tmux new-session -s grapher \ -n docker 'docker-compose -f docker-compose.grapher.yml up' \; \ set remain-on-exit on \; \ @@ -83,6 +84,7 @@ up.devcontainer: create-if-missing.env.devcontainer tmp-downloads/owid_metadata. yarn run tsc -b @echo '==> Starting dev environment' + @mkdir -p logs tmux new-session -s grapher \ -n admin \ 'devTools/docker/wait-for-mysql.sh && yarn run tsc-watch -b --onSuccess "yarn startAdminServer"' \; \ diff --git a/devTools/docker/my.cnf b/devTools/docker/my.cnf new file mode 100644 index 00000000000..73938e5fef1 --- /dev/null +++ b/devTools/docker/my.cnf @@ -0,0 +1,16 @@ +[mysqld] +# defaults +skip-host-cache +skip-name-resolve +datadir=/var/lib/mysql +socket=/var/lib/mysql/mysql.sock +secure-file-priv=/var/lib/mysql-files +user=mysql +pid-file=/var/run/mysqld/mysqld.pid + +# owid-specific +general_log = 1 +general_log_file = /var/log/mysql/queries.log +slow_query_log = 1 +slow_query_log_file = /var/log/mysql/slow-queries.log +long_query_time = 2 \ No newline at end of file diff --git a/docker-compose.full.yml b/docker-compose.full.yml index a9c350307e7..e9629fa6eb3 100644 --- a/docker-compose.full.yml +++ b/docker-compose.full.yml @@ -37,7 +37,9 @@ services: command: --default-authentication-plugin=mysql_native_password restart: always volumes: + - ./devTools/docker/my.cnf:/etc/my.cnf:ro - mysql_data:/var/lib/mysql + - ./logs:/var/log/mysql ports: # Exposing via the port specified for Grapher # Should always be the same as the WordPress port, because we store both DBs on the same server diff --git a/docker-compose.grapher.yml b/docker-compose.grapher.yml index 425d2b54a9e..8c1c5fb5631 100644 --- a/docker-compose.grapher.yml +++ b/docker-compose.grapher.yml @@ -33,7 +33,9 @@ services: command: --default-authentication-plugin=mysql_native_password restart: always volumes: + - ./devTools/my.cnf:/etc/my.cnf:ro - mysql_data_public:/var/lib/mysql + - ./logs:/var/log/mysql ports: # Exposing via the port specified for Grapher # Should always be the same as the WordPress port, because we store both DBs on the same server