📜 ⬆️ ⬇️

Installing and configuring GitLab + Redmine collaboration on Debian 8 jessie + Nginx - Part 1

Introduction


It so happened that there was a shortage of the usual GitHub or GitBucket for the project. The main reason for storing and controlling versions of large binaries of psd, 3dsmax and others. In fact, there are lots of solutions, for example, you could use the Cloud Disk or the git Large Files System, presented by GitHub. But after weighing all the pros and cons of different approaches to the organization, we came to a bunch of GitLab + redmine.

I do not think that it makes sense to describe the products, I will only bring the main advantages that prompted us to make this choice.
The main advantages of GitLab:


Also both open source projects.

Workspace preparation


I decided not to omit all the little things, so that even the user level “The first time I see the Linux console” could pick up a bunch of Redmine + GitLab.
')
Let's start with the preparation of the workspace, namely, installing sudo, since using the system as the root user is not good. Also, when installing from root, there were some problems with GitLab:

#  nano,      . apt-get install nano sudo -y 

Configure sudo by adding your user:

 # ,       <username> #      root.       . nano /etc/sudoers #   sudo su <username> 

Install Redmine


We will use Nginx, Thin and MySQL. If for religious reasons you need PostgreSQL, read the notes after the code, I will indicate where to change the settings. Also, instead of Thin, you can use Unicorn, but we will omit its installation in this article.

Installation is as follows:

Installing Nginx on the role of an external web server


 sudo apt-get update sudo apt-get install nginx -y 

Database installation


 #   MySql apt-get install mysql-server mysql-client libmysqlclient-dev #   PostgreSQL apt-get install postgresql 

When installing MySql can request a super user password. Come up and write it down. Now we need to create a database and user day of it.

 #    MySql mysql -uroot -p CREATE DATABASE redmine CHARACTER SET utf8; CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost'; exit #    PostgreSQL su postgres psql CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'password' NOINHERIT VALID UNTIL 'infinity'; CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine TEMPLATE template0; \q exit 

Installing Redmine itself


We will need headlines for compilation.

 # : libmagickcore-dev libmagickwand-dev     .      . apt-get install libmagickcore-dev libmagickwand-dev imagemagick build-essential 

Now we are ready to download the fresh redmine. At the time of this writing, this is 3.2.0 . Download and put in the working directory.

 cd /tmp mkdir redmine cd redmine wget http://www.redmine.org/releases/redmine-3.2.0.tar.gz tar -zxvf ./redmine-3.2.0.tar.gz mv ./redmine-3.2.0 /usr/local/share/redmine 

Redmine is written in Ruby and requires it. Install.

 #   . apt-get install ruby ruby-dev rubygems libruby #   bundler    apt-get   ruby gem install bundler 

Add thin.

 nano /usr/local/share/redmine/Gemfile #  gem "thin" 

Install all the necessary gems for redmine:

 cd /usr/local/share/redmine #:    PostgreSQL   --without PostgreSQL  --without mysql bundle install --without development test postgresql sqlite 

It remains to configure.

 cp config/database.yml.example config/database.yml mv public/dispatch.fcgi.example public/dispatch.fcgi nano config/database.yml 

We change production approximately to such type.

NOTE: If you install PostgreSQL, follow the example at the bottom of the database.yml file. It is also more accurate with tabulation because * .yml is a rather specific format.

 production: adapter: mysql2 database: redmine host: localhost username: redmine password: "<password_Mysql_redmine_user>" encoding: utf8 

Create a secret key:

 rake generate_secret_token 

Errors should not be. But if he suddenly asks for mysql2 or another PostgreSQL gem, just install them:
 gem install mysql2 #       rake generate_secret_token 

The database is populated with 2 teams. After 2 will be asked to choose a language.

 RAILS_ENV=production rake db:migrate RAILS_ENV=production rake redmine:load_default_data #        : rake db:encrypt RAILS_ENV=production 


So. Redmine is fully configured and let's check it out. For this there is a WebRic:

 ruby script/rails server webrick -e production 

If you saw INFO WEBrick :: HTTPServer # start: pid = 27676 port = 3000 then you can check in the hostname : 3000 browser everything should work fine.

Then press Ctrl + C.

Thin setting


In order for nginx to understand ruby, we need thin:

 thin install #     adduser redmine chown -hR redmine:redmine /usr/local/share/redmine 

It remains to configure the thin:

nano /etc/thin/redmine.yml

 pid: tmp/pids/thin.pid group: redmine wait: 30 timeout: 30 log: log/thin.log max_conns: 1024 require: [] environment: production max_persistent_conns: 512 servers: 1 daemonize: true user: redmine socket: /tmp/thin.sock chdir: /usr/local/share/redmine 

Run thin:

 /etc/init.d/thin start #   nano /usr/local/share/redmine/logs/thin.0.log 

Nginx setup


Create a host:

 nano /etc/nginx/sites-available/redmine.hostname.ru 

Copy the settings into the file and change it for you:

 #  upstream    ""  thin upstream thin_server { server unix:/tmp/thin.0.sock; } # -    server { #  server_name redmine.hostname.ru #  HTTPS(SSL) listen *:80; # access_log /var/log/nginx/redmine.mihanentalpo.me-access.log; error_log /var/log/nginx/redmine.mihanentalpo.me-error.log; # public  root /usr/local/share/redmine/public; #  location.      " ",   #     -,    thin location / { proxy_redirect off; proxy_set_header Host redmine.mihanentalpo.me; try_files $uri/index.html $uri.html $uri @thin; } #  Location  ,     location @thin { proxy_pass http://thin_server; } } 

Then we turn on the site and restart nginx:

 ln -s /etc/nginx/sites-available/redmine.hostname.ru /etc/nginx/sites-enabled/redmine.hostname.ru /etc/init.d/nginx restart 

This completes the installation of Redmine. And he will be available at redmine.hostname.ru. To work, he lacks interesting plug-ins and the most important permission to write. Run:

 chmod -R 0777 /usr/local/share/redmine/tmp chmod -R 0777 /usr/local/share/redmine/files 

The administrator has the default username admin and password admin.

In the next article we will look at installing and configuring GitLab. Perhaps there will be a ldap setting.

PS: The first article, waiting for constructive criticism. Maybe he was too meticulous and for such a large project as Habr, where IT sniki gathered, it was not necessary to sort out all the details in such detail. I just wanted that anyone could configure Redmine + GitLab on his VPS VDS server.

Source: https://habr.com/ru/post/278843/


All Articles