How I Set Up a New Web App
- Create the directory, and run git init
- Add the repository to gitosis, add users, add webadmin with readonly access
- Initialize the Rails project, with rails .
- Initialize Capistrano, with capify .
- Add the .gitignore file
- Rename config/database.yml to config/database.[USER].yml, and softlink database.yml to that file, modifying it as necessary
- Modify the file config/deploy.rb; see other files for examples
Install the secure_deploy plugin so that Mongrel does not require a sudo Create the file config/mongrel_cluster.yml; see other files for examples. Make sure to pick a new port number. Create an appropriate link for the project in /etc/mongrel_cluster
- Create the config/database.prod.yml 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)
- Add a task :after_finalize_update to config/deploy.rb to softlink config/database.prod.yml to config/database.yml on the production site
- git remote add origin ssh://git@[SERVER]/[PROJECT]
- git add . ; git commit -m 'Initial import' ; git push origin master
- cap deploy:setup to create the directories
- Test cap deploy:update to make sure it works
Run /etc/init.d/mongrel_cluster restart and make sure everything works, and test the new server using telnet into the port
- Create a new virtual host for the application with nginx and restart nginx, and test that the virtual host works
- 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.