Everyone in PHP world knows what Packagist is. Whenever you need to pull some PHP library with composer, you’ll probably pull it from Packagist. But, what to do with your code that shouldn’t be publicly available? Something reusable, private, and self-hosted? You can pay for private Packagist, but if you already have your own infrastructure, maybe a lightweight free solution is good enough for your needs. That’s where Satis comes in.
Yes, there is a documentation page and there are some guides on the Internet about how you can setup Satis, but when it comes to actually installing, configuring and using it – there are a couple of more steps which you’ll need to do than those written in the guide. This article will hopefully guide you through the whole process – from installing prerequisites to using it in your projects. The guide will be based on the following system:
We’ll assume that you already have these installed and configured and focus on what Satis needs.
You can skip reading about prerequisites which you already have.
Satis needs ext-dom PHP extension, but you probably have this one installed already. However, if you don’t have it, then you need to install it.
To check if the ext-dom is installed, you can use the following command:
If it’s not installed, you’ll need to:
The next two prerequisites are Git and Composer. To install Git, simply use:
Composer has several installation methods and you can take a look at them here: https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx. We’ll use this one:
We will install Satis on a subdomain (satis.yoursite.com).
First, create directories for Satis Apache logs and document root.
After, you need to create virtual host configuration file for satis.yoursite.com
Close the text editor and restart httpd service
To install Satis, simply pull the project witll Composer. To keep everything related to Satis in one place, we’ll install Satis in /var/www/satis/app directory:
If you are using publicly available subdomain, you’ll need to secure your document root. After Satis runs and picks up your Git repositories, as a result it will be accessible through a web browser. You can see all your repositories and download zip archives of each of their versions directly from the web interface. So, let’s protect it with htpasswd.
Open your Satis Apache configuration file and add configuration for htpasswd authentication. Your virtual host configuration file for Satis should look like this:
Don’t restart Apache just yet. We’ll need to create .htpasswd file first and add the first user to it.
You will be asked to supply a password for your_first_user. The -c flag is for creating a new file. If you want to add more users later, you can use the same command but without -c flag.
You can now restart Apache to apply the changes:
Since your Satis server will use Composer to distribute packages, Composer on the server needs to be configured to be able to use your password protected site. Composer stores authentiucation credentials in ~/.composer/auth.json file which you’ll need to edit and add htpasswd credentials:
If you don’t already have a wildcard SSL certificate for your domain, it would be a good idea to secure communication with your Satis server by enabling https. Fortunatelly, that’s easy and free by using Let’s Encrypt (https://letsencrypt.org/).
First, let’s install prerequisites. We will be using certbot (https://certbot.eff.org/) to generate and apply Let’s encrypt certificate. Certbot is available in the EPEL repository. In order to use SSL certificates, we will also need mod_ssl.
The next thing to do is to check whether default HTTPS port is open in firewalld:
If https is not listed in your public services, you’ll need to:
Aa an alternative, you can lookup and open HTTPS port (instead of a service):
Now we can use certbot to install our SSL certificate and enable it on satis.yoursite.com
Certbot will ask a series of questions during the setup, but they are all pretty much self-explanatory. The only advice is to always enable HTTPS and disable HTTP entirely when certbot asks you about it.
The last step is to make sure that the certificate is auto-renewed:
Furthermore, you’ll need to add the following entry in crontab:
If you have followed this guide properly, you should now have the following:
However, we still haven’t added any repositories which Satis should monitor. Since this article is long enough, we’ll cover adding repositeories and day-to-day use of Satis in Part 2 of the article.
We are looking for a Senior Blockchain Developer with 5+ years of experience who will join our team.
Your core skills are:
Requirements:
What We Offer:
If you’re ready to take on exciting challenges and grow your career with a supportive and innovative team, we’d love to hear from you!
We are looking for a Senior Full Stack Developer with 5+ years of experience who will join our team.
Your core skills are:
Requirements:
We can give you a fair amount of great benefits such as:
Feel free to apply for the job if you think we are a perfect match!
We are looking for a Senior iOS Developer with 5+ years of experience who will join our team.
Your core skills are:
Requirements:
We can give you a fair amount of great benefits such as:
Feel free to apply for the job if you think we are a perfect match!
We are looking for a Senior .NET Developer with 5+ years of experience who will join our team.
Your core skills are:
Requirements:
We can give you a fair amount of great benefits such as:
Feel free to apply for the job if you think we are a perfect match!