If you use Rails check out this useful Rails Security Checklist by Eliot Sykes.
I updated from Ubuntu 12.04 to Ubuntu 14.04 on a virtual private server.
When you do that update, Apache is updated from 2.2 to 2.4. Certain changes mean that until you update the site-available configuration files no web sites will work.
The quick checklist of what you have to do for each configuration
- update the file to add or edit the directory details (where /var/www/curiouscatnetwork.com/public_html/ is the path to the website files on your server)
Require all granted
Remember if you have details needed for WordPress those instructions need to remain. I didn’t have a Directory area listed on my non-Wordpress sites.
- The files now need a .conf extension so move the rename/move the files to the new name
[bash]sudo mv curiouscatnetwork.com curiouscatnetwork.com.conf[/bash]
- Enable the new configuration
[bash]sudo a2ensite curiouscatnetwork.com.conf[/bash]
- Reload apache to reload the new configuration
[bash]sudo service apache2 reload[/bash]
The upgrade to Ubuntu 14.04 LTS was interrupted (I quit a window using the wrong command – oops). Luckily it wasn’t a big deal. I was able to delete the lock file.
[bash]sudo rm /var/lib/dpkg/lock[/bash]
Then trying to update again
[bash]sudo apt-get dist-upgrade[/bash]
gave a message telling me what command to use to have the upgrade continue.
[bash]sudo dpkg –configure -a[/bash]
which seemed to work fine.
Two great hosts for Ruby on Rails are Slicehost and Linode. With these hosts you fully manager your virtual private server, installing the operating system, modifying apache (on Ning…), etc.. I use Ubuntu as the operating system and Apache as the web server.
If you are moving a domain from elsewhere it can be wise to reduce the TTL time to say 5 minutes a few days before you make the switch. This is make the change propagate across the internet more quickly.
- And DNS entry on your profile (login to your, for example, Linode account)
- Add a new file for /etc/apache2/sites-available/your_site_name.com
- create the directories needed on your server
- enable the site (for apache)
[bash]sudo a2ensite example.com[/bash]
- Test the site out to make sure the setup is working properly. Create a index.html page and just verify the page is displayed. Change your local hosts file to point to your server IP address for the new domain you created. If not, take steps to get this to work, before continuing with the rest of the checklist.
- copy over the site – if you are moving the site from elsewhere
- remember to move the database over, if the site relies on a database
- restart apache
[bash]sudo /etc/init.d/apache2 restart[/bash]
[bash]sudo nano /etc/apache2/sites-available/example.com[/bash]
The file would look something like this: with your ip in place of 220.127.116.11
ServerAdmin is the address Apache will use to send error messages to. Using gmail and the + option lets you use one gmail account and just use rules to filter all your sites.
You should see the file you created /etc/apache2/sites-available/example.com now also at /etc/apache2/sites-enabled/example.com
You can test the site out, before updating the DNS, by changing your local hosts file to point to your server IP address for the new domain you created.
Checklist for moving an existing WordPress site to a new web host
A checklist for moving an existing WordPress site to a new VPS web host, when you have full admin rights over the server.
- Set DNS TTL’s down to 5 minutes (a few days prior to the move). This will allow the nameserver update to propagate more quickly.
- Set up new domain on the new host (Checklist for setting up a new domain on your VPS)
- Install WordPress on new host
- Copy old content directory to new WordPress host
- Copy old database to new host (how to use secure copy to copy database to new server)
- Update wp-config on new host
- Enable mod_rewrite in Apache on the new server. From the command line:
- Restart apache
- Test that everything works (you can change your host file to test things out easily)
- Update registrar to point domain to the nameservers for the new host
If WordPress is up to date you could also just copy over everything for steps 1 and 2. I am using this for several sites I have had for years, I figure starting with a clean install of WordPress is a good idea, but it is not necessary.
for Rails 2.*
Not for Rails 3
How to add a model in rails
- ./script/generate resource MODELNAME
- edit migrate file
- edit model.rb – to add associations and validations
- edit controller.rb – add the 7 rest methods
- rake db:migrate – to run the new migration
- If you have to add a table (like a join table) you can do something like, for example
[ruby]./script/generate resource article[/ruby]
[ruby]./script/generate migration add_join_table_for_articles_and_authors[/ruby]
Update to the routes file should be taken care of by generate resource, but might want to check).