- Thanks to @tessi for the previous install guide
- Tested with: OpenProject 4.0
- Prerequisites: Fresh uberspace
First we set-up all dependencies. We use ruby 2.1.4
and install gems using rvm.
cd
gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable
source $HOME/.rvm/scripts/rvm
rvm autolibs disable
rvm install 2.1.4 # Compile and install ruby-2.1.4
rvm use --default 2.1.4
gem install bundler
cat <<'__EOF__' >> ~/.bash_profile
export LANG=en_US.UTF-8
source ~/.bash_profile
__EOF__
Now it's time to install OpenProject:
mkdir apps; cd apps
git clone https://github.com/opf/openproject.git
cd openproject
git checkout stable
We continue with setting up ruby gems. Hint: Keep the '--without'-flag - otherwise you get errors e.g. when installing the gem 'pg' ("Can't find the 'libpq-fe.h header").
RAILS_ENV=production bundle install --without postgres:sqlite:test
We then install all npm packages, then all dependencies of OpenProject using the package manager bower:
npm install
bower install
cat > config/configuration.yml <<__EOF__
production:
email_delivery_method: sendmail
rails_cache_store: :memcache
__EOF__
cp config/database.yml.example config/database.yml
Edit the config/database.yml
file to use the MySQL username and password as displayed in the file ~/.my.cnf
.
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 "yourname".
Here is an example database.yml
file:
# please make sure to replace "yourname" with your uberspace account name
# and change your password - you find it on your uberspace in ~/.my.cnf
production:
adapter: mysql2
database: yourname_openproject
host: localhost
username: yourname
password: <secret>
encoding: utf8
development:
adapter: mysql2
database: yourname_openproject
host: localhost
username: yourname
password: <secret>
encoding: utf8
test:
adapter: mysql2
database: yourname_openproject_test
host: localhost
username: yourname
password: <secret>
encoding: utf8
We generate a secret token, which is unique for every installation. It secures OpenProject cookies.
RAILS_ENV=production bundle exec rake generate_secret_token
Now we create and prepare the database
RAILS_ENV=production bundle exec rake db:create
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake db:seed
RAILS_ENV=production bundle exec rake assets:precompile
Next we create daemontools services for a web- and a worker-process. They will (re)start the OpenProject Server automatically in case the uberspace server needs to restart.
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.
Initialize svc on your uberspace:
test -d ~/service || uberspace-setup-svscan
Create the start script for the web-process (replace yourname
with your uberspace user name):
cat << __EOF__ > ~/bin/openproject-web
#!/bin/bash
export HOME=/home/yourname
export RAILS_ENV=production
# This is needed to find gems installed with --user-install
export USER=yourname
# activate rvm
. $HOME/.bash_profile
. ~/.rvm/scripts/rvm
. ~/.rvm/scripts/rvm use 2.1.4
# Get into the project directory and start the Rails server
cd $HOME/apps/openproject
exec $HOME/.rvm/gems/ruby-2.1.4@global/bin/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 (once more replace yourname
with your uberspace user name):
cat <<__EOF__ > ~/bin/openproject-worker
#!/bin/bash
export HOME=/home/yourname
export RAILS_ENV=production
# This is needed to find gems installed with --user-install
export USER=yourname
# activate rvm
. $HOME/.bash_profile
. ~/.rvm/scripts/rvm
. ~/.rvm/scripts/rvm use 2.1.4
# Get into the project directory and start the Rails server
cd $HOME/apps/openproject
exec $HOME/.rvm/gems/ruby-2.1.4@global/bin/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__
You're done. Open the URL of your uberspace (yourname.yourhost.uberspace.de) and you should see an OpenProject page waiting for you. If you want to serve it at a subdomain (e.g. openproject.yourname.yourhost.uberspace.de) precede the RewriteRule with the following line:
RewriteCond %{HTTP_HOST} ^openproject\. [NC]
You can log in with username admin
and password admin
. Please change the default admin password as soon as possible.
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".
If you have troubles installing OpenProject:
- You find logs at the following places:
~/service/openproject-web/log/main/current ~/service/openproject-worker/log/main/current ~/apps/openproject/log/production.log
- This guide uses RVM (even though it is not needed necessarily). If having troubles please read these notes: https://wiki.uberspace.de/development:ruby#rvm
- Consider reading https://www.openproject.org/download/manual-installation/
- Feel free to leave updates, feedback... in the comments so that the gist can be updated accordingly.
Hi @jesk, thanks for the update!
By the way, I've built an automated script out of a mixture of our guides. Look here: https://gist.github.com/tessi/c429a4c34cefb6c69ee7#file-readme-md