<commit_before>#!/bin/bash

set -euo pipefail

# based on https://stackoverflow.com/a/28709668/2693875 and https://stackoverflow.com/a/23006365/2693875
cecho() {
  local exp=$2
  local color=$1
  if ! [[ $color =~ ^[0-9]$ ]] ; then
     case $(echo "$color" | tr '[:upper:]' '[:lower:]') in
      bk | black) color=0 ;;
      r | red) color=1 ;;
      g | green) color=2 ;;
      y | yellow) color=3 ;;
      b | blue) color=4 ;;
      m | magenta) color=5 ;;
      c | cyan) color=6 ;;
      w | white|*) color=7 ;; # white or invalid color
     esac
  fi
  tput setaf $color
  echo "$exp"
  tput sgr0
}

cecho b "Starting GitLab..."

docker pull gitlab/gitlab-ee:latest

mkdir -p config
if [[ -f company.gitlab-license ]] ; then
  cecho b "EE license file found - using it..."
  cp company.gitlab-license config/
fi
mkdir -p logs
mkdir -p data

# run GitLab with root password pre-set and as many unnecessary features disabled to speed up the startup
docker run --detach \
    --hostname gitlab.foobar.com \
    --env GITLAB_OMNIBUS_CONFIG="gitlab_rails['initial_root_password'] = 'password'; registry['enable'] = false; grafana['enable'] = false; prometheus_monitoring['enable'] = false;" \
    --publish 443:443 --publish 80:80 --publish 2022:22 \
    --name gitlab \
    --restart always \
    --volume "$(pwd)/config:/etc/gitlab" \
    --volume "$(pwd)/logs:/var/log/gitlab" \
    --volume "$(pwd)/data:/var/opt/gitlab" \
    gitlab/gitlab-ee:latest

cecho b "Waiting 3 minutes before starting to check if GitLab has started..."
sleep 3m
until curl -X POST -s http://localhost/oauth/token | grep "The request is missing a required parameter" >/dev/null ; do<commit_msg>Increased wait time for GitLab Docker image to start<commit_after>#!/bin/bash

set -euo pipefail

# based on https://stackoverflow.com/a/28709668/2693875 and https://stackoverflow.com/a/23006365/2693875
cecho() {
  local exp=$2
  local color=$1
  if ! [[ $color =~ ^[0-9]$ ]] ; then
     case $(echo "$color" | tr '[:upper:]' '[:lower:]') in
      bk | black) color=0 ;;
      r | red) color=1 ;;
      g | green) color=2 ;;
      y | yellow) color=3 ;;
      b | blue) color=4 ;;
      m | magenta) color=5 ;;
      c | cyan) color=6 ;;
      w | white|*) color=7 ;; # white or invalid color
     esac
  fi
  tput setaf $color
  echo "$exp"
  tput sgr0
}

cecho b "Starting GitLab..."

docker pull gitlab/gitlab-ee:latest

mkdir -p config
if [[ -f company.gitlab-license ]] ; then
  cecho b "EE license file found - using it..."
  cp company.gitlab-license config/
fi
mkdir -p logs
mkdir -p data

# run GitLab with root password pre-set and as many unnecessary features disabled to speed up the startup
docker run --detach \
    --hostname gitlab.foobar.com \
    --env GITLAB_OMNIBUS_CONFIG="gitlab_rails['initial_root_password'] = 'password'; registry['enable'] = false; grafana['enable'] = false; prometheus_monitoring['enable'] = false;" \
    --publish 443:443 --publish 80:80 --publish 2022:22 \
    --name gitlab \
    --restart always \
    --volume "$(pwd)/config:/etc/gitlab" \
    --volume "$(pwd)/logs:/var/log/gitlab" \
    --volume "$(pwd)/data:/var/opt/gitlab" \
    gitlab/gitlab-ee:latest

cecho b "Waiting 10 minutes before starting to check if GitLab has started..."
sleep 10m
until curl -X POST -s http://localhost/oauth/token | grep "The request is missing a required parameter" >/dev/null ; do
{'fraction_non_alphanumeric': 0.15157770569153642, 'fraction_numerical': 0.03656738425243291, 'mean_word_length': 2.9123414071510956, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3479607', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1148, 'n_words': 353}