How I Set Up a New Web App

Share on:
  1. Create the directory, and run git init
  2. Add the repository to gitosis, add users, add webadmin with readonly access
  3. Initialize the Rails project, with rails .
  4. Initialize Capistrano, with capify .
  5. Add the .gitignore file
  6. Rename config/database.yml to config/database.[USER].yml, and softlink database.yml to that file, modifying it as necessary
  7. Modify the file config/deploy.rb; see other files for examples
  8. Install the secure_deploy plugin so that Mongrel does not require a sudo
  9. Create the file config/mongrel_cluster.yml; see other files for examples. Make sure to pick a new port number.
  10. Create an appropriate link for the project in /etc/mongrel_cluster
  11. Create the config/ file with the appropriate parameters for the MySQL database (must be before git commit, to ensure it makes it to the production location; rails won't run without it)
  12. Add a task :after_finalize_update to config/deploy.rb to softlink config/ to config/database.yml on the production site
  13. git remote add origin ssh://git@[SERVER]/[PROJECT]
  14. git add . ; git commit -m 'Initial import' ; git push origin master
  15. cap deploy:setup to create the directories
  16. Test cap deploy:update to make sure it works
  17. Run /etc/init.d/mongrel_cluster restart and make sure everything works, and test the new server using telnet into the port
  18. Create a new virtual host for the application with nginx and restart nginx, and test that the virtual host works
  19. Create the production MySQL database, with character set UTF8

Note that references to mongrel_cluster have been removed, since they are not relevant when using Passenger.