Automating Satis build and maintenance using Git repository2 min read

Satis, is a lightweight and easy to install Composer Repository. Out the box Satis doesn’t provide any mechanism to automate the build process or maintaining the repositories.

There’re few solutions out there that allows you to modify your satis.json  file using a web interface. The best solution right the second is Satisfy, it’s pretty handy but the lack of documentation and configuration makes you spend a lot of time trying to make it work.

In this tutorial we’re going to automate our Satis build and CRUD operations using the Web Interface of a Git repository provider like Bitbucket or GitHub..

Requirements:

The idea is to use Bitbucket, GitHub or any other Git provider to store our satis.json  and maintain it using their Web Editor Interface. That way you have an interface to add, remove and modify your satis.json  file without having to log in into the Satis server.

For this tutorial I’m going to be using Bitbucket but you can use any other provider.

Step 1. Create Git repository

Open your Git provider and create a repository called “satis-configuration”:

Step 2. Add satis.json and other files

The next step is add the satis.json  file to the root of your repository with the following content:

Add the file build-satis.sh  to the root the repository with the following content:

Step 3. Clone repository in Satis server

In your Satis server, create the satis folder to clone your configuration repository as follows:

Note: Make sure your Satis server keys are added to your private git repository.

Step 4. Add build command to crontab

Add the following code to your crontab file to execute the build every 2 mins, feel free to change it base on your needs:

You’re good to go! All you have to do is add your new packages to your satis.json file in the Git repository with in Bitbucket and automatically the index will be created every 2 minutes.

Another solutions:

As I mentioned before, there’re few other solutions that  allow you to do this using a Web Interface. These are the most popular at the moment: