mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Changed README to md, deleted unused scripts, and sured up deploy files
This commit is contained in:
55
README.md
Normal file
55
README.md
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# README
|
||||||
|
This application is being created to run a wrestling tournament.
|
||||||
|
|
||||||
|
### Current master status
|
||||||
|
[](https://travis-ci.org/jcwimer/wrestlingApp)
|
||||||
|
|
||||||
|
### Current development status
|
||||||
|
[](https://travis-ci.org/jcwimer/wrestlingApp)
|
||||||
|
|
||||||
|
# Info
|
||||||
|
**License:** MIT License
|
||||||
|
|
||||||
|
**Public Production Url:** [https://wrestlingdev.com](http://wrestlingdev.com)
|
||||||
|
|
||||||
|
**App Info**
|
||||||
|
* Ruby 2.6.5
|
||||||
|
* Rails 6.0.1
|
||||||
|
* DB mysql or mariadb
|
||||||
|
* Memcached
|
||||||
|
* Delayed Jobs
|
||||||
|
|
||||||
|
# Development
|
||||||
|
All dependencies are wrapped in docker. Tests can be run with `bash bin/run-tests-with-docker.sh`. That is the same command used in CI.
|
||||||
|
|
||||||
|
If you want to run a full rails environment shell in docker run: `bash bin/rails-dev-run.sh wrestlingapp-dev`
|
||||||
|
|
||||||
|
From here, you can run the normal rails commands.
|
||||||
|
* `rake db:seed` Development login email from seed data: `test@test.com` password: `password`
|
||||||
|
* `rake test`
|
||||||
|
* `rails generate blah blah blah`
|
||||||
|
* ` rails s -b 0.0.0.0` port 3000 is exposed. You can open [http://localhost:3000](http://localhost:3000) after running that command
|
||||||
|
* etc.
|
||||||
|
* `rake finish_seed_tournament` will complete all matches from the seed data. This command takes about 5 minutes to execute
|
||||||
|
|
||||||
|
To deploy a a full local version of the app `bash deploy/deploy-test.sh` (this requires docker-compose to be installed). This deploys a full version of the app. App, delayed job, memcached, and mariadb. Now, you can open [http://localhost](http://localhost). Delayed jobs are turned off in dev and everything that is a delayed job in prod just runs in browser.
|
||||||
|
|
||||||
|
# Deployment
|
||||||
|
|
||||||
|
The production version of this is currently deployed in Kubernetes. See [Deploying with Kubernetes](deploy/kubernetes/READEME.md)
|
||||||
|
|
||||||
|
**Required environment variables for deployment**
|
||||||
|
* `WRESTLINGDEV_DB_NAME=databasename`
|
||||||
|
* `WRESTLINGDEV_DB_USER=databaseusername`
|
||||||
|
* `WRESTLINGDEV_DB_PWD=databasepassword`
|
||||||
|
* `WRESTLINGDEV_DB_HOST=database.homename`
|
||||||
|
* `WRESTLINGDEV_DB_PORT=databaseport`
|
||||||
|
* `WRESTLINGDEV_DEVISE_SECRET_KEY=devise_key` can be generated with `rake secret`
|
||||||
|
* `WRESTLINGDEV_SECRET_KEY_BASE=secret_key` can be generated with `rake secret`
|
||||||
|
* `WRESTLINGDEV_EMAIL_PWD=emailpwd`
|
||||||
|
|
||||||
|
**Optional environment variables**
|
||||||
|
* `MEMCACHIER_PASSWORD=memcachier_password` needed for caching password
|
||||||
|
* `MEMCACHIER_SERVERS=memcachier_hostname:memcachier_port` needed for caching
|
||||||
|
* `MEMCACHIER_USERNAME=memcachier_username` needed for caching
|
||||||
|
* `WRESTLINGDEV_NEW_RELIC_LICENSE_KEY=new_relic_license_key` this is only needed to use new relic
|
||||||
71
README.rdoc
71
README.rdoc
@@ -1,71 +0,0 @@
|
|||||||
== README
|
|
||||||
|
|
||||||
{<img src="https://travis-ci.org/jcwimer/wrestlingApp.svg" alt="Build Status" />}[https://travis-ci.org/jcwimer/wrestlingApp]
|
|
||||||
|
|
||||||
This application is being created to run a wrestling tournament.
|
|
||||||
|
|
||||||
<b>License:</b>
|
|
||||||
|
|
||||||
MIT License
|
|
||||||
|
|
||||||
|
|
||||||
<b>Public production page:</b>
|
|
||||||
|
|
||||||
<tt>https://wrestlingdev.com</tt>
|
|
||||||
|
|
||||||
|
|
||||||
<b>Development details:</b>
|
|
||||||
|
|
||||||
* Ruby 2.6.5
|
|
||||||
|
|
||||||
* Rails 6.0.1
|
|
||||||
|
|
||||||
* Install gems without production <tt>bundle install --without production</tt>
|
|
||||||
|
|
||||||
* Test with minitest <tt>rake test</tt>
|
|
||||||
|
|
||||||
* Seeds created for development <tt>rake db:seed</tt>
|
|
||||||
|
|
||||||
* Finish all matches from seed data (this take ~ 5 minutes) <tt>rake finish_seed_tournament</tt>
|
|
||||||
|
|
||||||
* Development login email: <tt>test@test.com</tt> password: <tt>password</tt>
|
|
||||||
|
|
||||||
<b>Docker instructions:</b>
|
|
||||||
|
|
||||||
* Building and running the image: <tt>bash rails-dev.sh wrestlingapp</tt> This will mount your local directory to /rails inside the container and will open port 3000 to port 3000 on your local machine.
|
|
||||||
|
|
||||||
* After running the above script, you'll be presented a shell. You'll need to run <tt>bash rails-dev-db.sh</tt> to set up the development db's. After those are set up, you can run <tt>rake test</tt> to run the tests or <tt>rails s -b 0.0.0.0</tt> to run a development server. You can also run any other rails commands from here.
|
|
||||||
|
|
||||||
<b>Production details:</b>
|
|
||||||
|
|
||||||
* Set up env file
|
|
||||||
|
|
||||||
<tt>export WRESTLINGDEV_ENV_FILE=/path/where/envfile/exists/envfilename.env</tt>
|
|
||||||
|
|
||||||
* Env file should contain the following env's
|
|
||||||
|
|
||||||
<tt>WRESTLINGDEV_DB_NAME=databasename</tt>
|
|
||||||
|
|
||||||
<tt>WRESTLINGDEV_DB_USER=databaseusername</tt>
|
|
||||||
|
|
||||||
<tt>WRESTLINGDEV_DB_PWD=databasepassword</tt>
|
|
||||||
|
|
||||||
<tt>WRESTLINGDEV_DB_HOST=database.homename</tt>
|
|
||||||
|
|
||||||
<tt>WRESTLINGDEV_DB_PORT=databaseport</tt>
|
|
||||||
|
|
||||||
<tt>WRESTLINGDEV_DEVISE_SECRET_KEY=devise_key can be generated with rake secret</tt>
|
|
||||||
|
|
||||||
<tt>WRESTLINGDEV_SECRET_KEY_BASE=secret_key can be generated with rake secret</tt>
|
|
||||||
|
|
||||||
* Optional env's
|
|
||||||
|
|
||||||
<tt>WRESTLINGDEV_NEW_RELIC_LICENSE_KEY=new_relic_license_key this is only needed to use new relic</tt>
|
|
||||||
|
|
||||||
<tt>MEMCACHIER_PASSWORD=memcachier_password this is only needed for caching</tt>
|
|
||||||
|
|
||||||
<tt>MEMCACHIER_SERVERS=memcachier_hostname:memcachier_port this is only needed for caching</tt>
|
|
||||||
|
|
||||||
<tt>MEMCACHIER_USERNAME=memcachier_username this is only needed for caching</tt>
|
|
||||||
|
|
||||||
* Production docker image: Run <tt>bash rails-prod.sh wrestlingapp</tt>. This will create a self-signed ssl certificate and set up wrestlingapp on passenger/apache. The container will run with port 80 and port 443 open and will have a restart policy of always.
|
|
||||||
@@ -7,4 +7,4 @@ if [ $# != 1 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
docker build -t $1 -f ${project_dir}/deploy/rails-dev-Dockerfile ${project_dir}
|
docker build -t $1 -f ${project_dir}/deploy/rails-dev-Dockerfile ${project_dir}
|
||||||
docker run -it -p 3000:3000 -v ${project_dir}:/rails $1 /bin/bash
|
docker run -it -p 3000:3000 -v ${project_dir}:/rails $1 /bin/bash
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
version: "2.2"
|
|
||||||
networks:
|
|
||||||
database:
|
|
||||||
caching:
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
mysql:
|
|
||||||
|
|
||||||
services:
|
|
||||||
app:
|
|
||||||
image: wrestlingdev-prod
|
|
||||||
ports:
|
|
||||||
- "80:80"
|
|
||||||
- "443:443"
|
|
||||||
networks:
|
|
||||||
database:
|
|
||||||
caching:
|
|
||||||
restart: always
|
|
||||||
env_file:
|
|
||||||
- ./prod.env
|
|
||||||
healthcheck:
|
|
||||||
test: curl --insecure https://127.0.0.1/
|
|
||||||
|
|
||||||
db:
|
|
||||||
image: mysql:5.7
|
|
||||||
ports:
|
|
||||||
- "3306:3306"
|
|
||||||
volumes:
|
|
||||||
- mysql:/var/lib/mysql
|
|
||||||
restart: always
|
|
||||||
env_file:
|
|
||||||
- ./prod.env
|
|
||||||
networks:
|
|
||||||
database:
|
|
||||||
|
|
||||||
worker:
|
|
||||||
image: wrestlingdev-prod
|
|
||||||
networks:
|
|
||||||
database:
|
|
||||||
caching:
|
|
||||||
restart: always
|
|
||||||
env_file:
|
|
||||||
- ./prod.env
|
|
||||||
healthcheck:
|
|
||||||
test: kill -0 1
|
|
||||||
command: bundle exec bin/delayed_job -n 1 run
|
|
||||||
|
|
||||||
|
|
||||||
memcached:
|
|
||||||
image: memcached:1.5
|
|
||||||
mem_limit: 64000000
|
|
||||||
restart: always
|
|
||||||
networks:
|
|
||||||
caching:
|
|
||||||
@@ -19,10 +19,7 @@ services:
|
|||||||
- WRESTLINGDEV_DB_PWD=password
|
- WRESTLINGDEV_DB_PWD=password
|
||||||
- WRESTLINGDEV_DB_HOST=db
|
- WRESTLINGDEV_DB_HOST=db
|
||||||
- WRESTLINGDEV_DB_PORT=3306
|
- WRESTLINGDEV_DB_PORT=3306
|
||||||
- WRESTLINGDEV_DEVISE_SECRET_KEY=2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa
|
|
||||||
- WRESTLINGDEV_SECRET_KEY_BASE=077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e4463d851c444c10a5611829a2290b253da78339427f131571fac9a42c83d960b2d25ecc10a4a0a7ce1a2
|
|
||||||
- MEMCACHIER_SERVERS=memcached:11211
|
- MEMCACHIER_SERVERS=memcached:11211
|
||||||
- MEMCACHIER_USERNAME=
|
|
||||||
- MEMCACHIER_PASSWORD=
|
- MEMCACHIER_PASSWORD=
|
||||||
networks:
|
networks:
|
||||||
database:
|
database:
|
||||||
@@ -55,10 +52,7 @@ services:
|
|||||||
- WRESTLINGDEV_DB_PWD=password
|
- WRESTLINGDEV_DB_PWD=password
|
||||||
- WRESTLINGDEV_DB_HOST=db
|
- WRESTLINGDEV_DB_HOST=db
|
||||||
- WRESTLINGDEV_DB_PORT=3306
|
- WRESTLINGDEV_DB_PORT=3306
|
||||||
- WRESTLINGDEV_DEVISE_SECRET_KEY=2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa
|
|
||||||
- WRESTLINGDEV_SECRET_KEY_BASE=077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e4463d851c444c10a5611829a2290b253da78339427f131571fac9a42c83d960b2d25ecc10a4a0a7ce1a2
|
|
||||||
- MEMCACHIER_SERVERS=memcached:11211
|
- MEMCACHIER_SERVERS=memcached:11211
|
||||||
- MEMCACHIER_USERNAME=
|
|
||||||
- MEMCACHIER_PASSWORD=
|
- MEMCACHIER_PASSWORD=
|
||||||
networks:
|
networks:
|
||||||
database:
|
database:
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
env WRESTLINGDEV_DB_NAME;
|
|
||||||
env WRESTLINGDEV_DB_USR;
|
|
||||||
env WRESTLINGDEV_DB_PWD;
|
|
||||||
env WRESTLINGDEV_DB_HOST;
|
|
||||||
env WRESTLINGDEV_DB_PORT;
|
|
||||||
env WRESTLINGDEV_DEVISE_SECRET_KEY;
|
|
||||||
env WRESTLINGDEV_SECRET_KEY_BASE;
|
|
||||||
env MEMCACHIER_SERVERS;
|
|
||||||
env MEMCACHIER_USERNAME;
|
|
||||||
env MEMCACHIER_PASSWORD;
|
|
||||||
env PATH;
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 443 ssl;
|
|
||||||
server_name localhost;
|
|
||||||
ssl_certificate /ssl/server.crt;
|
|
||||||
ssl_certificate_key /ssl/server.key;
|
|
||||||
ssl_session_cache shared:SSL:1m;
|
|
||||||
ssl_session_timeout 5m;
|
|
||||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
||||||
ssl_prefer_server_ciphers on;
|
|
||||||
root /rails/public;
|
|
||||||
passenger_enabled on;
|
|
||||||
passenger_ruby /usr/local/bin/ruby;
|
|
||||||
passenger_app_env production;
|
|
||||||
}
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
user www-data;
|
|
||||||
worker_processes auto;
|
|
||||||
pid /run/nginx.pid;
|
|
||||||
daemon off;
|
|
||||||
error_log /dev/stdout;
|
|
||||||
|
|
||||||
include /etc/nginx/main.d/*.conf;
|
|
||||||
|
|
||||||
events {
|
|
||||||
worker_connections 768;
|
|
||||||
# multi_accept on;
|
|
||||||
}
|
|
||||||
|
|
||||||
http {
|
|
||||||
##
|
|
||||||
# Basic Settings
|
|
||||||
##
|
|
||||||
|
|
||||||
sendfile on;
|
|
||||||
tcp_nopush on;
|
|
||||||
tcp_nodelay on;
|
|
||||||
keepalive_timeout 65;
|
|
||||||
types_hash_max_size 2048;
|
|
||||||
# server_tokens off;
|
|
||||||
|
|
||||||
# server_names_hash_bucket_size 64;
|
|
||||||
# server_name_in_redirect off;
|
|
||||||
|
|
||||||
include /etc/nginx/mime.types;
|
|
||||||
default_type application/octet-stream;
|
|
||||||
|
|
||||||
##
|
|
||||||
# SSL Settings
|
|
||||||
##
|
|
||||||
|
|
||||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
|
|
||||||
ssl_prefer_server_ciphers on;
|
|
||||||
|
|
||||||
##
|
|
||||||
# Logging Settings
|
|
||||||
##
|
|
||||||
|
|
||||||
#access_log /var/log/nginx/access.log;
|
|
||||||
#error_log /var/log/nginx/error.log;
|
|
||||||
access_log /dev/stdout;
|
|
||||||
|
|
||||||
|
|
||||||
##
|
|
||||||
# Gzip Settings
|
|
||||||
##
|
|
||||||
|
|
||||||
gzip on;
|
|
||||||
gzip_disable "msie6";
|
|
||||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
||||||
|
|
||||||
# gzip_vary on;
|
|
||||||
# gzip_proxied any;
|
|
||||||
# gzip_comp_level 6;
|
|
||||||
# gzip_buffers 16 8k;
|
|
||||||
# gzip_http_version 1.1;
|
|
||||||
|
|
||||||
##
|
|
||||||
# Phusion Passenger config
|
|
||||||
##
|
|
||||||
# Uncomment it if you installed passenger or passenger-enterprise
|
|
||||||
##
|
|
||||||
|
|
||||||
include /etc/nginx/passenger.conf;
|
|
||||||
|
|
||||||
##
|
|
||||||
# Virtual Host Configs
|
|
||||||
##
|
|
||||||
|
|
||||||
include /etc/nginx/conf.d/*.conf;
|
|
||||||
include /etc/nginx/sites-enabled/*;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#mail {
|
|
||||||
# # See sample authentication script at:
|
|
||||||
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
|
|
||||||
#
|
|
||||||
# # auth_http localhost/auth.php;
|
|
||||||
# # pop3_capabilities "TOP" "USER";
|
|
||||||
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
|
|
||||||
#
|
|
||||||
# server {
|
|
||||||
# listen localhost:110;
|
|
||||||
# protocol pop3;
|
|
||||||
# proxy on;
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# server {
|
|
||||||
# listen localhost:143;
|
|
||||||
# protocol imap;
|
|
||||||
# proxy on;
|
|
||||||
# }
|
|
||||||
#}
|
|
||||||
#
|
|
||||||
@@ -38,8 +38,6 @@ RUN bundle install --jobs 4
|
|||||||
ADD . /rails/
|
ADD . /rails/
|
||||||
|
|
||||||
#Need temp secret keys to precompile assets
|
#Need temp secret keys to precompile assets
|
||||||
#ENV WRESTLINGDEV_SECRET_KEY_BASE 077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e4463d851c444c10a5611829a2290b253da78339427f131571fac9a42c83d960b2d25ecc10a4a0a7ce1a2
|
|
||||||
#ENV WRESTLINGDEV_DEVISE_SECRET_KEY 2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa
|
|
||||||
#RUN RAILS_ENV=production bundle exec rake assets:precompile
|
#RUN RAILS_ENV=production bundle exec rake assets:precompile
|
||||||
|
|
||||||
#SSL
|
#SSL
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash -e
|
|
||||||
project_dir="$(dirname $( dirname $(readlink -f ${BASH_SOURCE[0]})))"
|
|
||||||
if [ $# != 1 ]; then
|
|
||||||
echo "Please enter docker image name for the rails development environment"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
docker build -t $1 -f ${project_dir}/deploy/rails-prod-Dockerfile ${project_dir}/.
|
|
||||||
|
|
||||||
#Kill and remove containers gracefully without error if none are running
|
|
||||||
docker ps | grep "Exit" | awk '{print $1}' | while read -r id ; do
|
|
||||||
docker kill $id
|
|
||||||
done
|
|
||||||
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
FROM ubuntu:xenial
|
|
||||||
|
|
||||||
HEALTHCHECK --start-period=30s CMD curl --insecure https://127.0.0.1/
|
|
||||||
|
|
||||||
ENV RUBY_VERSION=2.4.4
|
|
||||||
ENV RUBY_MAJOR_VERSION=2.4
|
|
||||||
|
|
||||||
ENV TINI_VERSION v0.18.0
|
|
||||||
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
|
|
||||||
RUN chmod +x /tini
|
|
||||||
|
|
||||||
RUN apt-get -qq update \
|
|
||||||
&& DEBIAN_FRONTEND=noninteractive apt-get -qq upgrade -y \
|
|
||||||
&& DEBIAN_FRONTEND=noninteractive apt-get -qq install -y \
|
|
||||||
build-essential \
|
|
||||||
libssl-dev \
|
|
||||||
libyaml-dev \
|
|
||||||
libreadline-dev \
|
|
||||||
openssl \
|
|
||||||
curl \
|
|
||||||
git-core \
|
|
||||||
zlib1g-dev \
|
|
||||||
bison \
|
|
||||||
libxml2-dev \
|
|
||||||
libxslt1-dev \
|
|
||||||
libcurl4-openssl-dev \
|
|
||||||
libsqlite3-dev \
|
|
||||||
sqlite3 \
|
|
||||||
wget \
|
|
||||||
apt-transport-https \
|
|
||||||
ca-certificates \
|
|
||||||
mysql-client \
|
|
||||||
libmysqlclient-dev \
|
|
||||||
postfix \
|
|
||||||
nodejs \
|
|
||||||
nginx \
|
|
||||||
lsb-release \
|
|
||||||
dirmngr \
|
|
||||||
gnupg \
|
|
||||||
&& wget http://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR_VERSION}/ruby-${RUBY_VERSION}.tar.gz \
|
|
||||||
&& tar -xzf ruby-${RUBY_VERSION}.tar.gz \
|
|
||||||
&& cd ruby-${RUBY_VERSION} \
|
|
||||||
&& ./configure \
|
|
||||||
&& make && make install \
|
|
||||||
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7 \
|
|
||||||
&& sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger $(lsb_release -c --short) main > /etc/apt/sources.list.d/passenger.list' \
|
|
||||||
&& apt-get -qq update \
|
|
||||||
&& DEBIAN_FRONTEND=noninteractive apt-get -qq install -y \
|
|
||||||
passenger \
|
|
||||||
nginx-extras \
|
|
||||||
&& apt-get -qq clean \
|
|
||||||
&& apt-get autoremove -y \
|
|
||||||
&& rm -rf \
|
|
||||||
/var/lib/apt/lists/* \
|
|
||||||
/tmp/* \
|
|
||||||
/var/tmp/*
|
|
||||||
|
|
||||||
# Set timezone inside the container
|
|
||||||
RUN echo "America/New_York" > /etc/timezone \
|
|
||||||
&& rm /etc/localtime \
|
|
||||||
&& ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
|
|
||||||
|
|
||||||
#New Relic
|
|
||||||
#RUN echo deb http://apt.newrelic.com/debian/ newrelic non-free >> /etc/apt/sources.list.d/newrelic.list \
|
|
||||||
# && wget -O- https://download.newrelic.com/548C16BF.gpg | apt-key add - \
|
|
||||||
# && apt-get update \
|
|
||||||
# && apt-get install newrelic-sysmond -y \
|
|
||||||
# && nrsysmond-config --set license_key=$NEW_RELIC_LICENSE_KEY
|
|
||||||
|
|
||||||
#SSL
|
|
||||||
RUN mkdir /ssl \
|
|
||||||
&& openssl req -sha256 -subj '/CN=home/O=home LTD./C=US' \
|
|
||||||
-x509 -nodes -days 365 -newkey rsa:4096 -keyout /ssl/server.key -out /ssl/server.crt
|
|
||||||
|
|
||||||
EXPOSE 80
|
|
||||||
EXPOSE 443
|
|
||||||
|
|
||||||
RUN gem install --no-rdoc --no-ri bundler
|
|
||||||
#Cache gems so they don't install on every code change
|
|
||||||
WORKDIR /tmp
|
|
||||||
COPY Gemfile Gemfile
|
|
||||||
COPY Gemfile.lock Gemfile.lock
|
|
||||||
RUN bundle install
|
|
||||||
|
|
||||||
# Copy site into place.
|
|
||||||
RUN rm -rf /rails && mkdir /rails
|
|
||||||
WORKDIR /rails/
|
|
||||||
ADD . /rails/
|
|
||||||
|
|
||||||
# Nginx configurations (nginx does not pass envs which is why you need nginx-env.conf)
|
|
||||||
COPY ./deploy/nginx-wrestlingdev.conf /etc/nginx/sites-available/default
|
|
||||||
COPY ./deploy/nginx-env.conf /etc/nginx/main.d/nginx-env.conf
|
|
||||||
COPY ./deploy/nginx.conf /etc/nginx/nginx.conf
|
|
||||||
RUN echo "passenger_default_user root;" >> /etc/nginx/passenger.conf
|
|
||||||
|
|
||||||
#Need temp secret keys to precompile assets
|
|
||||||
ENV WRESTLINGDEV_SECRET_KEY_BASE 077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e4463d851c444c10a5611829a2290b253da78339427f131571fac9a42c83d960b2d25ecc10a4a0a7ce1a2
|
|
||||||
ENV WRESTLINGDEV_DEVISE_SECRET_KEY 2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa
|
|
||||||
RUN RAILS_ENV=production bundle exec rake assets:precompile
|
|
||||||
|
|
||||||
# Tini solves the zombie PID problem
|
|
||||||
ENTRYPOINT ["/tini", "--"]
|
|
||||||
|
|
||||||
WORKDIR /rails
|
|
||||||
#CMD bundle exec puma -t 3:3 -b 'ssl://0.0.0.0:443?key=/ssl/server.key&verify_mode=none&cert=/ssl/server.crt' -e production
|
|
||||||
#CMD bundle exec passenger start --max-pool-size 3 --environment production --ssl --ssl-certificate /ssl/server.crt --ssl-certificate-key /ssl/server.key
|
|
||||||
CMD ["nginx"]
|
|
||||||
Reference in New Issue
Block a user