Version Control
At the end of this lesson you will have a version control system (Gogs) in place to manage all of the bits and pieces we change or customize. Version control tools are not just for programmers; if you are a SysAdmin striving for that elusive DevOps Engineer title, make friends with Git or any of the popular revision control tools.
On Master
sudo apt-get install screen mysql-server sudo adduser gogs ssh gogs@localhost wget https://dl.gogs.io/gogs_v0.9.0_linux_amd64.tar.gz tar -xzvf gogs_v0.9.0_linux_amd64.tar.gz cd gogs mysql -u'root' -p'!p@ssw0rd' < ~gogs/gogs/scripts/mysql.sql mkdir -p ~gogs/gogs/log mkdir -p ~gogs/gogs/custom/conf touch ~gogs/gogs/custom/conf/app.ini
Edit ~gogs/gogs/custom/conf/app.ini
and add the following to the file and save it:
[server] DOMAIN = master HTTP_PORT = 3000 ROOT_URL = http://master/gogs/ DISABLE_SSH = false SSH_PORT = 22 OFFLINE_MODE = false
Gogs at Startup
We need to link-up the existing init script and register it so Gogs starts during system startup.
sudo ln -s /home/gogs/gogs/scripts/init/debian/gogs /etc/init.d/gogs sudo update-rc.d gogs defaults sudo service gogs start
Gogs is now ready for final configuration.
At this point Gogs is running, unconfigured, listening on localhost.
Configure Gogs
Point your web browser to http://master/gogs to finish the configuration. By default, Gogs listens on port 3000 but we can access it on port 80 at our /gogs/
URL thanks to our Nginx reverse proxy settings we configured in an earlier exercise.
You'll need to create an account which will become the admin account for Gogs. Use the same username (waytta
) and password as before. In production or a larger scale implementation you might bind to Active Directory, Google or some other directory service for authentication but that is beyond the scope of this tutorial.
Add Gogs Users
Familiarize yourself with the Gogs admin interface by creating a couple of new users:
- User:
gogs-jenkins
- User:
gogs-saltstack
Create these users with the same password used earlier; we use them in later exercises.
Create Git Repo
Complete these steps logged into Gogs as the waytta
user:
- Click the
+
to the right ofMy Repositories
to create a new repository - Fill in the following information:
Repository Name: salt-states Visibility: Private
- Click
Create Repository
- Click the
salt-states
link to the newly created repository and you should see theQuick Guide
page.
We use the new repository and users in later lessons. Congratulations! You completed this lesson.