Jesus JacksonDeveloping Rails Apps inTechnical Isolation
Background● Live in Washington, D.C.● Software developer who has been leading aRuby on Rails project for over 2 years.● De...
Technical Isolation?No● Developing on an island :o)Yes● Developing apps on an intranet● No sudo privileges on servers● Don...
What do we do?
How do we manage our Rubies and gemsets behind afirewalled/restricted environment?Problem 1: Using RVM
Solution: RVM::FW● Created by Steven Haddox - a developer whoworked on my team and was instrumental inour success● https:/...
Set up RVM::FW1) "rake boot:strap" to download Rubies andpackages2) Copy contents and deploy to your internal server3) Ins...
Using RVM::FW● Other projects on your network can now useyour server to install RVM::FW andmaintain their Rubies.● http(s)...
Problem #2: CapistranoDeployment Gotchas
Using Capistrano● Not very difficult to set up, even in arestricted environment.● You need to set up key-based authenticat...
Capistrano● Place chmod task in deploy.rb to chmod 775so releases/### and releases/###/publicare accessible to Apache.name...
Capistrano● Important to stop and restart Resqueworkersnamespace :resque dodesc "Stop resque workers"task :stop dobeginrun...
How do we test email notifications when the SMTPserver is locked down?Problem 3: Testing Email
Testing Email Notifications● Emails blocked when being sent fromActionMailer● By default, ActionMailer delivery is sent to...
Solution: MailCatcher● Runs a lightweight SMTP server on yourlocalhost● Catches any emails sent to it and displaysemails i...
MailCatcher UI
Problem 4: Using GitHow to use Git in an SVN world
SVN is still prevalent● Every project on the contract used SVN● No official server or host for Git on theintranet.● Git wa...
Solution: git svn● Tool allows you to use Git as a valid client,but push all of your changes to an SVNserver.● You can use...
Using git svn● "git svn clone [SVN URL] -s" - import yourSVN repo into your local Git repo● "git commit -am My awesome com...
git svn caveat● Remember, youre still using SVN under thehood.○ Rebase your work as much as possible.○ Dont simultaneously...
Solution 2: Gitlab● If you can host Git on a server, try Gitlab.● Allows you to manage multiple repos. Itspretty much your...
Problem 5: Managing GemsHow do we host gems in restricted environments?
Solution: "gem server"● Rubygems comes with the command "gemserver"● Running this command will serve all of yourgems from ...
Solution 2: Gem In A Box● Provides more features, like the ability topush gems to the server.● Easy to set up:○ Create the...
The endQuestions?
Developing Rails Apps in Technical Isolation
Upcoming SlideShare
Loading in …5
×

Developing Rails Apps in Technical Isolation

711 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
711
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Developing Rails Apps in Technical Isolation

  1. 1. Jesus JacksonDeveloping Rails Apps inTechnical Isolation
  2. 2. Background● Live in Washington, D.C.● Software developer who has been leading aRuby on Rails project for over 2 years.● Developer advocate in a Java-based worldTeam Background● 15 developers● DoD clients in secure spaces● Development occurs on a restricted intranet- no way for our application to connect to theInternet.
  3. 3. Technical Isolation?No● Developing on an island :o)Yes● Developing apps on an intranet● No sudo privileges on servers● Dont have control over firewall rules
  4. 4. What do we do?
  5. 5. How do we manage our Rubies and gemsets behind afirewalled/restricted environment?Problem 1: Using RVM
  6. 6. Solution: RVM::FW● Created by Steven Haddox - a developer whoworked on my team and was instrumental inour success● https://github.com/stevenhaddox/rvm_fw● Sinatra app that runs on a Phusion enabledweb server● Works by modifying RVMs ~/.rvm/user/dbto point to an internal file which referenceyour Rubies.
  7. 7. Set up RVM::FW1) "rake boot:strap" to download Rubies andpackages2) Copy contents and deploy to your internal server3) Install RVM: "bash < <( curl http://<your-server>:<port>/releases/rvm-install-latest )"4) Configure RVM: "wget http://<your-server>:<port>/db -O ~/.rvm/user/db"5) "rvm reload"...and viola!
  8. 8. Using RVM::FW● Other projects on your network can now useyour server to install RVM::FW andmaintain their Rubies.● http(s)://[your_host]:[port]/db to get a listof rubies. Your users can copy and paste thecontents into their ~/.rvm/user/db to pointto your RVM::FW instance to download itsRubies.● http(s)://[your_host]:[port]/known - willprovide a list of available Rubies when userdoes "rvm list known"
  9. 9. Problem #2: CapistranoDeployment Gotchas
  10. 10. Using Capistrano● Not very difficult to set up, even in arestricted environment.● You need to set up key-based authentication,which was my teams primary challenge.Telnet and FTP are not supported.● By default, Capistrano attempts to use sudo."set :user_sudo, false" within deploy.rb tobypass this.
  11. 11. Capistrano● Place chmod task in deploy.rb to chmod 775so releases/### and releases/###/publicare accessible to Apache.namespace :permissions dodesc "chmod the release and public folder for Apache"task :make_public dorun "chmod 775 #{release_path}"run "chmod 775 -R #{release_path}/public"endend
  12. 12. Capistrano● Important to stop and restart Resqueworkersnamespace :resque dodesc "Stop resque workers"task :stop dobeginrun "cd #{shared_path}/path;RAILS_ENV=production bundle exec rake resque:stop"rescue Exception => eputs "!" * 80"ERROR: Unable to stop Resque workers: #{e}"puts "!" * 80endendend
  13. 13. How do we test email notifications when the SMTPserver is locked down?Problem 3: Testing Email
  14. 14. Testing Email Notifications● Emails blocked when being sent fromActionMailer● By default, ActionMailer delivery is sent toan SMTP server running on your localhoston port 25.● SMTP server wont receive emails and donthave ability to set up another full-fledgedSMTP server and configure ActionMailer toreference it
  15. 15. Solution: MailCatcher● Runs a lightweight SMTP server on yourlocalhost● Catches any emails sent to it and displaysemails in a nifty interface.● Configure your app to send mail to smtp://127.0.0.1:1025● View emails at http://127.0.0.1:1080
  16. 16. MailCatcher UI
  17. 17. Problem 4: Using GitHow to use Git in an SVN world
  18. 18. SVN is still prevalent● Every project on the contract used SVN● No official server or host for Git on theintranet.● Git was misunderstood and misinformationflew rapidly.● It was difficult for people to see the benefitsof a distributed versioning control systembecause of the small learning curve.
  19. 19. Solution: git svn● Tool allows you to use Git as a valid client,but push all of your changes to an SVNserver.● You can use the nifty features of Git locally(branching/merging, rebasing, etc.)● You can use Git locally while the rest of yourteam or organization uses SVN.● Its a great tool to get your teams feet wetwith Git without having to make a completecommitment.
  20. 20. Using git svn● "git svn clone [SVN URL] -s" - import yourSVN repo into your local Git repo● "git commit -am My awesome commitmessage" - commit locally without pushingto the SVN server. You can do this manytimes without modifying the SVN repo.● "git svn dcommit" - Push all of your changesto the SVN repo. Performs an SVN commitfor each one of your local commits.● "git svn rebase" - Pull all changes from theSVN repo and updates your local repo.
  21. 21. git svn caveat● Remember, youre still using SVN under thehood.○ Rebase your work as much as possible.○ Dont simultaneously interact with a Git repo.● SVN history is linear● A "git svn dcommit" rewrites your local Gitto include a unique ID. Workingsimultaneously with a remote Git repo canscrew things up. Keep it simple :o)
  22. 22. Solution 2: Gitlab● If you can host Git on a server, try Gitlab.● Allows you to manage multiple repos. Itspretty much your very own Github.● You can handle user access permissions,merge requests, issues, wikis, and codereviews.
  23. 23. Problem 5: Managing GemsHow do we host gems in restricted environments?
  24. 24. Solution: "gem server"● Rubygems comes with the command "gemserver"● Running this command will serve all of yourgems from http://localhost:8808● Visiting the address in your browser willprovide gem details.● When you install new gems, theyllautomatically be available through your gemserver.
  25. 25. Solution 2: Gem In A Box● Provides more features, like the ability topush gems to the server.● Easy to set up:○ Create the directory for storing gems○ Modify the config.ru file to point to the gemsdirectory.○ Run the server● Push gems via the "inabox" command:○ "gem inabox ./my-awesome-gem-1.0.0.gem"
  26. 26. The endQuestions?

×