INSTALLING WAGN-BEHIND-APACHE FROM A GEM: ATTEMPT 1 (Assume all commands were using sudo unless otherwise noted.) PART I: GETTING WAGN ITSELF UP AND RUNNING 1. On DigitalOcean, created a basic Ubuntu 12.04 x32 server, 512MB RAM, 20GB SSD. 2. Logged in as root, created a user, added user to sudoers, disabled root ssh, logged out. 3. Logged in as user, used apt-get update, apt-get upgrade, and apt-get dist-upgrade. 4. Examined wagn-as-gem documentation here: http://rubydoc.info/gems/wagn/1.12.12/frames 5. Installed mysql 5.5.35 via apt-get install mysql-sever (set root password). 6. Installed ruby 1.9.3p0 via apt-get install ruby1.9.3. 7. Installed bundler 1.5.3 via gem install bundler. 8. Installed ImageMagick 8:6.6.9.7-6ubuntu3.2 via apt-get install imagemagick. 9. Attemtped gem install wagn, received the following error: Building native extensions. This could take a while... ERROR: Error installing wagn: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb creating Makefile make sh: 1: make: not found Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.8.1 for inspection. Results logged to /var/lib/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out 10. Installed build-essential 11.5ubuntu2.1 via apt-get install build-essential 11. Attempted gem install wagn, received the following error: Can't install RMagick 2.13.2. Can't find Magick-config in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/bin/ruby1.9.1 Gem files will remain installed in /var/lib/gems/1.9.1/gems/rmagick-2.13.2 for inspection. Results logged to /var/lib/gems/1.9.1/gems/rmagick-2.13.2/ext/RMagick/gem_make.out 11. Installed libmagickcore-dev and libmagickwand-dev via apt-get install libmagickcore-dev libmagicwand-dev 12. Attempted gem install wagn, succeeded. 13. Attmpted wagn new mysite, received the following error: Using macaddr (1.6.5) Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb checking for ruby/thread.h... no checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lmygcc... no checking for mysql_query() in -lmysqlclient... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/bin/ruby1.9.1 --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysql-config --without-mysql-config --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysqlclientlib --without-mysqlclientlib --with-mlib --without-mlib --with-mysqlclientlib --without-mysqlclientlib --with-zlib --without-zlib --with-mysqlclientlib --without-mysqlclientlib --with-socketlib --without-socketlib --with-mysqlclientlib --without-mysqlclientlib --with-nsllib --without-nsllib --with-mysqlclientlib --without-mysqlclientlib --with-mygcclib --without-mygcclib --with-mysqlclientlib --without-mysqlclientlib Gem files will remain installed in /var/lib/gems/1.9.1/gems/mysql2-0.3.15 for inspection. Results logged to /var/lib/gems/1.9.1/gems/mysql2-0.3.15/ext/mysql2/gem_make.out An error occurred while installing mysql2 (0.3.15), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.3.15'` succeeds before bundling. 14. Installed mysql-client and libmysqlclient-dev via apt-get install mysql-client libmysqlclient-dev 15. Deleted existing mysite folder. 16. Attempted wagn new mysite, succeeded. 17. Edited mysite/config/database.yml to provide mysql root password set in step 5, in all three blocks. 18. From the mysite folder (docs note -- they tell you explicitly to then "cd mysite", but if you followed the instructions to edit the database file, you're no longer in the parent folder), attempted rake wagn:create, succeeded. 19. Issued wagn server, success! 20. Took server snapshot on digitalocean's dashboard, so I can return to this state later as needed. PART II: GETTING WAGN RUNNING BEHIND APACHE 1. Found these notes here: http://www.two-drifters.com/?p=21 2. Installed apache 2.2.22-1ubuntu1.4 via apt-get install apache2. 3. Tested connection, success. 4. installed passenger and xsendfile modules via apt-get install libapache2-mod-passenger libapache2-mod-xsendfile 5. Noticed that this installed ruby 1.8.7, which appears to now be my default ruby. 6. Used "rm /usr/bin/ruby" and ln -s /usr/bin/ruby1.9.3 /usr/bin/ruby to make ruby1.9.3 the default again. 7. Saw a note about rdoc-data needing to be installed manually on above page, recalled an error about that flying by, installed it via gem install rdoc-data, and rdoc-data --install. 8. Enabled apache modules; a2enmod expires, a2enmod headers, ('xsendfile' on page linked was already enabled) restarted apache with service apache2 restart. 9. Went into mysite folder and issued rake wagn:copy_htaccess 10. Created file in /etc/apache2/sites_available with filename www.mysite.blah with the following data: ServerName www.mysite.blah # !!! Be sure to point DocumentRoot to ‘public’! DocumentRoot /var/lib/gems/1.9.1/gems/wagn-1.12.12/public # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews 11. Made sure wagn was running with wagn server -d 12. Restarted apache with service apache2 restart 13. Got the default site still. 14. Disabled default with a2dissite default. 15. Issued service apache2 reload to activate the new config. 16. Received an internal server error. 17. Tried to check passenger status with passenger-status and received an error: /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- phusion_passenger/admin_tools/control_process (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /usr/sbin/passenger-status:27:in ` ' 18. Attempted installing passenger gem with "gem install passenger", gem install, but received an error about the ridocs. 19. Same issue when trying passenger-status. Found this documentation on passenger: http://www.modrails.com/documentation/Users%20guide%20Apache.html#install_on_debian_ubuntu 20. Ran passenger-install-apache2-module and received the following failure output: * To install Curl development headers with SSL support: Please run apt-get install libcurl4-openssl-dev or libcurl4-gnutls-dev, whichever you prefer. * To install OpenSSL development headers: Please install it with apt-get install libssl-dev * To install Apache 2 development headers: Please install it with apt-get install apache2-threaded-dev * To install Apache Portable Runtime (APR) development headers: Please install it with apt-get install libapr1-dev * To install Apache Portable Runtime Utility (APU) development headers: Please install it with apt-get install libaprutil1-dev 21. apt-get install libcurl4-openssl-dev (success) 22. apt-get install libssl-dev (already installed?) 23. apt-get install apache2-threaded-dev (success) 24. apt-get install libapr1-dev (already installed?) 25. apt-get install libaprutil1-dev (already installed?) 26. Ran passenger-install-apache2-module again, success, with the following instructions: Please edit your Apache configuration file, and add these lines: LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-4.0.37/buildout/apache2/mod_passenger.so PassengerRoot /var/lib/gems/1.8/gems/passenger-4.0.37 PassengerDefaultRuby /usr/bin/ruby1.8 After you restart Apache, you are ready to deploy any number of web applications on Apache, with a minimum amount of configuration! 27. Disabled passenger module with a2dismod passenger. 28. Stopped apache with service apache2 stop. 29. Edited /etc/apache2/mods-available/passenger.load with the following line: LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-4.0.37/buildout/apache2/mod_passenger.so 30. Edited /etc/apache2/mods-available/passenger.conf with the following: PassengerRoot /var/lib/gems/1.8/gems/passenger-4.0.37 PassengerDefaultRuby /usr/bin/ruby1.8 31. Re-enabled passenger with a2enmod passenger. 32. Re-started apache with service apache2 start. 33. I now receive a phusion passenger page with the following error: no such file to load -- bundler/setup (LoadError) /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require' /var/lib/gems/1.8/gems/passenger-4.0.37/lib/phusion_passenger/loader_shared_helpers.rb:245:in `run_load_path_setup_code' /var/lib/gems/1.8/gems/passenger-4.0.37/lib/phusion_passenger/loader_shared_helpers.rb:348:in `running_bundler' /var/lib/gems/1.8/gems/passenger-4.0.37/lib/phusion_passenger/loader_shared_helpers.rb:243:in `run_load_path_setup_code' /var/lib/gems/1.8/gems/passenger-4.0.37/helper-scripts/rack-preloader.rb:100:in `preload_app' /var/lib/gems/1.8/gems/passenger-4.0.37/helper-scripts/rack-preloader.rb:158 Application root /var/lib/gems/1.9.1/gems/wagn-1.12.12 34. Seeing that this can be a Ruby version issue, I stop apache (as above) disable the passenger module (as above), edit passenger.conf file to point at /usr/bin/ruby for the PassengerDefaultRuby , re-enable passenger (as above), start apache back up, and now receive the following error when browsing the site: There was a Errno::ENOENT while loading wagn.gemspec: No such file or directory - git ls-files from /var/lib/gems/1.9.1/gems/wagn-1.12.12/wagn.gemspec:17:in ``' (Bundler::GemspecError) /var/lib/gems/1.9.1/gems/bundler-1.5.3/lib/bundler.rb:387:in `rescue in eval_gemspec' /var/lib/gems/1.9.1/gems/bundler-1.5.3/lib/bundler.rb:376:in `eval_gemspec' /var/lib/gems/1.9.1/gems/bundler-1.5.3/lib/bundler.rb:347:in `block in load_gemspec_uncached' /var/lib/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/shared_helpers.rb:52:in `chdir' /var/lib/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/shared_helpers.rb:52:in `chdir' /var/lib/gems/1.9.1/gems/bundler-1.5.3/lib/bundler.rb:342:in `load_gemspec_uncached' /var/lib/gems/1.9.1/gems/bundler-1.5.3/lib/bundler.rb:332:in `load_gemspec' /var/lib/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/dsl.rb:51:in `gemspec' /var/lib/gems/1.9.1/gems/wagn-1.12.12/Gemfile:4:in `eval_gemfile' /var/lib/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/dsl.rb:30:in `instance_eval' /var/lib/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/dsl.rb:30:in `eval_gemfile' /var/lib/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/dsl.rb:9:in `evaluate' /var/lib/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/definition.rb:26:in `build' /var/lib/gems/1.9.1/gems/bundler-1.5.3/lib/bundler.rb:152:in `definition' /var/lib/gems/1.9.1/gems/bundler-1.5.3/lib/bundler.rb:115:in `setup' /var/lib/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/setup.rb:17:in ` ' /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `require' /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require' /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require' /var/lib/gems/1.8/gems/passenger-4.0.37/lib/phusion_passenger/loader_shared_helpers.rb:245:in `block in run_load_path_setup_code' /var/lib/gems/1.8/gems/passenger-4.0.37/lib/phusion_passenger/loader_shared_helpers.rb:348:in `running_bundler' /var/lib/gems/1.8/gems/passenger-4.0.37/lib/phusion_passenger/loader_shared_helpers.rb:243:in `run_load_path_setup_code' /var/lib/gems/1.8/gems/passenger-4.0.37/helper-scripts/rack-preloader.rb:100:in `preload_app' /var/lib/gems/1.8/gems/passenger-4.0.37/helper-scripts/rack-preloader.rb:158:in ` ' /var/lib/gems/1.8/gems/passenger-4.0.37/helper-scripts/rack-preloader.rb:29:in ` ' /var/lib/gems/1.8/gems/passenger-4.0.37/helper-scripts/rack-preloader.rb:28:in ` ' Application root /var/lib/gems/1.9.1/gems/wagn-1.12.12 35. This is pretty much where I stop for today because I'm not at all sure what the above means (the file /var/lib/gems/1.9.1/gems/wagn-1.12.12/wagn.gemspec exists), I want to back out and try to avoid getting Ruby 1.8 installed at all, I think manually installing phusion passenger might work better, and I have other stuff I have to attend to.