Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install OpenProject on uberspace.de

How to install OpenProject on uberspace.de

Follow those steps to install OpenProject on a fresh uberspace.

Step 1: Install dependencies

First we set-up all dependencies. We use ruby 2.1.2 and install gems in a user directory:

echo "gem: --user-install --no-rdoc --no-ri" > ~/.gemrc
cat <<'__EOF__' >> ~/.bash_profile
export PATH=/package/host/localhost/ruby-2.1.2/bin:$PATH
export PATH=$HOME/.gem/ruby/2.1.0/bin:$PATH
export PATH=/package/host/localhost/nodejs-0.10.33/bin:$PATH
export LANG=en_US.UTF-8
__EOF__
cat > ~/.npmrc <<__EOF__
prefix = $HOME
umask = 077
__EOF__
cat > ~/.bowerrc <<__EOF__
{
  "interactive": false
}
__EOF__
source ~/.bash_profile

Verify that ruby --version gives you 2.1.2.

Step 2: Install OpenProject

Now it's time to install OpenProject:

mkdir apps; cd apps
git clone https://github.com/opf/openproject.git
cd openproject
git checkout stable
cat > config/configuration.yml <<__EOF__
production:
  email_delivery:
    delivery_method: :sendmail
    sendmail_settings:
      location: /usr/sbin/sendmail
      arguments: -i
rails_cache_store: :memcache
__EOF__
cp config/database.yml.example config/database.yml

Edit the config/database.yml file to use your uberspace MySQL credentials. Copy the username and passwort from the ~/.my.cnf file. Name your databases beginning with your uberspace username followed by an underscore and any name you like. For example: tessi_openproject if your uberspace account is "tessi".

Here is an example database.yml file:

# please make sure to replace "tessi" with your uberspace account name
# and change your password - you find it on your uberspace in ~/.my.cnf

production:
  adapter: mysql2
  database: <your uberspace name>_openproject
  host: localhost
  username: <your uberspace name>
  password: <secret>
  encoding: utf8

development:
  adapter: mysql2
  database: <your uberspace name>_openproject
  host: localhost
  username: <your uberspace name>
  password: <secret>
  encoding: utf8

We continue with setting up ruby gems.

cat > Gemfile.local <<__EOF__
gem 'rails_12factor'
__EOF__
gem install bundler
bundle install --path ~/.gem --without postgres:sqlite:test

We generate a secret token, and create/prepare the database:

RAILS_ENV=production bundle exec rake generate_secret_token db:create db:migrate db:seed

.. and prepare and bundle the assets

npm install -g bower
npm install
RAILS_ENV=production bundle exec rake assets:precompile

Step 3: Start OpenProject server

Find a free port for your OpenProject installation. I use the port 61621 - you need to replace that number with your port in the following files. This is the port your OpenProject server will listen to. The uberspace-apache will redirect all requests to that port.

We set-up daemontools services for a web- and a worker-process. They will (re)start automatically in case the uberspace server needs to restart.

Initialize svc on your uberspace:

test -d ~/service || uberspace-setup-svscan

Create the start script for the web-process:

cat <<__EOF__ > ~/bin/openproject-web
#!/bin/sh
# This is needed to find gems installed with --user-install
export HOME=$HOME
# Include our profile to get Ruby 2.1.2 included in our PATH
. \$HOME/.bash_profile
# Get into the project directory and start the Rails server
cd \$HOME/apps/openproject
exec bundle exec unicorn --port 61621 --env production
__EOF__
chmod +x ~/bin/openproject-web
uberspace-setup-service openproject-web ~/bin/openproject-web

Create the start script for the worker-process:

cat <<__EOF__ > ~/bin/openproject-worker
#!/bin/sh
# This is needed to find gems installed with --user-install
export HOME=$HOME
# we're faster and use the right database in production
export RAILS_ENV=production
# Include our profile to get Ruby 2.1.2 included in our PATH
. \$HOME/.bash_profile
# Get into the project directory and start the Rails server
cd \$HOME/apps/openproject
exec bundle exec rake jobs:work
__EOF__
chmod +x ~/bin/openproject-worker
uberspace-setup-service openproject-worker ~/bin/openproject-worker

We will make your OpenProject installation public with a RewriteRule using a Proxy

cat > ~/html/.htaccess <<__EOF__
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{ENV:HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

RewriteRule (.*) http://localhost:61621/$1 [P]
__EOF__

Step 4: You're done

You're done. Open the URL of your uberspace and you should see an OpenProject page waiting for you. You can log in with username admin and password admin.

If something goes wrong, you find logs at the following places:

~/service/openproject-web/log/main/current
~/service/openproject-worker/log/main/current

You can restart your web-/worker-processes with:

svc -du ~/service/openproject-web
svc -du ~/service/openproject-worker

The -d stands for "down". -u for "up".

Consider reading https://www.openproject.org/download/manual-installation/.

@nobias

This comment has been minimized.

Copy link

commented Aug 23, 2014

Is it possible that there's an indent missing in the configuration.yml that you create? The way it is done in your recipe doesn't work for me, the Actionmailer seems to ignore the configuration directives and reverts to some default (SMTP, port 25, localhost), which is not allowed on uberspace. Adding an indent from the second line on solves the problem for me. So I had to change Step 2 and run the following altered comand:

cat > config/configuration.yml <<__EOF__
production:
  email_delivery:
    delivery_method: :sendmail
    sendmail_settings:
      location: /usr/sbin/sendmail
      arguments: -i
__EOF__
@inkmix

This comment has been minimized.

Copy link

commented Oct 4, 2014

In step 2, you should maybe explicitly mention that one has to create databases. ;)

@jesk

This comment has been minimized.

Copy link

commented Dec 14, 2014

@tessi, thanks for your work. In order to resolve dependencies such as jquery you now need to use bower.
See my updated gist in https://gist.github.com/jesk/4a9358690087dcc78a59

@tessi

This comment has been minimized.

Copy link
Owner Author

commented Dec 29, 2014

I've migrated this guide to an automated script.

https://gist.github.com/tessi/c429a4c34cefb6c69ee7#file-readme-md

@DevWurm

This comment has been minimized.

Copy link

commented Feb 19, 2017

Awesome! Thank you very much.
I forked it and updated the guide to work with version 6 of OpenProject:
https://gist.github.com/DevWurm/2400b784e788609a4dbb1bbe291deb31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.