script that running unicorn for redmine

rdmine_unicorn_cent_nginx_.png

#!/bin/sh
/usr/bin/perl /root/scripts/rununicorn.pl

#! /usr/bin/perl -w
use strict;
use warnings;

print "running helpdesk\n";
$ENV{PATH}='/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/user/.local/bin:/home/user/bin:/home:/var/www/html/redmine/config';
print $ENV{'PATH'};
system ("BUNDLE_GEMFILE=/var/www/html/redmine/Gemfile bundle exec unicorn_rails -E production -c /var/www/html/redmine/config/unicorn.rb -D");

nginx as revers proxy

upstream redmine {
    server unix:/var/www/html/redmine/tmp/sockets/unicorn.sock;
    }

     server {
         listen 80;
         server_name example.com;
         client_max_body_size 200m;
         root /var/www/html/redmine/;

      location / {
          try_files $uri @ruby;
                  }

       location ~* \.(jpg|gif|png|js|css|ico)$ {
               root /var/www/html/redmine/public;
               expires 7d;
               error_page 404 502 504 = @ruby;
               }

        location @ruby {
        proxy_set_header  X-Real-IP  $remote_addr;
        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header  Host $http_host;
        proxy_redirect off;
        proxy_read_timeout 300;
        proxy_pass http://redmine; #upstream redmine
        }
    }

PostgreSQL hack for DIgitalOcean netbox

netbox+postgresql+django.png

Official documentation said that you must do this comands for creating user/role in PostgreSQL:

# sudo -u postgres psql

postgres=# CREATE DATABASE netbox;
CREATE DATABASE

postgres=# CREATE USER netbox WITH PASSWORD 'somepassword';
CREATE ROLE

postgres=# GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;
GRANT

\l

postgres=# \q

but during the server installation, I was faced with a lack of rights to the database, that's why I have provided the right data base the following commands:

# sudo -u postgres psql
postgres=# alter database netbox_db owner to netbox_user;
\l
\q

cron time options

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name  command to be executed

40 23 * * * root /root/scripts/backup.sh

GitHub – denisgolius

Denis

Ukraine

https://www.linkedin.com/in/denis-golius-1088b79b https://www.facebook.com/michaelweiss1234