mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Added env variables and a production docker setup
This commit is contained in:
@@ -27,7 +27,10 @@ test:
|
||||
timeout: 5000
|
||||
|
||||
production:
|
||||
adapter: sqlite3
|
||||
database: db/production.sqlite3
|
||||
pool: 5
|
||||
timeout: 5000
|
||||
adapter: mysql2
|
||||
encoding: utf8
|
||||
database: <%= ENV['WRESTLINGDEV_DB_NAME'] %>
|
||||
username: <%= ENV['WRESTLINGDEV_DB_USR'] %>
|
||||
password: <%= ENV['WRESTLINGDEV_DB_PWD'] %>
|
||||
host: <%= ENV['WRESTLINGDEV_DB_HOST'] %>
|
||||
port: <%= ENV['WRESTLINGDEV_DB_PORT'] %>
|
||||
|
||||
@@ -4,7 +4,7 @@ Devise.setup do |config|
|
||||
# The secret key used by Devise. Devise uses this key to generate
|
||||
# random tokens. Changing this key will render invalid all existing
|
||||
# confirmation, reset password and unlock tokens in the database.
|
||||
config.secret_key = '2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa'
|
||||
config.secret_key = ENV['WRESTLINGDEV_DEVISE_SECRET_KEY'] if Rails.env.production?
|
||||
|
||||
# ==> Mailer Configuration
|
||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||
|
||||
8
deploy/deploy-prod.sh
Executable file
8
deploy/deploy-prod.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
gpg prod.env.gpg
|
||||
cd ..
|
||||
bash rails-prod.sh wrestlingdev
|
||||
cd deploy
|
||||
sudo docker-compose -f docker-compose-prod.yml up -d
|
||||
echo Make sure your local mysql database has a db for wrestlingdev
|
||||
echo "mysqldump -u guy -ppassword -h host database_name > database.sql"
|
||||
echo "mysql -u guy -ppassword -h host database_name < database.sql"
|
||||
5
deploy/deploy-test.sh
Executable file
5
deploy/deploy-test.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
cd ..
|
||||
bash rails-prod.sh wrestlingdev
|
||||
cd deploy
|
||||
sudo docker-compose -f docker-compose-test.yml up -d
|
||||
echo Make sure your local mysql database has a wrestlingtourney db
|
||||
21
deploy/docker-compose-common.yml
Normal file
21
deploy/docker-compose-common.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
app:
|
||||
image: wrestlingdev
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
jobs:
|
||||
image: wrestlingdev
|
||||
command: bundle exec rake:jobs
|
||||
db:
|
||||
image: mysql:5.5
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- /srv/docker/mysql:/var/lib/mysql
|
||||
|
||||
email:
|
||||
image: postfix
|
||||
|
||||
memcached:
|
||||
image: memcached
|
||||
mem_limit: 64000000
|
||||
14
deploy/docker-compose-prod.yml
Normal file
14
deploy/docker-compose-prod.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
app:
|
||||
extends:
|
||||
file: docker-compose-common.yml
|
||||
service: app
|
||||
links:
|
||||
- db
|
||||
restart: always
|
||||
env_file: prod.env
|
||||
db:
|
||||
extends:
|
||||
file: docker-compose-common.yml
|
||||
service: app
|
||||
restart: always
|
||||
env_file: prod.env
|
||||
21
deploy/docker-compose-test.yml
Normal file
21
deploy/docker-compose-test.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
app:
|
||||
extends:
|
||||
file: docker-compose-common.yml
|
||||
service: app
|
||||
environment:
|
||||
- WRESTLINGDEV_DB_NAME=wrestlingtourney
|
||||
- WRESTLINGDEV_DB_USR=root
|
||||
- WRESTLINGDEV_DB_PWD=password
|
||||
- WRESTLINGDEV_DB_HOST=db
|
||||
- WRESTLINGDEV_DB_PORT=3306
|
||||
- WRESTLINGDEV_DEVISE_SECRET_KEY=2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa
|
||||
links:
|
||||
- db
|
||||
restart: always
|
||||
db:
|
||||
extends:
|
||||
file: docker-compose-common.yml
|
||||
service: app
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=password
|
||||
restart: always
|
||||
BIN
deploy/prod.env.gpg
Normal file
BIN
deploy/prod.env.gpg
Normal file
Binary file not shown.
@@ -49,7 +49,7 @@ RUN rm -rf /var/www
|
||||
|
||||
WORKDIR /var/www/
|
||||
ADD . /var/www/
|
||||
RUN RAILS_ENV=production bundle exec rake db:migrate
|
||||
#RUN RAILS_ENV=production bundle exec rake db:migrate
|
||||
RUN RAILS_ENV=production bundle exec rake assets:precompile
|
||||
|
||||
|
||||
|
||||
@@ -6,4 +6,4 @@ if [ $# != 1 ]; then
|
||||
fi
|
||||
|
||||
docker build -t $1 -f rails-prod-Dockerfile .
|
||||
sudo docker run -d --restart=always -p 80:80 -p 443:443 $1
|
||||
#sudo docker run -d --restart=always -p 80:80 -p 443:443 $1
|
||||
|
||||
Reference in New Issue
Block a user