Launch Our Own Git Hub Like Server Using Podman Container
What’s Gogs
Gogs(gogs.io) is A Painless self-hosted Git Server.
why would anyone want to create another service like GitHub when clearly there is already GitHub?
If you want to needed to have a private repository for any project and you don’t want to upgrade our git hub account to a “Developer” plan for $7/month.So it’s best way to create your own git server
Prerequisite:
You must have podman install in your pc.
you must have git install in your PC for pushing repo in gogs.
You’ll need: to have atleast basic knowledge on podman
Let’s Start
First, you have to pull gogs and MySQL image from any public repository for this you have to run two command-
for pulling gogs image
podman pull gogs/gogs
for pulling MySQL image
podman pull mysql
After pulling these now you have to run these images
For running MySQL you have to launch MySQL container using environmental variable
podman run -d --name=mydb -e MYSQL_USER=ashu -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=test mysql
- -d=launch container in detach mode.
- - -name=give the podman container name
- MYSQL_USER= Give Database user name
- MYSQL_ROOT_PASSWORD=Give database password
- MYSQL_DATABASE=Give database name
For running gogs you also have to launch gogs images using environmental variable
podman run -d -p 3001:3000 -e gogs_DB_HOST=10.88.0.16 -e gogs_DB_PASSWORD=root -e gogs_DB_NAME=test gogs/gogs
- -p=defines 3001 as the port at which you will be able to access the web interface of Gogs.
- gogs_DB_HOST= Here I am using MySQL container IP to link with gogs.
- gogs_DB_PASSWORD=password for gogs.
- gogs_DB_NAME=Mysql database name.
here I am Linking MySQL database to gogs container using MySQL container IP Address.
To check all container running properly or not type the command
podman ps
Here I put my terminal screenshot which shows all the above commands.
Now we have to go any browser and type http://localhost:3001/.As a result you should see the setup page of Gogs:
Now you have to install gogs .
To finish the setup, click on install at the bottom of the page. Afterward, you will be forwarded to the login page of Gogs. Please login with the credentials you just specified.
After logging in you should see the start page of the Gogs service. Its dashboard is similar to the git hub.
Nice, you successfully installed Gogs!. Now let’s start using it!
Goto + icon and click on New Repository.
Give your Repository name and click on Create Repository.
Now you see the Quick guide to push the repository like git hub
Follow these steps and run all command on your project directory.
Following these step, you see your repo is successfully uploaded on gogs server.
Congratulations! You now have your own Git service running in your Podman container!.