This is the Ruby on Rails app powering the website of 'Die offene Gesellschaft'.
Install Ruby in correct version.
rvm install ruby-2.3.1
rvm use ruby-2.3.1
Install gems.
bundle install
Create a new MySQL dump.
ssh offenge@offenege.kochab.uberspace.de
timestamp=`date +%Y-%m-%d-%H-%M-%S`
mysqldump offenege > offenege-"$timestamp".sql
cp "offenege-$timestamp".sql latest.sql
Copy the dump to your local machine.
rsync -vP offenge@offenege.kochab.uberspace.de:~/latest.sql ./
Drop local database and read in dump.
rails db:drop
rails db:create
rails db:migrate
mysql -u offenege -p offenege < latest.sql
Copy all Paperclip attachements to your local machine.
rsync -rvP offenge@offenege.kochab.uberspace.de:~/offene-gesellschaft/public/system ./public/
Start the server components.
foreman start
Open a Rails console and create an initial admin.
rails c
Admin.new(email: 'mail@example.com', password: '12345678').save!
123-my-new-awesome-feature
dogtest.hamal.uberspace.de
v1.2
to deploy to production offenege.kochab.uberspace.de
Connect to one of the both environments
dogtest.hamal.uberspace.de
offenege.kochab.uberspace.de
with ssh and the provided key.
USER=dogtest # or 'offenege' for production
SERVER=hamal # or 'kochab' for production
ssh -i /path/to/provided/key $USER@$USER.$SERVER.uberspace.de
Re-run deploy hook
~/offene-gesellschaft.git/hooks/post-update
Restart services
svc -du ~/service/offene-gesellschaft
svc -du ~/service/offene-gesellschaft-worker
Migrate database
cd ~/offene-gesellschaft
rails db:migrate
Apply fixtures
cd ~/offene-gesellschaft
rails db:seed_fu FILTER=fixture-pattern-to-match
Monitor logs
tail -f ~/offene-gesellschaft/log/production.log
Set environment variables
cat >> ~/.bash_profile <<EOF
export KEY="value"
EOF