Jenkins – Fastlane build iOS and Android apps

Using Jenkins and Fastlane, we will build applications on iOS and Android, send artifacts to Slack, and also automatically send an iOS application to Testflight. The build is configured from the develop and release branches, and reads the release version (major and minor) from them, and adds the build number.

For example: the branch is release/1.0 and the Jenkins number of build 25, then the application version will be 1.0.25

For the building will be needed:

For convenience, my application is everywhere called: "my_mobile_app"

Continue reading "Jenkins – Fastlane build iOS and Android apps"

Kubernetes – Installing and creating a cluster

First you need to install Docker.

For Kubernetes to work correctly, you must disable SWAP

swapoff -a

Also check delete it with fstab

Add Kubernetes repository and install

Ubuntu:

apt update && apt install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF

apt update
apt install -y kubelet kubeadm kubectl

CentOS 7:

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF

setenforce 0

yum install -y kubelet kubeadm kubectl

Continue reading "Kubernetes – Installing and creating a cluster"

AWStats – Nginx

 

AWStats is by default tuned to work with the Apache log, in this article I will show how to get statistics from Nginx logs.

Install Awstats and the GeoIP module

yum install awstats htmldoc GeoIP perl-Geo-IP

Install the Perl handler

yum -y install spawn-fcgi fcgi-devel wget
yum -y groupinstall "Development Tools"
mkdir /tmp/perl && cd /tmp/perl && wget http://github.com/gnosek/fcgiwrap/tarball/master -O fcgiwrap.tar.gz
tar -xf fcgiwrap.tar.gz && cd gnosek-fcgiwrap-*

autoreconf -i
./configure
make
make install

Continue reading "AWStats – Nginx"

Terraform – Installation

Installing Terraform is quite simple, since it is written in Go, just download the archive with the binary file.

Go to the download page:

https://www.terraform.io/downloads.html

Download the archive, extract the binary file and move it to "/usr/bin/" (or write it to PATH)

Check:

terraform --version

If you use the "bash" or "zsh" shell, you can add autocompletion for Terraform with the following command:

terraform -install-autocomplete

OpenVPN – Selective traffic (mail.ru, yandex.ru, vk.com, ok.ru, kaspersky.ru)

Goal:

Only allow networks that fall under the ban through a VPN, the rest should go directly. The convenience of connecting devices, cross-platform, speed and security are also important.

All steps were performed on CentOS 7.

Install the EPEL repository if it is not already in the system and install the necessary packages:

yum install epel-release -y
yum install openvpn easy-rsa -y

Create a configuration file:

vim /etc/openvpn/server.conf

Continue reading "OpenVPN – Selective traffic (mail.ru, yandex.ru, vk.com, ok.ru, kaspersky.ru)"

OpenVPN – All traffic through VPN

Goal:

Allow traffic from any device via VPN. The maximum convenience is connecting new devices without creating accounts, creating passwords, etc. Fast and encrypted connection.

All steps were performed on CentOS 7.

Install the EPEL repository if it is not already in the system and install the necessary packages:

yum install epel-release -y
yum install openvpn easy-rsa -y

Create a configuration file:

vim /etc/openvpn/server.conf

Continue reading "OpenVPN – All traffic through VPN"

Nginx – WordPress

Example Nginx configuration file for WordPress CMS:

server {
    server_name artem.services;
    root /var/www/html/artem_services;
    index index.php;

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        fastcgi_index index.php;
        fastcgi_pass unix:/var/run/php-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires max;
        log_not_found off;
    }
}

Docker Swarm over TLS

In this example, there are 3 servers with Docker installed on it. If docker is not installed, you can see the installation here.

There will be one manager and two workers:

Master – manager (IP: 1.1.1.1)
Slave_1 – worker (IP: 1.1.2.1)
Slave_2 – worker (IP: 1.1.2.2)

Required ports for Docker Swarm to work: 2376 and 2377 (TCP). Make sure that the swarm participants are allowed to interact.

Creating Docker Swarm

On the Master server, do the following:

docker swarm init --advertise-addr 1.1.1.1

We get a message like:

Swarm initialized: current node (ssmj2qyqxejd72p6sa9jinnza) is now a manager.

To add a worker to this swarm, run the following command:

docker swarm join \
--token SWMTKN-1-3qg9vovt2mxyfu1dfj2nocmkzd3i351z1z0aapd9jxxu7mafff-93r77xv8mrqsgfkf9nei902zk \
1.1.1.1:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

Swarm is created and there is one manager in it. Information on the swarm can be viewed with the command:

docker info

Continue reading "Docker Swarm over TLS"