Top Menu

Jump to content
Home
    Modules
      • Projects
      • Activity
      • Work packages
      • Gantt charts
      • Calendars
      • Team planners
      • Boards
      • News
    • Getting started
    • Introduction video
      Welcome to OpenProject Community
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Enterprise support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Gantt charts
    Gantt charts
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • News
  • Forums

Content

Support Installation & Updates
  1. OpenProject
  2. Forums
  3. Support Installation & Updates
  4. OP on Debian Wheez Vserver

OP on Debian Wheez Vserver

Added by Don Sefer about 10 years ago

hello ladies and gentleman,

with great interest I read about this software and decided to give it a try, for personal use only! With 2 fellow students I was looking for a software to handle our B.Sc. project…

Now I ran into several problems… First I wanted to setup OpenProject-CE in an virtual machine running debian… the download speed is horrible slow (40kbit/s) and I received errors after finishing the download (incomplete package, yay)…

Ok, I have an vserver running (2vCore, 2gb guarenteed ram, 50gb) and installed the package via package manager. The setup wasn’t a problem at all for me (generated a ssl certificate before) and setup “everything”…

Now the following problems and questions are left open:
1. What are standard passwords for databases, users and other things (mysql, apache server….) preconfigured through the package? It felt like my server was a cheese after the setup, open for everyone…
2. I was able to reach the website via “https://mydomain.com/” but the domain within the address bar was something like “https://mydomain.com/?redirect=mydomain.com”. How can I change this behavior?
3. I want to use nginx because I planned to setup an etherpad, too. I would like my OpenProject being reachable via “https://mydomain.com/openproject/”. Is it possible to manage that?

I hope you can help me with my questions. Excuse my grammar mistakes please!

best regards
Sefer


Replies (15)

RE: OP on Debian Wheez Vserver - Added by Don Sefer about 10 years ago

Is this community and support dead? :(

I am very disappointed that the documentation is that bad and I can’t help myself at the moment because I am a beginner…

To number 2: the url was http://domain.net/login?back_url=https%3A%2F%2Fdomain.net%2F
I guess there is something wrong!

To the nginx part… Today I was trying to setup v4 with nginx but failed. I don’t want to use nginx and apache side-by-side to be honest…

Is there anyone who can help and is willing to help with an install with nginx? There are a lot of users who would like to receive help with the same topic as far as I found out using google…

The only tutorial I found is using OP 3.0 and even then I wasn’t able to get it to run properly and not everything is explained.

RE: OP on Debian Wheez Vserver - Added by Jonas Heinrich (Finn) about 10 years ago

Hi Don,

great to hear that you want to use our software. And sorry that you had to wait so long.
To answer your questions:
1. To see what passwords etc are used you can type sudo openproject-ce config. That gives you a list of all environment variables used by the packaged based installation. And via those environment variable the passwords etc are set. To understand the outlook let’s look at one line of the output I got:
DATABASE\_URL=mysql2://openproject\_ce:qI9RXgpSL9DMiSqVRXV4fdxi89izSYqX@127.0.0.1:3306/openproject\_ce
This means that the user openproject_ce with the password qI9RXgpSL9DMiSqVRXV4fdxi89izSYqX connects on 127.0.0.1 port 3306 with the mysql database openproject_ce. Does that help you?
2. That is a redirect because you are not logged in. I see that it does not seem to make sense when you are redirected to the same page. But if you would try to go to a private project without being logged in you would also be redirected. And this redirect would ensure that you are redirected to the correct project after you log in. So I do not think this is but. :)
3. Both, nginx and the subdirectory is possible. But I think you would have to do a lot do switch the package based installation to this. Probably the steps you had to take would add up to the same amount you would do when following the manual installation. So if you would like to run OpenProject with nginx and in a subdirectory I would recommend the manual installation. If you run into any problems with this we are happy to help you.

I hope I could help you a bit.
Best,

Jonas

RE: OP on Debian Wheez Vserver - Added by Don Sefer about 10 years ago

Hi Jonas,
thanks for your answer!

I tried to follow the Manual Installation Guide up to Apache and stopped there.
From that point on I tried to follow the “guide” here
https://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html#install_on_debian_ubuntu

But I cannot get it to run… I receive an error when trying to access the webpage… My installation is maybe a mess somehow. But since there is no guide how to install it with nginx I tried with playing a bit… Maybe you could help me out with the nginx installation part?

cannot load such file — bundler/setup (LoadError)
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:278:in `block in run_load_path_setup_code’
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:381:in `running_bundler’
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:276:in `run_load_path_setup_code’
/usr/share/passenger/helper-scripts/rack-preloader.rb:99:in `preload_app’
/usr/share/passenger/helper-scripts/rack-preloader.rb:157:in `module:App’
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `module:PhusionPassenger’
/usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `

’

I also tried to install the openproject-ce package on my virtual machine (in state nearly as my server)… But the installation failed because I have a different mysql root password set (the install won’t prompt for the password, it just aborts) …

This is my current server config with which I have to work with!!!

- Etherpad-Lite

- nginx-full

- node.js (http://nodejs.org/dist/node-latest.tar.gz) compiled and installed

- iptables / fail2ban
- mysql installed and configured

I have to work with this config. I think I can’t play with the node.js installation because I don’t know if etherpad would work. But I guess I can still work with nodeenv as an additional installation…
I can play around with nginx because I am just using a config to access the pad via domain.net/pad instead of domain.net:9001/pad

Best regards
Don

RE: OP on Debian Wheez Vserver - Added by Don Sefer about 10 years ago

Ok, got it working…

I noted down what I did… Would need someone to verify this procedure before I post the guide to the public… Or should I just post it? I used the manual setup until the apache part and then went on with nginx playing…

EDIT: Do I have to restart the server or something if I edit config/configuration.yml later on? I tried to get mail to work but I always end up with the following error:

Error occurred while trying to send an email (Connection refused - connect(2) for "localhost" port 25).

Could you help me out with sendmail? Do I have to install any additional package to use the sendmail feature and how should a valid configuration.yml look like? I know .yml is very sensitive…

EDIT2: after editing config/configuration.yml and touching the restart.txt, the whole server crashed and OP wasn’t working anymore… I always ended up with the message “not enough memory…” so I had to restart my whole virtual server :/

RE: OP on Debian Wheez Vserver - Added by Jonas Heinrich (Finn) about 10 years ago

Hi Don,

I just wanted to say: nice to hear your success message. But then I read that things didn’t turn out so well in the end. Sorry to hear that. What’s your status now?

Could you just paste here, what you did to get OpenProject running with Nginx? Then I can have a look at it. Or even better, describe your system (e.g. Ubuntu?) and everything you’ve done. Well, everything you’ve done to install OpenProject ;)

And I can also have a look at sendmail when we are at this point :)

Cheers,

Jonas

RE: OP on Debian Wheez Vserver - Added by Don Sefer about 10 years ago

Hi Jonas,

my system pre-installation was: Debian Wheezy
Software running: btsync, etherpad, node.js compiled from source, nginx from repo, iptables, fail2ban …

Do I always have to restart the server using “touch ~/openproject/tmp/restart.txt” ?? First time it worked. Last time it crashed. Maybe the reason was that 2 people at once tried to access openproject during the restart? I always ended up with the message “not enough memory allocated” when logging in with the user “openproject” …

When trying to send a testmail using the OP-feature: (Connection refused - connect(2) for “localhost” port 25).

Thats why I thought I should give sendmail a try. I don’t need to use an external provider at all because it’s just info mails from OP, isn’t it?

This is my Guide (note that smtp wasn’t working)

##Prepare your Environment
[sudoer@debian]

sudo apt-get update
sudo apt-get install git curl build-essential zlib1g-dev libyaml-dev libssl-dev libmysqlclient-dev libpq-dev libsqlite3-dev memcached libffi5

##Add Openproject-User and Group

sudo groupadd openproject
sudo useradd --create-home --gid openproject openproject
sudo passwd openproject

##Install Mysql and Database

sudo apt-get install mysql-server mysql-client
mysql -u root -p

#Create Database and don't  forget to change password
CREATE DATABASE openproject CHARACTER SET utf8;
CREATE USER 'openproject'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON openproject.* TO 'openproject'@'localhost';
\q

##Install Node.js (nodeenv)

sudo apt-get install python python-pip
sudo pip install nodeenv

##Install Ruby

sudo su openproject -c "bash -l"

[openproject@all]

cd ~

#Grep GPG Key before you continue

gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable

#Actual installation

source $HOME/.rvm/scripts/rvm
rvm autolibs disable
rvm install 2.1.4
rvm use --default 2.1.4
gem install bundler

#Activate node.js

cd ~
nodeenv nodeenv
source ./nodeenv/bin/activate
npm -g install bower

#Install Openproject

cd ~
git clone https://github.com/opf/openproject.git
cd openproject
git checkout stable
bundle install
npm install
bower install

#Configure Openproject

cp config/database.yml.example config/database.yml

nano config/database.yml

#Paste (replace) this into database.yml

production:
  adapter: mysql2
  database: openproject
  host: localhost
  username: openproject
  password: openproject
  encoding: utf8

development:
  adapter: mysql2
  database: openproject
  host: localhost
  username: openproject
  password: openproject
  encoding: utf8

cp config/configuration.yml.example config/configuration.yml

nano config/configuration.yml

#Paste (replace) this at the end of configuration.yml and comment out everything else

production:
  email_delivery_method: :smtp
  smtp_address: smtp.provider.com
  smtp_port: 587
  smtp_domain: smtp.provider.com
  smtp_user_name: ***@provider.com
  smtp_password: ****
  smtp_enable_starttls_auto: true
  smtp_authentication: login

#Don't forget to add the following line in configuration.yml

rails_cache_store: :memcache

#Finish the installation of openproject

cd ~/openproject
bundle exec rake db:create:all
bundle exec rake generate_secret_token
RAILS_ENV="production" bundle exec rake db:migrate
RAILS_ENV="production" bundle exec rake db:seed
RAILS_ENV="production" bundle exec rake assets:precompile

exit

#Install passenger with nginx support

[sudoer@debian]

sudo apt-get install libcurl4-gnutls-dev
sudo chmod o+x "/home/openproject"

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
sudo apt-get install apt-transport-https ca-certificates

#Edit passenger.list config

sudo nano /etc/apt/sources.list.d/passenger.list

#Paste the following into the file

# Debian 7
deb https://oss-binaries.phusionpassenger.com/apt/passenger wheezy main

#Change rights and update APT-Cache

sudo chown root: /etc/apt/sources.list.d/passenger.list
sudo chmod 600 /etc/apt/sources.list.d/passenger.list
sudo apt-get update

#Install nginx-extras and passenger (even if nginx is installed already)

sudo apt-get install nginx-extras passenger

##Get Path for nginx passenger module

sudo su openproject -c "bash -l"

[openproject@all]

cd ~/openproject

which passenger-config

#Use this path for the following command

whatever_path_from_previous_command --ruby-command

#Note down the path from the following output

To use in Nginx : PATH

exit

[sudoer@debian]

#Edit nginx configuration

sudo nano /etc/nginx/nginx.conf

#In config file
Uncomment passenger_root and passenger_ruby

#Restart nginx
sudo service nginx restart

#Get the passenger path for nginx conf and note it down

/usr/bin/passenger-config --root

#Edit nginx conf and compare/just replace the existing line
sudo nano /etc/nginx/nginx.conf

passenger_root whatever_value_you_got_from_previous_command;

#Create nginx host file

sudo nano /etc/nginx/sites-available/openproject.conf

#Paste the following into the config file

server {
    server_name your.domain.name;
    root /home/openproject/openproject/public;

    access_log /var/log/nginx/openproject.access.log;
    error_log /var/log/nginx/openproject.error.log;

    passenger_ruby /home/openproject/.rvm/gems/ruby-2.1.4/wrappers/ruby; ##Path you got while you were in [openproject@all]-mode
    passenger_enabled on;
}

#Paste the following into the config file if you enabled https in openprojects-settings

server {
    server_name your.domain.name;
    rewrite ^/(.*) https://your.domain.name/$1 permanent;
}

server {
    listen 443 ssl;

    ssl_certificate /etc/ssl/certs/your.domain.name.pem;
    ssl_certificate_key /etc/ssl/private/your.domain.name.pem;

    server_name your.domain.name;
    root /home/openproject/openproject/public;

    access_log /var/log/nginx/openproject.access.log;
    error_log /var/log/nginx/openproject.error.log;

    passenger_ruby /home/openproject/.rvm/gems/ruby-2.1.4/wrappers/ruby;
    passenger_enabled on;
}

#Create symlink

sudo ln -s /etc/nginx/sites-available/openproject.conf /etc/nginx/sites-enabled/openproject.conf

#Restart nginx

sudo service nginx restart

#Access your openproject website

##Install Plugins

sudo su openproject -c "bash -l"


[openproject@all]


source ./nodeenv/bin/activate

cd ~/openproject
nano Gemfile.plugins

#Insert any Plugin line

bundle install
bower install
RAILS_ENV="production" bundle exec rake db:migrate
RAILS_ENV="production" bundle exec rake db:seed
RAILS_ENV="production" bundle exec rake assets:precompile

#Restart the application (next access will take longer)

touch ~/openproject/tmp/restart.txt

exit

RE: OP on Debian Wheez Vserver - Added by Don Sefer about 10 years ago

Were you able to test this setup?

Could you provide help setting up postfix for email delivery?
I know there are many guides, but I thought postfix would be enough. But now I read about SASL, dovecot and other stuff…

I just want simple mail from server to s1 working (for openproject). No need to fetch mails from others…

I am more or less new to all this stuff. Most of the time I am able to “fix” things by myself or get stuff working, but this email thing is a pain :(

greetings

RE: OP on Debian Wheez Vserver - Added by Jonas Heinrich (Finn) about 10 years ago

Hi Don,

I’ve read your messages but unfortunately, I did not find the time to answer you. Today is also really busy. I hope I can have a look at your questions tomorrow.

I’m sorry for the delay,

Jonas

RE: OP on Debian Wheez Vserver - Added by Don Sefer about 10 years ago

Hey Jonas,

thats okay! I just want to get everything running :) Biggest problem is passenger at the moment (I made a seperate thread for this issue). I guess I need a better server, but I will wait for your reply. Maybe I have to order something “bigger” … The server mentioned is just 1 euro per year for students. Was good as long it lasted to get into the whole server thing, but things need more power obviously :) this overselling openvz stuff is bad … Needs to be in my students price range, not easy to find serious offers hosted in my location. But I will take a look for something as soon as I have some more information from your side!

best regards
Don

RE: OP on Debian Wheez Vserver - Added by Jonas Heinrich (Finn) about 10 years ago

Hi Don,

concerning your problems with sending mails: I just tried it with postfix. Just run apt-get install postfix. Unfortunately, I’m not sure what I chose in the installation menus but I configured my /etc/postfix/main.cf like this (didn’t change much after the installation):

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = forum
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = forum, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
default_transport = smtp
relay_transport = error
inet_protocols = all

I hope that helps.
Best,

Jonas

RE: OP on Debian Wheez Vserver - Added by Jonas Heinrich (Finn) about 10 years ago

Addition:
You can test your postfix configuration with

$ sendmail <your mail address>
TextileConverterBlockquoteStart09339cab-f4f4-4739-85b0-d02ba1f342e6

FROM: test@test.de
SUBJECT: test-subject

TextileConverterBlockquoteEnd09339cab-f4f4-4739-85b0-d02ba1f342e6

test-body
.

The last dot closes the mail.

Do any other problems still persist?

And I will have a look at your installation manual the next days. Maybe we can add this to our official manuals.

Jonas

RE: OP on Debian Wheez Vserver - Added by Don Sefer about 10 years ago

I guess I have to find out how to configure sendmail first… There are several options and I should ask my provider I guess…

But I will wait for my new server. Unfortunately I have to start from zero as it seems since there is no real backup option for OP (manual setup). At least the guy in another thread is saying that… But as long as I don’t have a stable setup I won’t waste more time with that :) Give me a week or two and I will report if I got everything working!

RE: OP on Debian Wheez Vserver - Added by Jonas Heinrich (Finn) about 10 years ago

Hi Don,

it should be possible to send a mail just from your server, without registering at Google or anything. It just might get into the spam folder. But maybe that would be ok for setting.

And this backup guide should work: https://www.openproject.org/download/backup-guide/

Best,

Jonas

RE: OP on Debian Wheez Vserver - Added by Don Sefer about 10 years ago

Alright, backup worked in my virtual machine!

One thing you SHOULD note in this guide is, that the password for the mysql-database user MUST be the same as the one on the source server! Otherwise the RAILS-restore WONT WORK! EDIT: I meant restore, the RAILS-restore

EDIT: Do you know how to put this in a cronjob? Especially the “RAILS_ENV=production bundle exec rake backup:database:create” part is what I worry about. I have to be logged in as the user openproject for this, don’t I?

EDIT2: I installed postfix via apt-get, created the config file with the configuration above (changed certs)

First things first: sendmail: command not found

Following appears

[ ok ] Stopping Postfix Mail Transport Agent: postfix.
[....] Starting Postfix Mail Transport Agent: postfixpostconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_relay_restrictions=permit_mynetworks permit_sasl_authenticated defer_unauth_destination
. ok

by using /usr/lib/sendmail manually I receive the following error after entering everything

postdrop: warning: unable to look up public/pickup: No such file or directory

RE: OP on Debian Wheez Vserver - Added by Don Sefer about 10 years ago

EDIT: FIXED script-backup

EDIT2: The only thing I don’t understand is, why is the mysql dump exactly the same as the RAILS_* dump?

#!/bin/bash
## Setting date for filename ##
DATE=$(date +"%Y-%m-%d")

## Get environment variables
ORIGPATH=`echo $PATH`
OPPATH="/home/openproject/.rvm/gems/ruby-2.1.4/bin:/home/openproject/.rvm/gems/ruby-2.1.4@global/bin:/home/openproject/.rvm/rubies/ruby-2.1.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/openproject/.rvm/bin:/home/openproject/.rvm/bin"
rvm_bin_path="/home/openproject/.rvm/bin"
GEM_HOME="/home/openproject/.rvm/gems/ruby-2.1.4"
IRBRC="/home/openproject/.rvm/rubies/ruby-2.1.4/.irbrc"
MY_RUBY_HOME="/home/openproject/.rvm/rubies/ruby-2.1.4"
rvm_path="/home/openproject/.rvm"
rvm_prefix="/home/openproject"
GEM_PATH="/home/openproject/.rvm/gems/ruby-2.1.4:/home/openproject/.rvm/gems/ruby-2.1.4@global"

## Set path ##
BACKUP="/home/kupfer/btsync/Backup_SH/openproject"
OPENPROJECT="/home/openproject/openproject"

## Set filename ##
FILE="$BACKUP/$DATE-openproject.sql"
echo "Starting OpenProject-Backup..."

## Starting mysqldump with mySQL user for openproject-database, password and databasename ##
mysqldump --single-transaction --add-drop-table --add-locks --result-file=$FILE --host=localhost --user=openproject -p'PASSWORD' openproject

## Starting RAILSdump within openproject-directory
export PATH=$OPPATH
export rvm_bin_path=$rvm_bin_path
export GEM_HOME=$GEM_HOME
export IRBRC=$IRBRC
export MY_RUBY_HOME=$MY_RUBY_HOME
export rvm_path=$rvm_path
export rvm_prefix=$rvm_prefix
export GEM_PATH=$GEM_PATH

cd $OPENPROJECT
RAILS_ENV=production bundle exec rake backup:database:create[$BACKUP/$DATE-openproject-production-db.sql]
export PATH=$ORIGPATH

## Starting file-backup from openproject-directory
tar -cvpzf $BACKUP/$DATE-openproject_configs.tar.gz $OPENPROJECT/Gemfile.local $OPENPROJECT/Gemfile.plugins $OPENPROJECT/config/database.yml $OPENPROJECT/config/configuration.yml $OPENPROJECT/config/settings.yml

## Set rights for btsync ##
chown -R btsync: "$BACKUP"

## Delete old Backups ##
echo "Delete Backups older than 60 days..."
find $BACKUP -mtime +60 -type f -delete
echo "OpenProject-Backup complete!"
exit 0
  • (1 - 15/15)
Loading...