2017年11月5日 星期日

Set up Synergy - A Mouse and Keyboard Sharing Software

Synergy is a well-known mouse and keyboard sharing software across PCs with different platforms. The need of writing this is to demonstrate how it is setup.

Environment
PC1
- Windows 10 Pro 64 bit
- Synergy Windows Version 64 bit (v1.6.2)

PC2
- Ubuntu 16.04 64 bit
- Synergy Linux Version 64 bit  (v1.6.2)

Procedure / Points to Note
1. Download both version of Synergy. (Note: now the latest version charges money, use the old version would still be fine)

2. Remember, setting up the computer name in server side is important, the client name must match the name in the client PC, other it will not work. Also the name of both server and client must not contain special characters like "-", or it may not work

3. Every update of setup requires restart of synergy services

4. "Scroll Lock" to lock the mouse and keyboard in same machine


References
1. Making Synergy Startup After Windows Bootup
https://symless.com/forums/topic/2708-is-there-a-way-to-get-synergy-to-auto-start-on-windows-10-boot-up/

2. Synergy for Windows
http://www.snapfiles.com/downloads/synergy/dlsynergy.html

3. Making Synergy start with Ubuntu Bootup
https://askubuntu.com/questions/495962/how-to-autostart-synergy-on-ubunutu-14-04

2017年8月22日 星期二

Gitlab email notification related to pipeline

Gitlab has email notification on various events such as pipeline failure / success, commitment etc. Unfortunately, the setting itself is confusing which make it hard to configure.


My Wish
When I tag a release, pipeline runs, after that send the pipeline results to the person I want.

You can see only a small request takes me half day to figure out where the configuration is. Here is how it can be achieve and the misleading configurations.

You may think that the notification should be well configured via "project > notifications", then you are wrong, the desired recipients will never receive the message, because that setting means ONLY AUTHOR will receive the pipeline status changes. I am quite surprise, not because of the result, but because of the lack of explanation regarding on the configurations.














So how can we achieve to send the email notification BESIDES AUTHOR? You may need to navigate to "Project > Settings > Integrations", enable "Pipelines emails", enter the desired email addresses and gotcha.

What a genius configuration settings, I really hope that software designers can design software based on "human beings" but not only for engineering mindset. It is unacceptable for a task being so complicated to accomplish.

2017年8月17日 星期四

Configuring git-lab runner in Windows 10 Home

Background
One of a routine task during my development flow is deployment, this is quite messy and time consuming, especially when the system consist of many sub-systems which may require testing and runner to run in different machines. In my case, I have developed a new feature which send email using localhost through PHP, and I have tested this feature using docker in my Windows 10 laptop. Unfortunately, Windows 10 Home does not featured with hyper-V, it is an essential element to run native Docker. I therefore make use of docker toolbox and virtual box combination as the runner of my Lenovo laptop.

Environment
- Lenovo ThinkPad X260
- Windows 10 Home
- Gitlab runner installed
- Docker toolbox installed
- Virtual box installed

Problems
All the installation processes of different components performed successfully, however when it comes to some setup, problem comes by.

- When the job is running and using the runner, the following error occurs
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.29/version: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.

This indicates the docker engine is not running at the host machine. I feel strange as docker toolbox has already installed and well configured. The problem comes from the config.toml, this is the configuration file to setup the runner

concurrent = 1
check_interval = 0

[[runners]]
  name = "lenovo_laptop_jackylam"
  url = "https://repo.gitlab.dev.internal.pm.com/"
  token = "b4032157c339f90523a77e5e8881a7"
  executor = "docker"
  [runners.docker]
    tls_verify = true
    host = "tcp://192.168.99.100:2376"
    tls_cert_path = "C:\\Users\\p2m\\.docker\\machine\\certs\\"
    image = "test/2938:latest"
    pull_policy = 'never'
    privileged = true
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0
  [runners.cache]

Here, executor is important, you need to told gitlab-runner to use docker as the runner, but the problem also come from this, when you say "executor: docker", you are telling the specified host machine to run docker command for the test, the problem is you are using virtual box as the intermediate to run the docker, and the "Docker Quickstart Terminal" 's environment is linked to the virtual machine, that's why you can directly run docker command through the host terminal. When gitlab-runner run the docker command, the environment does not contain docker executable!

To solve this issue, you can rely on config.toml, in [runners.docker] column, specify the host with the virtual machine's host, and also the certifications required to run the command, another important setup would be "pull_policy", setting "never" tells gitlab-runner not to pull the docker images from the docker hub, it is extremely useful when your test is not replying on the docker images situated in docker hub. After setting up the remote connection pointing to the virtual machine, the docker command can be run successfully.

- When you want to remove the docker-machine, make sure the virtual machine in virtual box is completely shutdown before removing docker-machine, otherwise error will occur during removal.

Remember if you don't specify anything, gitlab-runner will assume the host machine can be "docker-runnable", but actually the runner is located in the VM.