TruCol / Self-host-GitLab-CI-for-GitHub

Installs your own GitLab CI and runs it on all your GitHub repos, in a single command.
GNU Affero General Public License v3.0
4 stars 3 forks source link

Overview of intended setup with Raspberry Pi 4b, ssh-over-tor, tor gitlab website. #6

Open a-t-0 opened 3 years ago

a-t-0 commented 3 years ago
      <h2>Definitions</h2>

(assuming you are installing this on a server, and that the server can occasionally be accessed

Assumptions

  1. This assumes you have installed wifi on the device/server.
  2. This assumes you have installed ssh on the device/server.
  3. This assumes you have installed tor on the device such that it supports 2 websites and an ssh connection.

Usage

First time you run:

install.sh --ssh --tor --tor_ssh -- website --gitlab --gitlab_backup --gitlab_repo_backup0

That installs the following options:

ssh

  1. Detects whether the (Raspberry pi script has) ssh connection is set up and accessible.
    1.1 If it is not, it curls the ssh-setup repository and sets up an ssh client with some host/other device.
  2. Then adds a crontab command that ensures the SSH service is ran at startup.

Tor

  1. Detects whether you have installed tor on the device such that it supports 2 websites and an ssh connection.
    1.1 If it is not, it installs the tor connection requirements that allow for ssh and 2/n(TODO) websites.
  2. Then adds a crontab command that ensures the tor service is ran at startup.

tor_ssh

Combines tor and ssh arguments in the right order.
2. Optional: monitor tor connection and reboot device if tor connection is dropped.

Website

  1. Creates a cronjob that starts up the website as soon as a tor-connection is available.
  2. Optional: monitor tor connection and terminate website if tor-connection is dropped.

GitLab

  1. Installs a GitLab server
  2. Notifies user when it is done installing
  3. Prompts the user to log in to enter root credentials
  4. Creates a cronjob that starts up the GitLab as soon as a tor-connection is available.
  5. Installs a GitLab Runner
    5.1 Automatically adds GitLab cluster token to the runner, so that the runner only works for your own cluster, and does not start running for someone else.
  6. Creates a cronjob that starts up the GitLab runner as soon as the tor-connection is available.

GitLab Backup

  1. Checks if the correct files are presented in some relative folder.
    1.1 If the right files are present:
    1.1.1 It makes a new backup of the current GitLab cluster.
    1.1.2 Then it overwrites the existing GitLab cluster (e.g. repositories, users etc) with the presented backup.
    1.2. If the files are not present, it throws an error to the user, asking the user to present the necessary files.

gitlab_repo_backup0

  1. It checks whether the GitLab cluster backup restoration command is given. If it is, it explicitly asks if the user wants to add this repository into the cluster (even if it may already exist in the cluster, and hence will be overwritten). The user can answer:
    1.1 No, don't restore this repository, just restore the GitLab cluster.
    1.2 Only restore this repository if it does not already exist in the GitLab cluster that will be restored.
    1.3 Overwrite it at all costs even if it already exists in the GitLab cluster.
  2. Checks/waits until the GitLab server is running (Throw error after 3 hours). If the GitLab server is running:
  3. Checks if a specific repository already exists
    3.1 If it does not, it restores the backup of the repository.
    3.2. If it does,
    3.2.1 It prompts the user for permission to overwrite the repository.
    3.2.2 It creates a dated and timed backup of the existing repository.
    3.2.3 It overwrites the existing repository with the backup repository.
a-t-0 commented 2 years ago

Current implemented arguments: install_gitlab.sh -s -r -s installs GitLab server. -r installs GitLab runner. TODO: