Skip to content

Instantly share code, notes, and snippets.

@os6sense
Last active December 27, 2015 17:29
Show Gist options
  • Save os6sense/7362770 to your computer and use it in GitHub Desktop.
Save os6sense/7362770 to your computer and use it in GitHub Desktop.
vagrant + rubber + ubuntu 13.10 + rvm
Trying to use vagrant + rubber + ubuntu 13.10 (box, probably other versions).
Most of the docs cover basic setup but I ran into a couple of problems not covered anywhere (does no-one use this combo before deploying to AWS?)
~ vagrant up
# OR
~ vagrant provision
-> [BUG] Segmentation fault ruby 1.9.3p194 (blah blah)
It seems its necessary to use rvm to switch to 1.9.3 p194 on the host
~ rvm install ruby-1.9.3-p194
~ rvm use 1.9.3-p194
~ bundle install
~ bundle install --deployment
(If there are any gems pulled from git sources this gets rid of that error too)
~ vagrant provision
# Note about rbm_ruby_version in Vagrant file
rubber.rvm_ruby_version = 'ruby-2.0.0-p247'
This seems to be totally ignored...
# Note about destroying the box and being unable to connect via ssh
The fingerprint will have changed preventing ssh from connecting. Remove any references to the old host from ~/.ssh/known_hosts
# instance-<name>.yml - not sure about this but it appears NOT to be regenerated on everyrun. I had misnamed my server the first time setting up and had to edit this manually to correct it before getting it up and running
# Passenger and apache.
a2enmod rewrite && a2enmod ssl && a2enmod expires && a2enmod xsendfile && a2ensite r4blog-passenger
ERROR:
Site r4blog-passenger does not exist.
The r4blog-passenger file in /etc/apache2/sites-available needs the .conf extension (http://serverfault.com/questions/528502/a2ensite-error-site-not-exist-when-creating-virtualhost-apache2-on-ubuntu)
# rubber.rubber_env
This needs to be a sensible value : rubber.rubber_env = 'development' # or 'staging' or 'production' since a few .yml files are preconfgured for this.
database *sigh*
Access denied for user ''@'default' to database
Note above that no user is specified - check http://stackoverflow.com/questions/11144502/mysql-wont-connect-on-ec2-deploying-with-rubber/12740989#12740989 and peterepts reply regarding adding:
mysql -u root -e "delete from mysql.user where user='';"
to ./config/rubber/deploy-mysql.yml:
Still doesn't work? Quick fix, vagrant destroy since there are some first run scripts for setting up the database and users.
# APACHE + PASSENGER (again)
if apache hangs at startup : might be several things
passenger start
Check the output here ensuring that you have forwarded the appropriate posts in Vagrantfile
1) Permissions on tmp/cache. These were initially owned by the app_user - maybe an artifact post-issue?
2) It may be neccessary to update config/rubber/role/passenger/passenger-apache-vhost.conf
#lj addition - without this the log will be filled with the error
# authz_core:error client denied by server config
# and you will get forbidden messages when trying to access by webrowser
# See : http://httpd.apache.org/docs/2.4/upgrading.html
<Directory <%= Rubber.root + "/public" %>
Require all granted
</Directory>
# WEB-TOOLS (***!!!)
If you get the error:
ImproperlyConfigured: The SECRET_KEY setting must not be empty.
*ppppffft*. This one took me a while. The graphite version is broken under ubuntu 13.10. The configuration logic is a *MESS* for graphite, which results in user specified variables in local_settings.py being over-written by anything in app_settings.py yet in app_settings.py it says "# DO NOT MODIFY THIS FILE DIRECTLY - use local_settings.py instead". !!!.
To fix this there are probably a number of ways to go about it, however I opted to copy the copy of app_settings.py installed on the vagrant box back to the hosts config/rubber/role/graphite_web/ directory, and then editing the SECRET_KEY in that file. Also add to the top of the file:
<%
@path = '/opt/graphite/webapp/graphite/app_settings.py'
%>
If you get the error:
Site r4blog-tools does not exist.
update config/rubber/role/web_tools/tools-apache-vhost.conf
@path = "/etc/apache2/sites-available/#{rubber_env.app_name}-tools.conf"
If you get the error:
Rubber[ERROR]: No such file or directory - htpasswd -nb admin
If you get the error:
Invalid command 'RewriteLog', perhaps misspelled or defined by a module not included in the server configuration
edit config/rubber/role/web_tools/tools-apache-vhost.conf and comment out RewriteLog
if you get the error:
/etc/monit/monit.d/<whatever>.conf:6: Error: syntax error 'default'
This has been fixed in https://github.com/rubber/rubber/pull/415/files (committed 3 days after I started playing *mutter*)
Note that while this suppresses the error, I've not tested yet and suspect things might not quite work...).
if you get the error:
SuspiciousOperation: Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS):
When viewing graphite
to
config/rubber/role/graphite_web/local_settings.py
config/rubber/role/graphite_web/app_settings.py
One or the other, or given how funky (and I use the word in its pejorative sense) graphites config section is, possibly both!
HAPROXY
Hmmm puzzling. The vagrant box seems to insist on pushing forwards from port 80 -> 2200 (did I miss something in the docs). Once I started using that port externally haproxy looked up and running using the local and remote ports.
All this *seems* to leave to fix are :-
- how do I change the host name from "default"?
- Why is monit showing apache as failed?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment