Create swap on VPS

Posted on Leave a commentPosted in IT

Tested on DigitalOcean Debian8.

Swap creation:

dd if=/dev/zero of=/swapfile bs=1024 count=512k
 mkswap /swapfile
 swapon /swapfile
 echo -e 'n/swapfile swap swap defaults 0 0' >> /etc/fstab
 reboot
 swapon -s
 free

That did not work with Azure debian 8 clean install.

But you can do it that way:

dd if=/dev/zero of=/swapfile bs=1024 count=512k
 mkswap /swapfile
echo -e 'n/swapfile swap swap defaults 0 0' >> /etc/fstab
 reboot
 swapon -s
 free

Debian 8 fresh Chef installation error

Posted on Leave a commentPosted in IT

Missing folder under debian 8 jessie, Error output:

Recipe: enterprise::runit_systemd
  * template[/usr/lib/systemd/system/private_chef-runsvdir-start.service] action create
    * Parent directory /usr/lib/systemd/system does not exist.
    ================================================================================
    Error executing action `create` on resource 'template[/usr/lib/systemd/system/private_chef-runsvdir-start.service]'
    ================================================================================

    Chef::Exceptions::EnclosingDirectoryDoesNotExist
    ------------------------------------------------
    Parent directory /usr/lib/systemd/system does not exist.

Just a small issue with a fresh install under Debian 8.
The folder /usr/lib/systemd/system does not necessary exist on a fresh install of Debian and there is an error in the receipe : /opt/opscode/embedded/cookbooks/cache/cookbooks/enterprise/recipes/runit_systemd.rb

Just creating the folder manually fix the problem :

mkdir /usr/lib/systemd/system

 

https://github.com/chef-cookbooks/chef-server/issues/86

 

PS: for most cases solo will be enough:

curl https://www.opscode.com/chef/install.sh | sudo bash

Configuring IP-IP tunnel between two linux VPS

Posted on Leave a commentPosted in IT

VPS1:

ip tunnel add tun0 mode ipip remote a.a.a.a local b.b.b.b dev eth0
ifconfig tun0 10.0.0.1 netmask 255.255.255.252 pointopoint 10.0.0.2
ifconfig tun0 mtu 1500 up

VPS2:

ip tunnel add tun1 mode ipip remote b.b.b.b local a.a.a.a dev eth0
ifconfig tun1 10.0.0.2 netmask 255.255.255.252 pointopoint 10.0.0.1
ifconfig tun1 mtu 1500 up

done

PS: don`t forget to secure data, that will be unencrypted tunnel

Some old MediaWiki bug

Posted on 2 CommentsPosted in IT

It could be useful for some old installations:

error.log is full of:

PHP Warning:  preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /var/www/html/wiki/includes/MagicWord.php

All pages are blank, but you can edit them with normal content.

To fix, you need to edit /includes/MagicWord.php like:

https://gerrit.wikimedia.org/r/#/c/107259/1/includes/MagicWord.php

Its better to upgrade BTW.

 

 

Zabbix graphs vizualisation

Posted on Leave a commentPosted in IT

Grafana is perfect tool fot vizualisation. Its also could be used for Zabbix graphs.

By default it uses own web server and 3000 port for http. I prefer https and nginx.

Solution that works:

location /grafana {
     proxy_pass         http://localhost:3000;
     rewrite  ^/grafana/(.*)  /$1 break;
     proxy_set_header   Host $host;
}

grafana.ini also has an updated root:

[server]
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana

__________

Source: http://serverfault.com/questions/684709/how-to-proxy-grafana-with-nginx