Last active
May 19, 2017 08:02
-
-
Save coffeencoke/4422617 to your computer and use it in GitHub Desktop.
Revisions
-
coffeencoke revised this gist
Mar 19, 2013 . 1 changed file with 10 additions and 8 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 @@ -16,11 +16,13 @@ Added an issue in github: https://github.com/capistrano/capistrano/issues/379 Work around is to manually run the rake assets precompile method in app/shared/cached-copy and move the assets/admin/manifest.yml file to /app/shared/assets/manifest.yml ``` $ cap ui deploy:setup deploy:cold # this will fail, but will setup our files for us $ ssh [email protected] $ cd ~/apps/admin-app.coffeencoke.com/shared/cached-copy $ bundle install --without test development $ bundle exec rake RAILS_ENV=qa RAILS_GROUPS=assets assets:precompile $ cp -- public/admin/assets/manifest.yml ../assets/ $ exit $ cap ui deploy:cold ``` -
coffeencoke revised this gist
Mar 19, 2013 . 1 changed file with 18 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 @@ -6,4 +6,21 @@ For example, if you have an app at `/home/coffeencoke/apps/app.coffeencoke.com/c ```bash ln -s /home/coffeencoke/apps/admin-app.coffeencoke.com/current/public /home/coffeencoke/apps/app.coffeencoke.com/current/public/admin ``` Also... Issue when deploying a fresh environment and running deploy:cold you may get an error that says "cannot stat /....manifest.yml" Added an issue in github: https://github.com/capistrano/capistrano/issues/379 Work around is to manually run the rake assets precompile method in app/shared/cached-copy and move the assets/admin/manifest.yml file to /app/shared/assets/manifest.yml $ cap ui deploy:setup deploy:cold # this will fail, but will setup our files for us $ ssh [email protected] $ cd ~/apps/admin-app.coffeencoke.com/shared/cached-copy $ bundle install --without test development $ bundle exec rake RAILS_ENV=qa RAILS_GROUPS=assets assets:precompile $ cp -- public/admin/assets/manifest.yml ../assets/ $ exit $ cap ui deploy:cold -
coffeencoke revised this gist
Feb 21, 2013 . 1 changed file with 9 additions and 0 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 @@ -0,0 +1,9 @@ # Symlink for static files Among applying the changes in the other files in this gist, you need to symlink the directory you are serving the app with in the root app's public directory so that NGINX can serve the static files in the sub-app. For example, if you have an app at `/home/coffeencoke/apps/app.coffeencoke.com/current/public` as your root app, and you have the sub app served at <http://app.coffeencoke.com/admin>, then you need to symlink `/home/coffeencoke/apps/admin-app.coffeencoke.com/current/public` to `/home/coffeencoke/apps/app.coffeencoke.com/current/public/admin` like so: ```bash ln -s /home/coffeencoke/apps/admin-app.coffeencoke.com/current/public /home/coffeencoke/apps/app.coffeencoke.com/current/public/admin ``` -
coffeencoke revised this gist
Feb 20, 2013 . 6 changed files with 71 additions and 64 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 @@ -0,0 +1,14 @@ # This is for the admin app only # # Among other app config things, add these two lines within your Application.configure block # # You can also put this in the config file for each individual environment. So you can still use # localhost:3000 w/out the subdirectory for development mode and tests and such. # AppAdmin::Application.configure do # ... # Serve the app from host/admin config.root_directory = '/admin' config.assets.prefix = '/admin/assets/' end 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,8 +0,0 @@ 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,29 +1,44 @@ worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name app.coffeencoke.com app; access_log /var/log/nginx/app.coffeencoke.com.access.log; error_log /var/log/nginx/app.coffeencoke.com.error.log info; root /home/coffeencoke/app.coffeencoke.com/public; location / { try_files $uri @unicorn_proxy; } location @unicorn_proxy { proxy_pass http://127.0.0.1:8081; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_set_header X-Forwarded-Proto $scheme; } location /admin { try_files $uri @unicorn_proxy_admin; } location @unicorn_proxy_admin { proxy_pass http://127.0.0.1:8080; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_set_header X-Forwarded-Proto $scheme; } } } 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,9 +0,0 @@ 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,11 +0,0 @@ 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,12 +1,18 @@ require 'rails/application' module RouteScoper # Keep the rescue so that you can revert to not having a # subdirectory when in development and test modes def self.root Rails.application.config.root_directory rescue NameError '/' end end MagnetTesterAdmin::Application.routes.draw do scope RouteScoper.root do resource :session, only: :new root :to => 'awesome_rootness#show' end end -
coffeencoke created this gist
Dec 31, 2012 .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,8 @@ # goes in config/environments/development.rb MyApp::Application.configure do # Contains configurations for the production environment # ... # Does not include config.root_directory end 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,29 @@ # Goes in /etc/nginx/sites-available/myapp.conf upstream unicorn_socket_for_myapp { server unix:/home/coffeencoke/apps/myapp/current/tmp/sockets/unicorn.sock fail_timeout=0; } server { listen 80; server_name coffeencoke.com www.coffeencoke.com; access_log /var/log/nginx/myapp.access.log; error_log /var/log/nginx/myapp.error.log debug; root /home/coffeencoke/apps/myapp/current/public; # If static file exists, load directly from Nginx, bypass Rails # Otherwise, pass request off to unicorn proxy location /myapp/ { try_files $uri @unicorn_proxy; } location @unicorn_proxy { proxy_pass http://unix:/home/coffeencoke/apps/myapp/current/tmp/sockets/unicorn.sock; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_set_header X-Forwarded-Proto $scheme; } error_page 500 502 503 504 /500.html; } 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,9 @@ # goes in config/environments/production.rb MyApp::Application.configure do # Contains configurations for the production environment # ... # Serve the application at /myapp config.root_directory = '/myapp' end 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,11 @@ # goes in lib/route_scoper.rb require 'rails/application' module RouteScoper def self.root Rails.application.config.root_directory rescue NameError '/' end end 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,12 @@ # goes in config/routes.rb require_relative '../lib/route_scoper' MyApp::Application.routes.draw do scope RouteScoper.root do root :to => 'registrations#new' # other routes are always inside this block # ... end end