From 821c3310316baacf9424cb91c5ca63d564522ba9 Mon Sep 17 00:00:00 2001 From: Hayden Date: Tue, 27 Aug 2024 15:47:26 -0700 Subject: [PATCH] refactor: move work to subdirectory and undo changes in root --- .gitignore | 2 +- app/assets/javascripts/application.js | 16 ++++----- docker-compose.yml | 40 +++++++++++------------ docker_dev/database.docker-dev.yml | 3 +- Dockerfile => docker_migration/Dockerfile | 0 docker_migration/database.yml | 13 ++++++++ docker_migration/docker-compose.yml | 38 +++++++++++++++++++++ docker_migration/startup.sh | 17 ++++++++++ 8 files changed, 98 insertions(+), 31 deletions(-) rename Dockerfile => docker_migration/Dockerfile (100%) create mode 100644 docker_migration/database.yml create mode 100644 docker_migration/docker-compose.yml create mode 100755 docker_migration/startup.sh diff --git a/.gitignore b/.gitignore index 0cfa365619..6597d71fcb 100644 --- a/.gitignore +++ b/.gitignore @@ -63,4 +63,4 @@ yarn-debug.log* /app/assets/builds/* !/app/assets/builds/.keep public/assets -sql-data +docker_migration/sql-data diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index ce911a63ab..f556483cba 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,10 +1,10 @@ - gems -= require rails-ujs +// gems +//= require rails-ujs - package.json -= require corejs-typeahead/dist/typeahead.bundle.min.js +// package.json +//= require corejs-typeahead/dist/typeahead.bundle.min.js - app/assets/javascripts -= require all_pages/catalog_autocompletion -= require all_pages/reference_autocompletion -= require all_pages/global +// app/assets/javascripts +//= require all_pages/catalog_autocompletion +//= require all_pages/reference_autocompletion +//= require all_pages/global diff --git a/docker-compose.yml b/docker-compose.yml index 50f76e0a3b..94eb2b322d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,27 +1,15 @@ -services: - db: - image: mysql/mysql-server:latest - environment: - - MYSQL_ROOT_HOST=% - - MYSQL_ROOT_PASSWORD=password - ports: - - "3309:3306" - expose: - - "3306" - container_name: antcat-db - volumes: - - ./sql-data:/docker-entrypoint-initdb.d +version: "3" +services: app: depends_on: - db build: context: . - dockerfile: Dockerfile + dockerfile: Dockerfile.dev environment: DB_USERNAME: root - DB_PASSWORD: password - DB_DATABASE: antcat + DB_DATABASE: antcat_docker DB_PORT: 3306 DB_HOST: db NO_DEV_MONKEY_PATCHES: "y" @@ -29,10 +17,22 @@ services: - .:/app - ./docker_dev/database.docker-dev.yml:/app/config/database.yml - ./config/server.yml.example:/app/config/server.yml - ports: - - "8080:8080" - container_name: antcat-app user: antcat stdin_open: true tty: true - command: ["/bin/bash", "-c", "app/startup.sh"] + container_name: antcat_app + + + db: + image: mysql:5.7 + expose: + - "3306" + ports: + - "3309:3306" + environment: + MYSQL_ALLOW_EMPTY_PASSWORD: "true" + volumes: + - mysql:/var/lib/mysql + +volumes: + mysql: diff --git a/docker_dev/database.docker-dev.yml b/docker_dev/database.docker-dev.yml index bbeeceab02..0476ce48f2 100644 --- a/docker_dev/database.docker-dev.yml +++ b/docker_dev/database.docker-dev.yml @@ -10,8 +10,7 @@ default: &default development: <<: *default - database: <%= ENV['DB_DATABASE'] %> -# database: <%= ENV['DB_DATABASE'] %>_developmment + database: <%= ENV['DB_DATABASE'] %>_development test: <<: *default diff --git a/Dockerfile b/docker_migration/Dockerfile similarity index 100% rename from Dockerfile rename to docker_migration/Dockerfile diff --git a/docker_migration/database.yml b/docker_migration/database.yml new file mode 100644 index 0000000000..3a7d070526 --- /dev/null +++ b/docker_migration/database.yml @@ -0,0 +1,13 @@ +default: &default + adapter: mysql2 + encoding: utf8 + pool: 5 + username: <%= ENV['DB_USERNAME'] %> + password: <%= ENV['DB_PASSWORD'] %> + port: <%= ENV['DB_PORT'] %> + host: <%= ENV['DB_HOST'] %> + socket: /var/run/mysqld/mysqlx.sock + +development: + <<: *default + database: <%= ENV['DB_DATABASE'] %> diff --git a/docker_migration/docker-compose.yml b/docker_migration/docker-compose.yml new file mode 100644 index 0000000000..026822807b --- /dev/null +++ b/docker_migration/docker-compose.yml @@ -0,0 +1,38 @@ +services: + db: + image: mysql/mysql-server:latest + environment: + - MYSQL_ROOT_HOST=% + - MYSQL_ROOT_PASSWORD=password + ports: + - "3309:3306" + expose: + - "3306" + container_name: antcat-db + volumes: + - ./sql-data:/docker-entrypoint-initdb.d + + app: + depends_on: + - db + build: + context: . + dockerfile: Dockerfile + environment: + DB_USERNAME: root + DB_PASSWORD: password + DB_DATABASE: antcat + DB_PORT: 3306 + DB_HOST: db + NO_DEV_MONKEY_PATCHES: "y" + volumes: + - ..:/app + - ./database.yml:/app/config/database.yml + - ../config/server.yml.example:/app/config/server.yml + ports: + - "8080:8080" + container_name: antcat-app + user: antcat + stdin_open: true + tty: true + command: ["/bin/bash", "-c", "app/startup.sh"] diff --git a/docker_migration/startup.sh b/docker_migration/startup.sh new file mode 100755 index 0000000000..c92ad77d93 --- /dev/null +++ b/docker_migration/startup.sh @@ -0,0 +1,17 @@ +#!/bin/bash + + +# Remove any pre-exisitng PID files +rm -rf /app/tmp/pids/server.pid + +bundle install --path=vendor/bundle +yarn install + +# Configure bundle to use a local path for gems +bundle config path vendor/bundle + +# Start the Solr service for Sunspot +bundle exec rails sunspot:solr:start + +# Start the Rails server, binding it to all network interfaces +bundle exec rails s -p 8080 -b '0.0.0.0'