- create a fresh uberspace account
- ssh into the uberspace
- execute the following line:
\curl -sSL https://gist.githubusercontent.com/tessi/c429a4c34cefb6c69ee7/raw | bash -s stable
- visit https://your-uberspace-name.uberspace-server.uberspace.de/
Last active
February 17, 2018 02:59
-
-
Save tessi/c429a4c34cefb6c69ee7 to your computer and use it in GitHub Desktop.
NOT MAINTAINED: OpenProject Install Script for a fresh uberspace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
echo "this script installs openproject" | |
echo "things might take a while, please be patient" | |
echo "" | |
echo "setup environment..." | |
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 | |
echo "seeding openproject directory..." | |
mkdir apps; cd apps | |
git clone https://github.com/opf/openproject.git > /dev/null 2>&1 | |
cd openproject | |
git checkout stable > /dev/null 2>&1 | |
cat > config/configuration.yml <<__EOF__ | |
production: | |
email_delivery: | |
delivery_method: :sendmail | |
sendmail_settings: | |
location: /usr/sbin/sendmail | |
arguments: -i | |
rails_cache_store: :memcache | |
__EOF__ | |
export OPENPROJECT_DB=${USER}_openproject | |
export OPENPROJECT_DB_PASS=`grep -Po "(?<=password=).*(?= # )" ~/.my.cnf` | |
cat > config/database.yml <<__EOF__ | |
production: | |
adapter: mysql2 | |
database: $OPENPROJECT_DB | |
host: localhost | |
username: $USER | |
password: $OPENPROJECT_DB_PASS | |
encoding: utf8 | |
development: | |
adapter: mysql2 | |
database: $OPENPROJECT_DB | |
host: localhost | |
username: $USER | |
password: $OPENPROJECT_DB_PASS | |
encoding: utf8 | |
__EOF__ | |
cat > Gemfile.local <<__EOF__ | |
gem 'rails_12factor' | |
gem 'openproject-translations', :git => 'https://github.com/opf/openproject-translations.git', :branch => 'stable' | |
gem 'openproject-meeting', :git => 'https://github.com/finnlabs/openproject-meeting.git', :branch => 'stable' | |
gem 'openproject-pdf_export', :git => 'https://github.com/finnlabs/openproject-pdf_export.git', :branch => 'stable' | |
gem "openproject-backlogs", :git => "https://github.com/finnlabs/openproject-backlogs.git", :branch => 'stable' | |
gem 'openproject-documents', :git => 'https://github.com/opf/openproject-documents.git', :branch => 'stable' | |
__EOF__ | |
echo "installing ruby dependencies..." | |
gem install bundler > /dev/null 2>&1 | |
bundle install --quiet --path ~/.gem --without postgres:sqlite:test > /dev/null 2>&1 | |
echo "setting up database..." | |
RAILS_ENV=production bundle exec rake generate_secret_token db:create db:migrate db:seed > /dev/null 2>&1 | |
echo "installing bower dependencies..." | |
npm install -g bower > /dev/null 2>&1 | |
npm install > /dev/null 2>&1 | |
echo "precomiling assets..." | |
RAILS_ENV=production bundle exec rake assets:precompile > /dev/null 2>&1 | |
echo "searching a free port..." | |
export port=61000 | |
export port_max=65535 | |
export netstat_output=`netstat -atwn` | |
export server_port=`python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()'` | |
echo "initiating openproject services..." | |
test -d ~/service || uberspace-setup-svscan | |
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 $server_port --env production | |
__EOF__ | |
chmod +x ~/bin/openproject-web | |
uberspace-setup-service openproject-web ~/bin/openproject-web | |
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 | |
echo "setting up apache rewrite rules..." | |
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:$server_port/\$1 [P] | |
__EOF__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As this script is not maintained anymore, I did a new How To for OpenProject on Uberspace; including support for the latest version and Memcached: Install OpenProject (latest) with Memcached on Uberspace. I hope, this helps! :)