Follow these steps to deploy the web server on your Raspberry Pi.
Important instructions
-
Enter all the commands in the terminal.
-
Sometimes you may need to use sudo for running some commands.
-
Make sure 7784 port is free and no other container or service is running on it
sudo lsof -i :7784
-
Have docker installed on your machine.
Docker Installation for Raspberry Pi
-
Install Docker:
curl -sSL https://get.docker.com | sh sudo usermod -aG docker $USER docker --version
-
Install Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo mv /usr/local/bin/docker-compose /usr/bin/docker-compose sudo chmod +x /usr/bin/docker-compose docker-compose --version
For other platforms, refer to the official Docker documentation: Install Docker.
-
Easy installation (automatically)
Description:- In this method, no code is required on the server, it downloads the pre built image from Dockerhub. We just just download the docker-compose file which fetches the certi tester software images from Dockerhub and then we spin up the container.
mkdir certi_tester
cd certi_tester
curl -O https://raw.githubusercontent.com/wjasper/certi-tester-deployment/main/easy-installation/docker-compose.yml
docker-compose up
Enter this into browser:-
http://127.0.0.1:7784/
To update the image from Docker Hub and restart the container:
docker-compose pull
Recreate the containers with the latest images
docker-compose up -d --force-recreate
Manual installation
Description:- In this method, we download the code from github, and the build our images locally.
Clone the repository to your desired location using the following command:
git clone https://github.com/wjasper/certi-tester-deployment.git
cd certi-tester-deployment
Builds the image from scratch and runs the container in detached mode:
sudo docker-compose up --build -d
Open your browser and navigate to: http://127.0.0.1:7784
Take the container down and build it again
sudo docker-compose down
sudo docker-compose up --build -d
Accessing the Website on the Network
All ports open on the Raspberry Pi by default
To access the website from other devices on your network:
-
Open port 7784 on the host machine. On Raspberry Pi, this can be done using:
sudo apt install firewall-config sudo firewall-config
For more details, refer to: How to Open a Raspberry Pi Linux Port.
-
Ensure you are on the same network and your Raspberry Pi has a static IP address.
-
Access the application using:
http://<IP_ADDRESS>:7784
Replace <IP_ADDRESS>
with the static IP address of your Raspberry Pi.
Uninstall everything
docker-compose down --rmi all --volumes
rm -rf certi_tester_deployment