Skip to content

Instantly share code, notes, and snippets.

@chraibi
Created November 21, 2016 16:13
Show Gist options
  • Select an option

  • Save chraibi/8ad6cd966a94a28640fd5f49321bd744 to your computer and use it in GitHub Desktop.

Select an option

Save chraibi/8ad6cd966a94a28640fd5f49321bd744 to your computer and use it in GitHub Desktop.

Revisions

  1. Zander Baldwin revised this gist Aug 1, 2015. 1 changed file with 47 additions and 5 deletions.
    52 changes: 47 additions & 5 deletions initial.sh
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,55 @@
    # If you already have a webserver running you most likely won't be able to get GitLab
    # woring on ports 80 and 443. Port 22 should work because we change the default SSH
    # port on the host during server provisioning.
    HTTP_PORT=8080
    HTTPS_PORT=8443
    SSH_PORT=22

    # Install Docker (don't use Ubuntu's repositories, they're out of date).
    wget -qO- https://get.docker.com/ | sudo sh

    sudo docker run --detach --name gitlab --restart always \
    --publish 8080:80 --publish 22:22 --publish 8443:443 \
    # Spin up a GitLab container.
    sudo docker run --detach \
    --name gitlab \
    --restart always \
    --publish "$HTTP_PORT:80" \
    --publish "$SSH_PORT:22" \
    --publish "$HTTPS_PORT:443" \
    --volume /srv/gitlab/config:/etc/gitlab \
    --volume /srv/gitlab/logs:/var/log/gitlab \
    --volume /srv/gitlab/data:/var/opt/gitlab \
    gitlab/gitlab-ce:latest

    sudo docker run --detach --name gitlab-runner --restart always \
    # Edit the GitLab configuration and restart the container afterwards for the changes to
    # take effect.
    sudo nano /srv/gitlab/config/gitlab.rb
    sudo docker restart gitlab

    # Create a data container for housing the runner configuration.
    sudo docker run --detach \
    --name gitlab-runner-config \
    --volume /etc/gitlab-runner \
    zanderbaldwin/ubuntu-base:15.04

    # Create a data container for housing the cache volumes.
    sudo docker run --detach \
    --name gitlab-runner-cache \
    --restart always \
    # Add as many files/directories to cache here as you want.
    --volume /root/.composer \
    --volume /root/.npm \
    --volume /usr/local/bin/composer \
    zanderbaldwin/ubuntu-base:15.04

    # Create a build runner for the CI.
    RUNNER_ID=`sudo docker run --detach \
    --restart always \
    --volumes-from gitlab-runner-config \
    --volume /var/run/docker.sock:/var/run/docker.sock \
    --volume /srv/gitlab-runner/config:/etc/gitlab-runner \
    gitlab/gitlab-runner:latest
    gitlab/gitlab-runner:latest`


    sudo docker exec -it $RUNNER_ID gitlab-runner register \
    --executor docker \
    --docker-image zanderbaldwin/ci-runner-env:15.04 \
    --volumes-from gitlab-runner-cache
  2. Zander Baldwin created this gist Aug 1, 2015.
    13 changes: 13 additions & 0 deletions initial.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    wget -qO- https://get.docker.com/ | sudo sh

    sudo docker run --detach --name gitlab --restart always \
    --publish 8080:80 --publish 22:22 --publish 8443:443 \
    --volume /srv/gitlab/config:/etc/gitlab \
    --volume /srv/gitlab/logs:/var/log/gitlab \
    --volume /srv/gitlab/data:/var/opt/gitlab \
    gitlab/gitlab-ce:latest

    sudo docker run --detach --name gitlab-runner --restart always \
    --volume /var/run/docker.sock:/var/run/docker.sock \
    --volume /srv/gitlab-runner/config:/etc/gitlab-runner \
    gitlab/gitlab-runner:latest