Skip to content

Instantly share code, notes, and snippets.

@vanlooverenkoen
Last active December 3, 2023 22:40
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanlooverenkoen/b1fa6f00c7b2c248378c677d9eb32afa to your computer and use it in GitHub Desktop.
Save vanlooverenkoen/b1fa6f00c7b2c248378c677d9eb32afa to your computer and use it in GitHub Desktop.
Synology CI

How to set up CI with Synology

Before you start

Install packages on your Synology with the Package Manager

  • Docker
  • Git

Configure Git


Step 1) Create a user

Create a user gituser with a password you choose ex: git-pswd

Step 2) Create a new shared folder

Your shared folder git and give the user gituser read/write access.

Step 3) Give gituser Git permissions

Open the Git Server application on your Synology and allow gituser permission

Step 4) Enable SSH

Enable SSH to use Git. Control Panel -> Terminal & SNMP -> Enable SSH Service

Step 5) SSH access

SSH into your device with gituser

create a directory mkdir /volume1/homes/gituser/.ssh

create a file authorized_keys in this folder: touch /volume1/homes/gituser/.ssh/authorized_keys

change the prmission of the .ssh folder

    chown -R gituser:users /volume1/homes/gituser/.ssh
    chmod 700 /volume1/homes/gituser/.ssh
    chmod 644 /volume1/homes/gituser/.ssh/authorized_keys

Step 6) Configure SSH

The Synology SSH daemon doesn't use key based auth by default. To enable it use vi to edit the /etc/ssh/sshd_config file. Find the following lines:

    #PubkeyAuthentication yes
    #AuthorizedKeysFile     .ssh/authorized_keys

Modify them to be:

    PubkeyAuthentication yes
    AuthorizedKeysFile     .ssh/authorized_keys

Save the file.

Add a new device to Git (or use Git It)


Step 1)

Add a new repo (or use Git It)


Step 1)

https://gist.github.com/walkerjeffd/374750c366605cd5123d

http://blog.osdev.org/git/2014/02/13/using-git-on-a-synology-nas.html

http://gresch.io/2016/01/fatal-interactive-git-shell-is-not-enabled-on-synology/

my default shell -> /var/packages/Git/target/bin/git-shell

https://www.udemy.com/ssh-advanced-usage/learn/v4/overview

Setup Jenkins


https://keestalkstech.com/2018/03/setup-jenkins-blue-ocean-using-docker-on-synology-nas/

Update Jenkins

https://medium.com/@jimkang/how-to-start-a-new-jenkins-container-and-update-jenkins-with-docker-cf628aa495e9

Custom Heroku


https://www.reddit.com/r/synology/comments/6put9m/update_docker_containerimage/ https://davekiss.com/create-your-own-heroku-clone-for-5-a-month-with-dokku/

Private Maven Repository


Your NAS already supports FTP out of the box.

Step 1) Create a user

Create a user maven with a password you choose ex: maven-pswd

Give this user access to FTP (Desktop, File Station)

Step 2) Create a new shared folder

Your shared folder maven and give the user maven read/write access.

Step 3) Enable FTP

Now enable FTP in the configuration screen -> File Services -> FTP -> SFTP

enable SFTP and change the port to something different than 22. (for security reasons). You can now add your plugins, libraries to this FTP server.

Step 4) Configure Gradle

In Gradle you will need to add this url to your repositories. It will look something like this:

    maven {
        url 'sftp://your-url/maven'
        credentials {
            username 'maven'
            password 'maven-pswd'
        }
    }

Step 5) Test

You have uploaded a library and configured your gradle correctly it is now time to test. When syncing your gradle the libary will be found.

https://stuartsierra.com/2009/09/08/run-your-own-maven-repository https://hub.docker.com/r/bogem/ftp/~/dockerfile/

Docker Repository


https://www.ibm.com/developerworks/library/l-docker-private-reg/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment