If you use Rails check out this useful Rails Security Checklist by Eliot Sykes.
Related: Ruby on Rails resources – Checklist for Setting Up a New Domain on VPS – Checklist for Moving WordPress site to a New Host
If you use Rails check out this useful Rails Security Checklist by Eliot Sykes.
Related: Ruby on Rails resources – Checklist for Setting Up a New Domain on VPS – Checklist for Moving WordPress site to a New Host
I am not a “real” system administrator but I manager sever VPS servers for my own web sites. This is what I did to update from Ubunutu LTS 10.04 to Ubunutu VPS 12.04.
[bash]do-release-upgrade[/bash]
But got the message
-bash: do-release-upgrade: command not found
Then I ran
[bash]sudo apt-get install update-manager-core[/bash]
Then I was able to run [bash]sudo do-release-upgrade[/bash]
This session appears to be running under ssh. It is not recommended to perform a upgrade over ssh currently because in case of failure it is harder to recover.
If you continue, an additional ssh daemon will be started at port ‘9004’.
Do you want to continue?
I look around on the web for advice. What’s the risk of upgrading over SSH? seems a good recap. I then continued. I then got this message
To make recovery in case of failure easier, an additional sshd will be started on port ‘1022’. If anything goes wrong with the running ssh you can still connect to the additional one.
If you run a firewall, you may need to temporarily open this port. As this is potentially dangerous it’s not done automatically. You can open the port with e.g.:
‘iptables -I INPUT -p tcp –dport 1022 -j ACCEPT’
The entire process took exactly 30 minutes, with the system restarting in Ubuntu 12.04.
Thankfully the upgrade seems to have gone without causing any problems. This is normally the case. But, even with a very small likelihood of encountering issues it is worrisome as those issues might pose some serious problems. Especially for someone with very limited system administration ability.
I am extremely thankful for all the programmers that created the code to make this process so straightforward and reliable.
[bash]lsb_release -a[/bash]
lets you see the current Ubunutu version you are running.
When I updated a server that had Ruby on Rails applications everything almost worked fine. Passenger was unable to load the application talking about
libmysqlclient_r.so.16: cannot open shared object file: No such file or directory – /usr/local/rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.11/lib/mysql2/mysql2.so
I was able to find the solution to that issue was to uninstall the mysql2 gem and then run bundle update: which worked great. The uninstall would work for me unless I was actually root (sudo didn’t work), so I used su to login as root and then
[bash]gem uninstall mysql2[/bash]
Then I went back to being my other user ran bundle update
[bash]bundle update rake[/bash]
Then everything was working fine.
Related: Keeping Your Hosted Ubuntu Web Server Software Up to Date – Adding a Key to Your Server for SSH Login – Checklist: Setting Up a New Domain on VPS
In Rails 2.x
script/generate controller [new controller name] [page you want create]
[code]script/generate controller search index[/code]
In Rails 3.x
[code]rails generate controller search index[/code]
To download a repository hosted on github
[bash]git clone [email protected]:account_name/repo_name.git[/bash]
The [email protected]:account_name/repo_name.git will be shown on the home page for the repository on github.com
To update your code from the master branch of the repo:
[bash]git pull origin master[/bash]
To commit the changes you have made locally:
[bash]git commit -m "the message explaining what these code changes did"[/bash]
To send your changes to the repo at github:
[bash]git push origin master[/bash]
Phusion Passenger manages resources for rails applications – spawning new instances as needed, etc..
Add lines to /etc/apache2/apache2.conf to change the default settings
PassengerMaxInstancesPerApp 5
– sets the maximum pool size for any 1 rails application to 10 instances (default is no limit).Related: Passenger documentation
If you try [bash]sudo passenger-status[/bash] and get something like
*** ERROR: Cannot query status for Passenger instance 2280:
Connection refused – /tmp/passenger.2280/info/status.socket
Restarting (not reloading) apache [bash]sudo /etc/init.d/apache2 restart[/bash] may fix the problem.
for Rails 2.*
Not for Rails 3
[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).