DevOps challenge

You are starting a startup company built around a revolutionary new technology. It would be a great loss if somebody would steal your product’s source code, so you want to keep it safe from spying eyes. Hmm, but where to store it?

Some of your options are keeping the files on your local computer, storing them on some external drives, however, these get in the way of collaboration with your associates. Let’s see the cloud options: Github is great but did you know it was acquired by Microsoft lately that caused a rather big upset among the online community (https://about.gitlab.com/2018/06/03/movingtogitlab/)? Furthermore, all the repositories are open by default, and only the paid tier can be private, but your budget is minimal until you can publish at least an MVP and look for seed money. What about Bitbucket? They offer free unlimited private repositories until your team is under 5 members, so you are going to have a bad time sooner or later. Is there a free option that is without any restriction, and can be privately deployed on your private server? Yes, Gitlab to the rescue! Gitlab (https://about.gitlab.com/) is an open source software that is completely free as a self-hosted application, so your precious ring software can be stored privately and securely while you are enjoying all the benefits of a “cloud” solution. Nice, we now have the tool we will use but while you are evaluating all its possibilities, you find out that you need to (re)deploy it several times to turn on additional features that you find useful. Changing core options and spinning up a new instance can be time-consuming, so you must find a way to automate the process to be able to focus on the development of your primary product.

Your task is to create a bash script (if you are using Linux) or a batch/powershell file (if your host machine is running Windows) what you can start on any computer with the same specifications and OS/software environment, and lean back while it does its job to start up a new Gitlab instance.

Gitlab depends on a couple of other services best to run next to Gitlab itself, namely: a Redis server for caching (https://redis.io/) and a PostgreSQL RDBMS for storing settings and data (https://www.postgresql.org/). You might also need Ruby (https://www.ruby-lang.org/en/) and a web server of your choice to make it run. For easy global access, you can deploy all these to a VPS (eg. all the Google accounts have free GCP credit of $300: https://cloud.google.com/free/docs/frequently-asked-questions), and hook it to a free DDNS service to get your free “yourcompany.whatever.tld” domain name that can always point to the ever-changing IP address of the server (eg. DuckDNS is trendy these days: https://www.duckdns.org/). Gitlab tries to send out its notifications in email, so you will also need an SMTP server but this time it is a good choice to depend on an external provider (eg. use the one given by Google with your Gmail account).

One of your friends give you a hint that it is a good move to invest some of your time choosing your future architecture carefully, and you should try to achieve your goal on Linux by default, as many tools are much easier to use there. If you have not tried it yet, you can give, for example, Ubuntu a chance on your laptop without removing your current OS: https://tutorials.ubuntu.com/tutorial/try-ubuntu-before-you-install

devops

Criteria

  • Bash script or batch/powershell file is created for automated deployment:
  • 1 point
  • The script is able to clean up its environment removing any configured services that are going to be deployed:
  • 1 point
  • The solution involves the use of containers (eg. Docker):
  • 1 point
  • Redis server up and running:
  • 1 point
  • PostgreSQL server up and running:
  • 1 point
  • A local Gitlab is accessible from a web browser on the same machine:
  • 1 point
  • Changing Gitlab defaults: a root account is configured with a strong password, a correct timezone is set up, secret keys are generated on-the-fly:
  • 1 point
  • Gitlab is able to send emails through an SMTP server:
  • 1 point
  • Gitlab is accessible by an IP address from any network:
  • 1 point
  • Gitlab is accessible by a domain name from any network synced via DDNS:
  • 1 point (if IP-based access does not work because of the domain set-up: 2 points)

Submission

When you are ready, you should show your handcrafted Gitlab deployer script and the running instance to the person responsible for this task (Immánuel Fodor).

A submission is not eligible for any points if the solution depends on a fully automated deployment provided by a 3rd party, eg. “Try our one-click Gitlab installer service now - by XY organization”.

A submission can earn partial points if some of the services are configured, running, their installation is automated, etc. Check out the criteria for the sum of 10 points.