Skip to content

Instantly share code, notes, and snippets.

@DevWurm
Forked from tessi/installation.md
Last active March 3, 2018 13:25
Show Gist options
  • Save DevWurm/2400b784e788609a4dbb1bbe291deb31 to your computer and use it in GitHub Desktop.
Save DevWurm/2400b784e788609a4dbb1bbe291deb31 to your computer and use it in GitHub Desktop.
Install OpenProject 6 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.2.5 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.2.5/bin:$PATH
export PATH=$HOME/.gem/ruby/2.2.5/bin:$PATH
export PATH=/package/host/localhost/nodejs-6.9.1/bin:$PATH
export PATH=$HOME/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
npm install -g [email protected]

Verify that ruby --version gives you 2.2.5.

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 -b stable origin/stable/6
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:

cat <<'__EOF__' >> ~/.bash_profile
export SECRET_KEY_BASE=$(RAILS_ENV=production rake secret)
__EOF__
source ~/.bash_profile
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.2.5 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.2.5 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/.

@68040
Copy link

68040 commented Mar 15, 2017

Hello.

The installation with your receipt was unsuspicious. But when opening the URL of the uberspace i get nothing. Just errors in the log.

$ tailf ~/service/openproject-web/log/main/current
@4000000058c94f0c1d7a881c I, [2017-03-15T15:26:10.494500 #11603]  INFO -- : master complete
@4000000058c94f3336c5629c rake aborted!
@4000000058c94f3336c6b674 No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
@4000000058c94f3336ccf034 
@4000000058c94f3336cda7cc (See full trace by running task with --trace)
@4000000058c94f342fbaf0d4 I, [2017-03-15T15:26:50.800658 #28926]  INFO -- : listening on addr=0.0.0.0:61619 fd=11
@4000000058c94f342fbe57ec I, [2017-03-15T15:26:50.800964 #28926]  INFO -- : worker=0 spawning...
@4000000058c94f342fd35ebc I, [2017-03-15T15:26:50.802298 #28926]  INFO -- : master process ready
@4000000058c94f342fded454 I, [2017-03-15T15:26:50.802938 #29027]  INFO -- : worker=0 spawned pid=29027
@4000000058c94f342fe3838c I, [2017-03-15T15:26:50.803249 #29027]  INFO -- : Refreshing Gem list
@4000000058c94f481e5ad5fc Creating scope :open. Overwriting existing method WorkPackage.open.
@4000000058c94f4a1f94b1a4 Creating scope :like. Overwriting existing method Principal.like.
@4000000058c94f4a232e37cc Creating scope :active. Overwriting existing method IssuePriority.active.
@4000000058c94f4a292c42a4 Creating scope :not_builtin. Overwriting existing method User.not_builtin.
@4000000058c94f4b0d6924c4 Creating scope :open. Overwriting existing method Version.open.
@4000000058c94f4b3008c69c /home/myserve/apps/openproject/app/seeders/random_data/work_package_seeder.rb:84: warning: duplicated key at line 87 ignored: :user
@4000000058c94f5111bff00c I, [2017-03-15T15:27:19.297586 #29027]  INFO -- : worker=0 ready
@4000000058c94f64107445cc E, [2017-03-15T15:27:38.275934 #29027] ERROR -- : app error: Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml` (RuntimeError)
@4000000058c94f641078e17c E, [2017-03-15T15:27:38.276315 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/application.rb:513:in `validate_secret_key_config!'
@4000000058c94f64107ac9c4 E, [2017-03-15T15:27:38.276421 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/application.rb:246:in `env_config'
@4000000058c94f64107c832c E, [2017-03-15T15:27:38.276537 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:693:in `build_request'
@4000000058c94f64107e4464 E, [2017-03-15T15:27:38.276658 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/application.rb:521:in `build_request'
@4000000058c94f64107fde8c E, [2017-03-15T15:27:38.276768 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:521:in `call'
@4000000058c94f6410817c9c E, [2017-03-15T15:27:38.276874 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/railtie.rb:193:in `public_send'
@4000000058c94f64108316c4 E, [2017-03-15T15:27:38.276972 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/railtie.rb:193:in `method_missing'
@4000000058c94f64108489dc E, [2017-03-15T15:27:38.277077 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/rack-protection-2.0.0.beta2/lib/rack/protection/frame_options.rb:31:in `call'
@4000000058c94f64108608ac E, [2017-03-15T15:27:38.277172 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/rack-protection-2.0.0.beta2/lib/rack/protection/json_csrf.rb:21:in `call'
@4000000058c94f64108bd50c E, [2017-03-15T15:27:38.277557 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/rack-2.0.1/lib/rack/urlmap.rb:68:in `block in call'
@4000000058c94f64108d731c E, [2017-03-15T15:27:38.277658 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/rack-2.0.1/lib/rack/urlmap.rb:53:in `each'
@4000000058c94f64108e9814 E, [2017-03-15T15:27:38.277745 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/rack-2.0.1/lib/rack/urlmap.rb:53:in `call'
@4000000058c94f64108fb154 E, [2017-03-15T15:27:38.277817 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:562:in `process_client'
@4000000058c94f641091a554 E, [2017-03-15T15:27:38.277902 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/unicorn-worker-killer-0.4.4/lib/unicorn/worker_killer.rb:92:in `process_client'
@4000000058c94f6410935304 E, [2017-03-15T15:27:38.278019 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/unicorn-worker-killer-0.4.4/lib/unicorn/worker_killer.rb:52:in `process_client'
@4000000058c94f641094b67c E, [2017-03-15T15:27:38.278130 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:658:in `worker_loop'
@4000000058c94f641097cf74 E, [2017-03-15T15:27:38.278230 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:508:in `spawn_missing_workers'
@4000000058c94f641099a434 E, [2017-03-15T15:27:38.278431 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:132:in `start'
@4000000058c94f64109af03c E, [2017-03-15T15:27:38.278543 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/unicorn-5.1.0/bin/unicorn:126:in `<top (required)>'
@4000000058c94f6410a0958c E, [2017-03-15T15:27:38.278635 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/bin/unicorn:22:in `load'
@4000000058c94f6410a325cc E, [2017-03-15T15:27:38.279001 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/bin/unicorn:22:in `<top (required)>'
@4000000058c94f6410a471d4 E, [2017-03-15T15:27:38.279165 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:74:in `load'
@4000000058c94f6410a6524c E, [2017-03-15T15:27:38.279250 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:74:in `kernel_load'
@4000000058c94f6410a7c94c E, [2017-03-15T15:27:38.279378 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:27:in `run'
@4000000058c94f6410a8dabc E, [2017-03-15T15:27:38.279464 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/bundler-1.14.6/lib/bundler/cli.rb:335:in `exec'
@4000000058c94f6410aa1724 E, [2017-03-15T15:27:38.279539 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
@4000000058c94f6410abfb84 E, [2017-03-15T15:27:38.279624 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
@4000000058c94f6410ad301c E, [2017-03-15T15:27:38.279747 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
@4000000058c94f6410ae4d44 E, [2017-03-15T15:27:38.279823 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/bundler-1.14.6/lib/bundler/cli.rb:20:in `dispatch'
@4000000058c94f6410af917c E, [2017-03-15T15:27:38.279895 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
@4000000058c94f6410b0e16c E, [2017-03-15T15:27:38.279981 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/bundler-1.14.6/lib/bundler/cli.rb:11:in `start'
@4000000058c94f6410b20a4c E, [2017-03-15T15:27:38.280064 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/bundler-1.14.6/exe/bundle:32:in `block in <top (required)>'
@4000000058c94f6410b3238c E, [2017-03-15T15:27:38.280141 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/bundler-1.14.6/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
@4000000058c94f6410b43ccc E, [2017-03-15T15:27:38.280212 #29027] ERROR -- : /home/macserve/.gem/ruby/2.2.0/gems/bundler-1.14.6/exe/bundle:24:in `<top (required)>'
@4000000058c94f6410b58cbc E, [2017-03-15T15:27:38.280295 #29027] ERROR -- : /package/host/localhost/ruby-2.2.5/bin/bundle:22:in `load'
@4000000058c94f6410b6a214 E, [2017-03-15T15:27:38.280370 #29027] ERROR -- : /package/host/localhost/ruby-2.2.5/bin/bundle:22:in `<main>'

@Tschoepler
Copy link

Tschoepler commented Mar 29, 2017

Hi,

when I enter gem install bundler I get this:

WARNING:  You don't have /home/<uberspace username>/.gem/ruby/2.2.0/bin in your PATH,
	  gem executables will not run.
Successfully installed bundler-1.14.6
1 gem installed

Can that warning be ignored?

Because the next step bundle install --path ~/.gem --without postgres:sqlite:test seems to execute fine:

Bundle complete! 118 Gemfile dependencies, 187 gems now installed.
Gems in the groups postgres, sqlite and test were not installed.
Bundled gems are installed into /home/tsp4/.gem.

Although it throughs a warning, too:

Your Gemfile lists the gem rails_12factor (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of one of them later.

Thanks for your help

@Tschoepler
Copy link

And on npm installit throws these warnings at me. Did you get the same?

> [email protected] postinstall /home/tsp4/apps/openproject
> cd frontend && npm install


> [email protected] postinstall /home/tsp4/apps/openproject/frontend
> bower install --config.interactive=false

npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

@Tschoepler
Copy link

Tschoepler commented Mar 29, 2017

@Connor0308
Same here. It has to be export secret_key_base=$(RAILS_ENV=production rake secret)
In DevWurm's code it is SECRET_KEY_BASE which is wrong. Capitalization has to match ~/apps/openproject/config/secrets.yml

@quazgar
Copy link

quazgar commented Jun 12, 2017

Has anyone had success adapting this to OpenProject 7.0? I only get a nearly empty page which just says "Powered by OpenProject". I replaced the ruby version in the PATH to 2.4, commented out the memcache option for the moment and am using a different port. No errors, only infos displayed in the logs of both openproject-web and openproject-worker.

@2martens
Copy link

The problem seems to be that the public directory is outside the DocumentRoot and therefore not accessible by Apache. In the manual installation example of OpenProject they assume that you set up a virtual server with its own document root inside the public directory but that is not possible for Uberspace. Therefore I assume that you need to tell OpenProject somehow to compile the assets inside the document root and access them there.

@quazgar
Copy link

quazgar commented Feb 28, 2018

I just tried the solution from your website, @2martens. It shows the plain html of the start page, but all other elements are not fetched, they all fail with a 404 error. You can test my current behaviour at https://quazgar2.centaurus.uberspace.de/

@quazgar
Copy link

quazgar commented Mar 3, 2018

Hi, I created a repo wih a script to automate the installation, it can be found here https://github.com/quazgar/openproject_install, feel free to clone and improve it. Disclaimer: Does not work yet for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment