diff --git a/.dockerignore b/.dockerignore index bb56daf..52f3381 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,8 +11,6 @@ !/.env*.erb # Ignore all default key files. -/config/master.key -/config/credentials/*.key # Ignore all logfiles and tempfiles. /log/* diff --git a/Dockerfile b/Dockerfile index 00d9a8a..083419f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,8 +21,5 @@ COPY entrypoint.sh /usr/bin/ RUN chmod +x /usr/bin/entrypoint.sh ENTRYPOINT ["entrypoint.sh"] -VOLUME ["/cat-img-api/public"] -VOLUME ["/cat-img-api/tmp"] - CMD ["unicorn", "-p", "3000", "-c", "/cat-img-api/config/unicorn.rb", "-E", "$RAILS_ENV"] diff --git a/app/controllers/health_checks_controller.rb b/app/controllers/health_checks_controller.rb index f38a8a1..fc40d44 100644 --- a/app/controllers/health_checks_controller.rb +++ b/app/controllers/health_checks_controller.rb @@ -1,5 +1,5 @@ class HealthChecksController < ApplicationController def index - head :ok + render json: { message: '成功' }, status: :ok end end diff --git a/config/database.yml b/config/database.yml index b405fa4..ddda5ae 100644 --- a/config/database.yml +++ b/config/database.yml @@ -22,6 +22,7 @@ test: production: <<: *default + adapter: mysql2 database: <%= ENV["DB_DATABASE"] %> username: <%= ENV["DB_USERNAME"] %> password: <%= ENV["DB_PASSWORD"] %> diff --git a/config/environments/production.rb b/config/environments/production.rb index 8233de8..5f7d11b 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -42,7 +42,7 @@ # config.assume_ssl = true # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - config.force_ssl = true + config.force_ssl = false # Log to STDOUT by default config.logger = ActiveSupport::Logger.new(STDOUT) diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index 588af99..17ad9cb 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -7,7 +7,7 @@ Rails.application.config.middleware.insert_before 0, Rack::Cors do allow do - origins "http://localhost:3001" + origins "web.judging-cats.com","api.judging-cats.com" resource "*", headers: :any, diff --git a/docker-compose.dev.yml b/docker-compose.yml similarity index 74% rename from docker-compose.dev.yml rename to docker-compose.yml index f8d2c3b..a4b9bdf 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.yml @@ -10,12 +10,15 @@ services: - '3000:3000' volumes: - .:/cat-img-api + - public-data:/cat-img-api/public + - tmp-data:/cat-img-api/tmp depends_on: - db links: - db environment: - RAILS_ENV: development + RAILS_ENV: production + DB_DATABASE: cat-img-mysql DB_USER: root DB_PASSWORD: root DB_HOST: db @@ -40,6 +43,11 @@ services: restart: always #明示的にstopさせるまでリスタートする。(失敗するたび遅延あり) depends_on: - web + volumes: + - public-data:/cat-img-api/public + - tmp-data:/cat-img-api/tmp volumes: + public-data: mysql-data: + tmp-data: diff --git a/entrypoint.sh b/entrypoint.sh index 76af5ba..e2b6a65 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,16 +1,10 @@ #!/bin/sh set -e -rm -f tmp/pids/server.pid +rm -f tmp/pids/unicorn.pid mkdir -p tmp/sockets mkdir -p tmp/pids -until mysqladmin ping -h $DB_HOST -P 3306 -u root --silent; do - echo "waiting for mysql..." - sleep 3s -done -echo "success to connect mysql" - bundle exec rails db:create bundle exec rails db:migrate bundle exec rails db:migrate:status diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..c24200b --- /dev/null +++ b/public/404.html @@ -0,0 +1,13 @@ + + + + + + Document + + +

+ 404 +

+ + diff --git a/storage/development.sqlite3 b/storage/development.sqlite3 index a99a162..81afc8c 100644 Binary files a/storage/development.sqlite3 and b/storage/development.sqlite3 differ