Monday, July 11, 2022

[Gitlab] gitlab runner doesn`t work on a specific project


Ref: gitlab runner doesn`t work on a specific project

Error:
Fetching changes with git depth set to 50...
fatal: remote origin already exists.
fatal: git fetch-pack: expected shallow list
ERROR: Job failed: exit status 1

Solution:

Centos 7 ships with git version 1.8.3.1 . This version doesn't support commands like git fetch-pack . To fix this problem, you could update git on your server from the IUS repository. update git on Centos 7 to version 2 from third-party IUS repo

$ git --version
git version 1.8.3.1
sudo yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
sudo yum install git


[Gitlab] Install gitlab runner

 


Ref:https://docs.gitlab.com/runner/install/linux-manually.html

Download

To download the appropriate package for your system:

  1. Find the latest file name and options at https://gitlab-runner-downloads.s3.amazonaws.com/latest/index.html.
  2. Choose a version and download a binary, as described in the documentation for downloading any other tagged releases for bleeding edge GitLab Runner releases.

For example, for Debian or Ubuntu:

curl -LJO "https://gitlab-runner-downloads.s3.amazonaws.com/latest/deb/gitlab-runner_${arch}.deb"

For example, for CentOS or Red Hat Enterprise Linux:

curl -LJO "https://gitlab-runner-downloads.s3.amazonaws.com/latest/rpm/gitlab-runner_${arch}.rpm"

For example, for FIPS compliant GitLab Runner on RHEL:

curl -LJO "https://gitlab-runner-downloads.s3.amazonaws.com/latest/rpm/gitlab-runner_amd64-fips.rpm"

Install

  1. Install the package for your system as follows.

    For example, for Debian or Ubuntu:
    dpkg -i gitlab-runner_<arch>.deb For example, for CentOS or Red Hat Enterprise Linux:
    rpm -i gitlab-runner_<arch>.rpm

  2. Register a runner

Update

Download the latest package for your system then upgrade as follows:

For example, for Debian or Ubuntu:

dpkg -i gitlab-runner_<arch>.deb

For example, for CentOS or Red Hat Enterprise Linux:
rpm -Uvh gitlab-runner_<arch>.rpm

Sunday, July 10, 2022

[Report Server] fully share files

Ref: https://reportserver.net/en/guides/admin/chapters/File-System/

 To fully share files you may place them in a folder where a tick is set at Share folder for web access.





 

Wednesday, June 29, 2022

GitlabCI run pipeline on specific branch and manual


 Ref: https://stackoverflow.com/questions/51642852/gitlabci-run-pipeline-on-specific-branch-and-manual

You want to run the builds on branch develop automatically but in branch web manually

You can't do this in one build, but you can use two builds for it:

my_build:develop
  stage: build
  only:
    - develop

my_build:web
  stage: build
  only:
    - web
  when: manual

java.desktop/sun.awt.FontConfiguration.getVersion with NullPointerException


 Ref: https://stackoverflow.com/questions/65509533/npe-from-sun-awt-fontconfiguration-getversion-using-apache-fop-jdk-11-on-linux-s

Error:

Caused by: java.lang.NullPointerException
        at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1262)
        at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225)
        at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:107)
        at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:719)

Solution:

Turns out the issue was not that I didn't have access to the fonts, the Linux OS required me to install fontconfig via yum.

yum install fontconfig

I am not sure why Oracle JDK 11 plus the missing Linux utility was the issue since this works now in my production environment with Oracle JDK 1.8 and without fontconfig being installed.


MYSQLDUMP PERMISSIONS


 Href: http://www.drlock.com/blog/2006/12/22/mysqldump-permissions/

I wanted to create a user who had just enough permissions to make a SQL dump of my database for backup purposes. I hunted all over the ‘net, but no one told what permissions were needed so by trial and error I found out:

GRANT SELECT, LOCK TABLES ON *.* TO backup_user@localhost IDENTIFIED BY ‘xxx’;

Now I can have a script that runs with my backup tools that executes:

mysqldump –user backup –password=xxx –all-databases –compact | gzip -9 > db_backup.sql.gz


Wednesday, June 22, 2022

How to Setup MariaDB Master and Slave Replication on Ubuntu 16.04

Ref: https://alibaba-cloud.medium.com/how-to-setup-mariadb-master-and-slave-replication-on-ubuntu-16-04-850c155c5481


Requirements

  1. Two fresh Alibaba Cloud instance with Ubuntu 16.04 installed.
  2. A static IP address 192.168.0.101 is configured on the Master node and 192.168.0.102 is configured on the Slave node.
  3. A Root password is set up on both instance.

Launch Alibaba Cloud ECS Instance

apt-get update -y

Install MariaDB

apt-get install mariadb-server -y
systemctl start mysql
systemctl enable mysql
mysql_secure_installation
Set root password? [Y/n] n
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

Configure Master Node

nano /etc/mysql/my.cnf
[mysqld]
bind-address = 192.168.0.101
server_id=1
log-basename=master
log-bin=/var/log/mysql/mariadb-bin
binlog-format=row
binlog-do-db=masterdb
systemctl restart mysql
mysql -u root -p
MariaDB [(none)]> STOP SLAVE;
MariaDB [(none)]> GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY 'password';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> FLUSH TABLES WITH READ LOCK;
MariaDB [(none)]> SHOW MASTER STATUS;
+--------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+--------------------+----------+--------------+------------------+
| mariadb-bin.000001 | 615 | masterdb | |
+--------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
MariaDB [(none)]> exit;
mysqldump --all-databases --user=root --password --master-data > alldatabase.sql
scp alldatabase.sql root@192.168.0.102:/root/
mysql -u root -pMariaDB [(none)]> UNLOCK TABLES; 
MariaDB [(none)]> exit;

Configure Slave Server

nano /etc/mysql/my.cnf
[mysqld]
bind-address = 192.168.0.102
server-id = 2
replicate-do-db=masterdb
systemctl restart mysql
mysql -u root -p < alldatabase.sql
mysql -u root -p
MariaDB [(none)]> STOP SLAVE;
MariaDB [(none)]> CHANGE MASTER TO MASTER_HOST='192.168.0.101', MASTER_USER='slave_user', MASTER_PASSWORD='password', MASTER_LOG_FILE='mariadb-bin.000001', MASTER_LOG_POS=615;
MariaDB [(none)]> START SLAVE;
MariaDB [(none)]> SHOW SLAVE STATUS\G;
*************************** 1. row ***************************
Slave_IO_State: Connecting to master
Master_Host: 172.20.10.6
Master_User: slave_user
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mariadb-bin.000001
Read_Master_Log_Pos: 615
Relay_Log_File: mysqld-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: mariadb-bin.000001
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
Replicate_Do_DB: masterdb

Test Replication

mysql -u root -p
MariaDB [(none)]> create database masterdb;
MariaDB [(none)]> use masterdb;
MariaDB [masterdb]> create table mastertable (c int);
MariaDB [masterdb]> insert into mastertable (c) values (1);
MariaDB [masterdb]> select * from mastertable;
+------+
| c |
+------+
| 1 |
+------+
1 row in set (0.00 sec)
mysql -u root -p
MariaDB [(none)]> use masterdb;
MariaDB [masterdb]> select * from mastertable;
+------+
| c |
+------+
| 1 |
+------+
1 row in set (0.00 sec)

 


Install and use xorg-server on macOS via Homebrew

  The instructions to install and use xorg-server on macOS via Homebrew: Install Homebrew (if you haven't already): /bin/bash -c ...