Thanks to @tessi and @jesk for their gists:
Some advantages to these gists:
- Use Memcached as cache server
- Works with latest version of OpenProject (6.1 and newer)
- Removed unnecessary instructions
If not already done, we initialize the daemontools first:
test -d ~/service || uberspace-setup-svscan
The latest versions of node.js are already preinstalled on theserver. You just have to add it to your $PATH. We use version 6, as it's the latest LTS release.
cat <<__EOF__ > ~/.bash_profile
export PATH=/package/host/localhost/nodejs-6/bin:$PATH
__EOF__
source ~/.bash_profile
We use npm (and have to update it with the global option), so we need to give it a config to not make our home directory visible to other users on the server:
cat > ~/.npmrc <<__EOF__
prefix = $HOME
umask = 077
__EOF__
The current version of npm distributed on Uberspaces is a bit old and has a fatal bug, so we need to install our own:
npm install npm@latest -g
Tell the shell to use our installed version instead of the one from Uberspace. We have to do this, because the first occurence within $PATH locations is used, so we need to add our own installation at the beginning:
cat <<__EOF__ > ~/.bash_profile
# Reread home directory for newer version of npm
export PATH=$HOME/bin:$PATH
__EOF__
Uberspace is a shared hosting service, so a global Memcached is a security risk. We need to install our own memcached (thanks to Florian Schmidt instructions; updated according to some instructions from Uberspace via Twitter:
toast arm https://memcached.org/files/memcached-1.4.33.tar.gz
And to manage it with the damontools, we have to set up its run file:
mkdir ~/etc/memcached
mkdir ~/etc/memcached/run-memcached
cd ~/etc/memcached/run-memcached/
cat <<__EOF__ > run
exec memcached -s $HOME/memcached.socket 2>&1
__EOF__
chmod +x run
And the logging daemon:
mkdir ~/etc/memcached/run-memcached/log
cd ~/etc/memcached/run-memcached/log/
cat <<__EOF__ > run
exec multilog t ./main
__EOF__
chmod +x run
Finally, we link the run script to start the daemon:
ln -s ~/etc/memcached/run-memcached ~/service/run-memcached
Please read the official installation instructions first!
I prefer to install OpenProject within ~/ror/openproject
, but you may change this to any directory within your user directory (but not within /var/www/virtual/
!).
mkdir ~/ror/openproject
cd ~/ror/openproject
Clone the OpenProject Community Edition git repository from GitHub (branch stable/6 is the current release branch with version 6.1 and so on):
git clone https://github.com/opf/openproject-ce.git --branch stable/6 --depth 1
cd openproject-ce/
Install OpenProject with all dependencies:
RAILS_ENV=production bundle install --without postgres sqlite development test therubyracer docker
npm install
Copy the example configuration files (you have to edit them both after this step):
cp config/database.yml.example config/database.yml
cp config/configuration.yml.example config/configuration.yml
In the database configuration file, you have to add your username, password (get it from your .my.cnf). Your database has to be prefixed with your username, following an underscore. For example (change %username
with your username and %password
with your password):
production:
adapter: mysql2
database: %username_openproject
host: localhost
username: %username
password: %password
encoding: utf8
You should do this for all environments (production, development, test).
The email_delivery_method
is sendmail, rails_cache_store
:memcache and you have the cache_memcache_server
should point to your memcached.socket
file used in the Memcached installation (e.g. "/home/%username/memcached.socket"
). All entries beginning with smtp_
should be commented out.
A minimal configuration file looks like (you can use this instead of copying the example file):
default:
email_delivery_method: sendmail
rails_cache_store: :memcache
cache_memcache_server: "/home/%username/memcached.socket"
You have to tell ruby to serve the static files itself: Change config.public_file_server.enabled = false
to true
!
Run last installation steps and seed sample data:
RAILS_ENV=production bundle exec rake db:create
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production LOCALE=de bundle exec rake db:seed
With the last command (db:seed
), you get a demo project and some useful status strings. With LOCALE, you can change the language of these (e.g. LOCALE=fr
for French or without for english). Just ignore this step and you have no sample data.
First of all, choose a port between 61000 and 65535 (OpenProject use its own server, so we have to redirect the traffic to this port) and then test, if it's not already in use (the command returns nothing, if it's free):
netstat -tulpen | grep %port
Change %port
with your selected port number.
Add the run script for your daemons (change username
with your username!):
mkdir ~/etc/openproject
mkdir ~/etc/openproject/run-openproject-web
cd ~/etc/openproject/run-openproject-web/
cat << __EOF__ > run
#!/bin/sh
# These environment variables are sometimes needed by the running daemons
export USER=username
export HOME=/home/username
# Include the user-specific profile
. $HOME/.bash_profile
# Now let's go!
export RAILS_ENV="production"
export OPENPROJECT_PATH="$HOME/ror/openproject/openproject-ce"
cd $OPENPROJECT_PATH/
__EOF__
chmod +x run
And, once again, the logging:
mkdir log
cat <<__EOF__ > log/run
exec multilog t ./main
__EOF__
chmod +x log/run
Copy all files for the worker daemon:
cd ..
cp -r run-openproject-web/ run-openproject-worker/
Add the actual commands to both run scripts:
cat <<__EOF__ > run-openproject-web/run
# Generate secret key for cookies
export SECRET_KEY_BASE=$(rake secret)
exec bundle exec unicorn --port %port --env production 2>&1
__EOF__
cat <<__EOF__ > run-openproject-worker/run
exec bundle exec rake jobs:work 2>&1
__EOF__
Link the run scripts to start the daemons (and OpenProject):
ln -s ~/etc/openproject/run-openproject-web ~/service/run-openproject-web
ln -s ~/etc/openproject/run-openproject-worker ~/service/run-openproject-worker
Add an .htaccess file to your document root for a RewriteRule with Proxy. Change the directory, if you want to access it within a subdirectory.
cd ~/html
cat <<__EOF__ > .htaccess
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{ENV:HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteRule (.*) http://localhost:63300/$1 [P]
Just open the url of your uberspace (e.g. username.server.uberspace.de
) or domain, where you added your redirect .htaccess and immediately change your admin password! Your current username and password is admin.
Now, you have to configure your installation to fit your needs. Some things you may change in the system configuration:
- General
- Hostname (the example may work)
- Protocol (you should set it to HTTPS)
- Authentication
- login required (check for private installations)
- self registration (deactivate for private installations)
- Notifications
- mail from
Please be aware that if you set/change a password for a user within the admin panel, it will be sent in clear text via email!
You can use zcat -f ~/service/run-openproject-web/log/main/* | tai64nlocal | less
to see the logging of the OpenProject web service.
With svc -du ~/service/run-openproject-web
, you can start and stop the service immidiately to reload configuration.
Hi,
thanks for this great manual! Unfortunately I get stuck at the very end and can't seem to fix the issue. Maybe you had this problem yourself and can help me? Any tip is much appreciated.
The services start fine and the port rediretion works also. Now when I open the domain I only get the
<div id="footer">
rendered. Hence, the browser just shows "Powered by OpenProject".However the
<div id="wrapper">
and its content is actually output and visible in the source but CSS definesdisplay = none;
.Also the console outputs these three errors: