== README
These are all written with a 'systemd' linux distro in mind.
If you plan to deploy on a 'sysVinit' linux, adjust instructions appropriately
==== Tested with
* Archlinux x86_64 and armv6h
* Ruby 2.2.0 / Rails 4.0.4 / Passenger 4.0.57
==== System dependencies
* ruby v2+
* imagemagick
* postgres, v9+
* ruby-bundler (sudo gem install bundler --no-user-install)
==== How to run the test suite
* first write a test suite...
==== Legal
This work is licensed under the Creative Commons Attribution-ShareAlike 4.0
International License.
To view a copy of this license,
visit http://creativecommons.org/licenses/by-sa/4.0/.
==== Configure instructions
* copy config/application.rb.default to config/application.rb
* copy config/database.yml.default to config/database.yml
* copy config/yetting.yml.default to config/yetting.yml
* edit config/application.rb, adjust mailer settings
* edit config/database.yml, adjust passwords and whatnot
* edit config/yetting.yml, adjust mailer path, passwords, etc
* edit db/seeds.rb, add or remove default data
* only used for db:setup, remember to checkout if it conflicts during an update pull
* ie. sudo -u http -H git checkout -- db/seeds.rb
==== Development instructions
* copy and install gems
git clone http://git.gwillz.com.au/gwillz/apskoala.git
bundle install --path vendor/bundle
* do 'Configure' instructions
* initialize database and run
bundle exec rake db:setup
bundle exec rails s
==== Deployment instructions
* create an app directory and clone the git repo
sudo mkdir /home/rails && cd /home/rails
sudo chown http:http ./
sudo -u http -H git clone http://git.gwillz.com.au/gwillz/apskoala.git
* install gems and compile the passenger nginx module
cd apskoala
sudo -u http -H bundle install --path vendor/bundle
sudo bundle exec ./vendor/bundle/ruby/2.2.0/bin/passenger-install-nginx-module
* do 'Configure' instructions
* setup database (use same password set in database.rb)
sudo -u postgres -H initdb --locale en_AU.UTF-8 -E UTF8 -D '/var/lib/postgres/data'
sudo systemctl start postgresql
sudo -u postgres -H psql
within the postgres shell
create role koalas with createdb login password 'allhavechlamydia';
\q
* setup assets, initialize the database, update crontab
sudo -u http -H bundle exec rake assets:precompile RAILS_ENV=production
sudo -u http -H bundle exec rake db:setup RAILS_ENV=production
sudo -u http -H bundle exec whenever --update-crontab RAILS_ENV=production
* edit /opt/nginx/conf/nginx.conf
server {
listen 80 default_server;
server_name aps.gwillz.com.au;
passenger_enabled on;
passenger_app_env production;
root /home/rails/apskoala/public;
}
* set nginx to launch on boot up
sudo cp nginx.service /etc/systemd/system
sudo systemctl enable nginx
sudo systemctl start nginx
==== Deployment update
* pull the updated software
cd /home/rails/apskoala
sudo -u http -H git pull
* migrate the database and re-compile the assets if necessary
sudo -u http -H bundle exec rake db:migrate RAILS_ENV=production
sudo -u http -H bundle exec rake assets:clean RAILS_ENV=production
sudo -u http -H bundle exec rake assets:precompile RAILS_ENV=production
* restart nginx
sudo systemctl restart nginx