-
-
Save sandeepk17/d3c42e72aaed8eaa6f774708c6d17d63 to your computer and use it in GitHub Desktop.
Revisions
-
satendra02 revised this gist
Feb 23, 2018 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,6 @@ RUN bundle install --jobs 20 --retry 5 --without development test # Adding project files COPY . /app_name RUN bundle exec rake assets:precompile EXPOSE 3000 CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"] -
satendra02 revised this gist
Feb 22, 2018 . 2 changed files with 2 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,11 +10,3 @@ default: &default production: <<: *default database: app_name_production This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,4 +11,5 @@ Create docker folder in app root -DockerFile_app -web -DockerFile_web -nginx.conf -docker-compose.yml -
satendra02 revised this gist
Feb 22, 2018 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,3 @@ upstream rails_app { server app:3000; } -
satendra02 revised this gist
Feb 19, 2018 . No changes.There are no files selected for viewing
-
satendra02 revised this gist
Feb 19, 2018 . No changes.There are no files selected for viewing
-
satendra02 revised this gist
Feb 18, 2018 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,18 +5,16 @@ default: &default username: postgres password: pool: 5 host: db production: <<: *default database: app_name_production development: <<: *default database: app_name_development test: <<: *default database: app_name_test -
satendra02 created this gist
Feb 17, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ FROM ruby:2.3.1 RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs # Configuring main directory RUN mkdir -p /app_name WORKDIR /app_name # Setting env up ENV RAILS_ENV='production' ENV RAKE_ENV='production' # Adding gems COPY Gemfile /app_name/Gemfile COPY Gemfile.lock /app_name/Gemfile.lock RUN bundle install --jobs 20 --retry 5 --without development test # Adding project files COPY . /app_name RUN bundle exec rake assets:precompile RUN bundle exec rake db:setup EXPOSE 3000 CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"] This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ # Base image: FROM nginx # Install dependencies RUN apt-get update -qq && apt-get -y install apache2-utils # establish where Nginx should look for files ENV RAILS_ROOT /var/www/app_name # Set our working directory inside the image WORKDIR $RAILS_ROOT # create log directory RUN mkdir log # copy over static assets COPY public public/ # Copy Nginx config template COPY docker/web/nginx.conf /tmp/docker.nginx # substitute variable references in the Nginx config template for real values from the environment # put the final config in its place RUN envsubst '$RAILS_ROOT' < /tmp/docker.nginx > /etc/nginx/conf.d/default.conf EXPOSE 80 # Use the "exec" form of CMD so Nginx shuts down gracefully on SIGTERM (i.e. `docker stop`) CMD [ "nginx", "-g", "daemon off;" ] This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ default: &default adapter: postgresql encoding: unicode username: postgres password: pool: 5 production: <<: *default host: db database: app_name_production development: <<: *default host: localhost database: app_name_development test: <<: *default host: localhost database: app_name_test This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ version: '3' volumes: postgres_data: {} services: app: build: context: . dockerfile: ./docker/app/Dockerfile_app depends_on: - db db: image: postgres volumes: - postgres_data:/var/lib/postgresql/data web: build: context: . dockerfile: ./docker/web/Dockerfile_web depends_on: - app ports: - 80:80 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,58 @@ # From http://chrisstump.online/2016/02/20/docker-existing-rails-application/ upstream rails_app { server app:3000; } server { # define your domain server_name www.example.com; # define the public application root root /app_name/public; index index.html; # define where Nginx should write its logs access_log /var/www/app_name/log/nginx.access.log; error_log /var/www/app_name/log/nginx.error.log; # deny requests for files that should never be accessed location ~ /\. { deny all; } location ~* ^.+\.(rb|log)$ { deny all; } # serve static (compiled) assets directly if they exist (for rails production) location ~ ^/(assets|images|javascripts|stylesheets|swfs|system)/ { try_files $uri @rails; access_log off; gzip_static on; # to serve pre-gzipped version expires max; add_header Cache-Control public; # Some browsers still send conditional-GET requests if there's a # Last-Modified header or an ETag header even if they haven't # reached the expiry date sent in the Expires header. add_header Last-Modified ""; add_header ETag ""; break; } # send non-static file requests to the app server location / { try_files $uri @rails; } location @rails { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://rails_app; } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ Create docker folder in app root -app_name -app -db -config -database.yml ... -docker -app -DockerFile_app -web -DockerFile_web -nginx.conf