Skip to content

Commit

Permalink
Merge pull request #10 from yon-s/feature/test
Browse files Browse the repository at this point in the history
本番環境用の設定ファイル修正
  • Loading branch information
yon-s committed Nov 25, 2023
2 parents c3bcb50 + 69cc727 commit a6d695c
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 16 deletions.
2 changes: 0 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
!/.env*.erb

# Ignore all default key files.
/config/master.key
/config/credentials/*.key

# Ignore all logfiles and tempfiles.
/log/*
Expand Down
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
2 changes: 1 addition & 1 deletion app/controllers/health_checks_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class HealthChecksController < ApplicationController
def index
head :ok
render json: { message: '成功' }, status: :ok
end
end
1 change: 1 addition & 0 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ test:

production:
<<: *default
adapter: mysql2
database: <%= ENV["DB_DATABASE"] %>
username: <%= ENV["DB_USERNAME"] %>
password: <%= ENV["DB_PASSWORD"] %>
Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/cors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 9 additions & 1 deletion docker-compose.dev.yml → docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
8 changes: 1 addition & 7 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 13 additions & 0 deletions public/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<p>
404
</p>
</body>
</html>
Binary file modified storage/development.sqlite3
Binary file not shown.

0 comments on commit a6d695c

Please sign in to comment.