Articles about software development operations

In this page, you will find articles that are related to computer infrastructure operations that are performed in the course of software development.

Examples include how to setup the server infrastructure to run Python applications, WordPress applications and etc.

How I repaired one of my corrupted git repository on gogs git server

While trying to commit my codes to my Raspberry Pi gogs git server, I got a rejection:

 ! [remote rejected] master -> master (missing necessary objects)
error: failed to push some refs to 'http://192.168.1.115:3000/org/a-project.git'

In addition to that, I got a HTTP 500 when I try to view the repository details page via the dashboard.

Since I can view my other repositories on my gogs git server, something must be wrong with a-project.git.

Given that, here are the steps that I took to rectify the issue.

How to use your Raspberry Pi for Python development

Since its inception, the Raspberry Pi had progressed by leaps and bounds. Indeed, one of the reasons why we want to get a Raspberry Pi is its versatility. Apart from the huge selection of hardware, there are many Python libraries for you to build Raspberry Pi applications.

If you want to build something out of a Raspberry Pi, then you will benefit from setting up one for Python development.

Even if you do not build Raspberry Pi projects for a living, setting up a Raspberry Pi Python developer machine can be useful. For example, you may be a Solutions Engineer who build proof of concepts for demo purposes. In this case, you can build your demos with Python and run them on your Raspberry Pi.

If you are thinking of using Raspberry Pi for Python development, then this post is a reference for you.

How to use the MCP3008-I/P chip to help your Raspberry Pi read digital data from analog sensors

Although your Raspberry Pi is unable to read analog input out of the box, you can get a MCP3008 I/P ADC chip to help your Raspberry Pi do so.

MCP3008 IP ADC chip up close

When you connect a MCP3008 I/P chip to your Raspberry Pi, you can read up to 8 analog inputs with SPI.

Given these points, this post will show you how you can use the MCP3008 I/P chip to help your Raspberry Pi read digital data from analog sensors.

Understanding the default Nginx virtual host (or server) configuration

After you had installed Nginx, one of the first thing to do is to check whether it is running ok.

One way to do so is to use your browser to send a HTTP request to test it.

If you had installed Nginx on your local machine, then you may enter http://localhost or http://127.0.0.1 into the location bar of your browser.

When you had setup Nginx on a separate machine on your home network, you may also enter http://<ip_address_of_the_machine> in the location bar of your browser. For example, in how to host a WordPress website on a Raspberry Pi with Raspbian Buster Lite and Nginx, I had entered http://192.168.1.114 as the location to test out the Nginx server running on my Raspberry Pi.

So be it http://localhost, http://127.0.0.1, http://<ip_address_of_the_machine>, you will always see this page on your browser screen:

default welcome page of Nginx 1.14.2

In case you are wondering why your Nginx behaves this way, this post will explain what the default Nginx Virtual Host configuration does to Nginx.

How to use NSSM to setup Jupyter Notebook as a Windows Service running its own Python 3 virtual environment

When you take Andrew Ng’s Deep Learning Coursera course, you can get a better understanding of deep learning. In addition, you will get many Jupyter Notebook documents that you can reference while building models that can solve interesting problems.

When you want to readily access those documents, you can setup Jupyter Notebook as a Windows Service on your Windows machine.

As I had mentioned in how to use NSSM to run a Python 3 application as a Windows Service in its own Python 3 virtual environment, NSSM is a very helpful tool for us to create Windows Services.

Since we can install Jupyter Notebook via pip, we can run Jupyter Notebook from its own virtual environment. In addition to that, since we can create a Python 3 virtual environment in Windows 10, we can setup Jupyter Notebook as a Windows Service running its own Python 3 virtual environment.

Given these points, let us look at how we can use NSSM to setup Jupyter Notebook as a Windows Service running its own Python 3 virtual environment.

How to prepare a virtual environment to run a gpiozero based project on Raspbian Stretch

When you use a virtual environment to run your application, you isolate the dependencies in its own container.

In such a situation, you can ensure that your application can run alongside other applications with incompatible dependencies.

Therefore, I always favour the use of virtual environment for running my Python applications.

With this in mind, this is a story about preparing a virtual environment to run a gpiozero based project on Raspbian Stretch.

How to setup a Raspberry Pi web server with Raspbian Stretch Lite, Nginx, MariaDB and PHP as the LEMP stack

Raspberry Pi LEMP Linux Nginx MariaDB PHP

When you want to deploy a PHP application that you wrote, you can first deploy it on a Raspberry Pi. Once your PHP application gets enough traction, you can then port it over to a computer with more horsepower.

When your PHP application employs MySQL or MariaDB as the backing database, we can put it up on a LEMP stack. In this situation, HTTP requests will first be directed to the Nginx reverse proxy server. Whenever the request is made to a php application, Nginx will then pass it on to the PHP7 Fast CGI Process Manager (PHP FPM) for generating the HTTP response.

Given these points, this post provides the steps to setup a Raspberry Pi web server with Raspbian Stretch Lite, Nginx, MariaDB and PHP as the LEMP stack.

How to setup Raspbian Stretch on Raspberry Pi 3 for developing Python 3 applications

Previously, I had shared:

Although Raspbian Stretch Lite is ideal for running Python 3 applications on Raspberry Pis, it is not so handy for developing Python 3 applications.

For example, if you are building a Python application that interfaces with the GPIO ports and CSI camera of your Raspberry Pi 3, it is hard to test it out on Raspbian Stretch Lite.

Since Raspbian Stretch includes a desktop environment, it is more convenient for developing Python 3 applications for Raspberry Pi. With this purpose in mind, this is how to setup Raspbian Stretch on Raspberry Pi 3 for developing Python 3 applications.