Verified Commit d64b73f5 authored by Alessio Caiazza's avatar Alessio Caiazza Committed by Alessio Caiazza

Add registry support

parent 9c5cc7a2
......@@ -62,3 +62,7 @@
/.gitaly-ruby-bundle
/gitlab-docs
/bootstrap-rails.log
/registry_enabled
/registry_port
/registry/storage/
/registry/config.yml
......@@ -20,6 +20,9 @@ username = $(shell whoami)
sshd_bin = $(shell which sshd)
git_bin = $(shell which git)
webpack_port = $(shell cat webpack_port 2>/dev/null || echo '3808')
registry_enabled = $(shell cat registry_enabled 2>/dev/null || echo 'false')
registry_port = $(shell cat registry_port 2>/dev/null || echo '5000')
gitlab_from_container = $(shell [[ "$OSTYPE" == "linux-gnu" ]] && echo 'localhost' || echo 'docker.for.mac.localhost')
all: gitlab-setup gitlab-shell-setup gitlab-workhorse-setup support-setup gitaly-setup
......@@ -36,7 +39,7 @@ gitlab/config/gitlab.yml:
sed -e "s|/home/git|${gitlab_development_root}|"\
-e "s|/usr/bin/git|${git_bin}|"\
gitlab/config/gitlab.yml.example > gitlab/config/gitlab.yml
port=${port} webpack_port=${webpack_port} support/edit-gitlab.yml gitlab/config/gitlab.yml
port=${port} webpack_port=${webpack_port} registry_enabled=${registry_enabled} registry_port=${registry_port} support/edit-gitlab.yml gitlab/config/gitlab.yml
gitlab/config/database.yml:
sed "s|/home/git|${gitlab_development_root}|" database.yml.example > gitlab/config/database.yml
......@@ -202,7 +205,7 @@ gitaly/bin/gitaly: ${gitaly_clone_dir}/.git
# Set up supporting services
support-setup: .ruby-version foreman Procfile redis gitaly-setup postgresql openssh-setup nginx-setup
support-setup: .ruby-version foreman Procfile redis gitaly-setup postgresql openssh-setup nginx-setup registry-setup
@echo ""
@echo "*********************************************"
@echo "************** Setup finished! **************"
......@@ -361,6 +364,15 @@ nginx/logs:
nginx/tmp:
mkdir -p $@
registry-setup: registry/storage registry/config.yml localhost.crt
registry/storage:
mkdir -p $@
registry/config.yml:
cp registry/config.yml.example $@
gitlab_host=${gitlab_from_container} gitlab_port=${port} registry_port=${registry_port} support/edit-registry-config.yml $@
clean-config:
rm -f \
gitlab/config/gitlab.yml \
......@@ -375,6 +387,7 @@ clean-config:
gitlab-workhorse/config.toml \
gitaly/config.toml \
nginx/conf/nginx.conf \
registry/config.yml \
unlock-dependency-installers:
rm -f \
......
......@@ -17,3 +17,4 @@ rails-background-jobs: exec /usr/bin/env SIDEKIQ_LOG_ARGUMENTS=1 RAILS_ENV=devel
gitaly: exec gitaly/bin/gitaly /home/git/gitaly/config.toml
webpack: exec /usr/bin/env NODE_ENV=development DEV_SERVER_PORT=3808 support/exec-cd gitlab yarn dev-server
#geo-cursor: exec /usr/bin/env RAILS_ENV=development support/exec-cd gitlab/bin ./geo_log_cursor
registry: exec support/docker-registry
# Registry
If you want to enable Docker registry support you must first
install [docker](https://www.docker.com/#/developers).
In order to enable the registry you have to write `true` in `registry_enabled`
file and reconfigure your `gdk` installation.
```bash
echo true > registry_enabled
gdk reconfigure
```
Registry port defaults to `5000` but it can be changed writing the desired value
in `registry_port`.
Changing either registry or GitLab port number requires `gdk reconfigure`.
version: 0.1
log:
level: info
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
delete:
enabled: true
maintenance:
uploadpurging:
enabled: true
age: 8h
interval: 1h
dryrun: false
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3
auth:
token:
realm: http://127.0.0.1:3000/jwt/auth
service: container_registry
issuer: gitlab-issuer
rootcertbundle: /root/certs/certbundle
......@@ -36,7 +36,7 @@ foreman_start() {
}
db() {
foreman_start -c all=0,redis=1,postgresql=1,openldap=1,influxdb=1,webpack=1
foreman_start -c all=0,redis=1,postgresql=1,openldap=1,influxdb=1,webpack=1,registry=1
}
geo_db() {
......
#!/usr/bin/env bash
registry_enabled=$(cat registry_enabled 2>/dev/null)
if [[ "${registry_enabled}" == "true" ]]; then
if [[ "$OSTYPE" == "linux-gnu" ]]; then
run_opts="--net host"
fi
exec docker run --rm -p ${registry_port:-5000}:5000 ${run_opts} \
-v $(pwd)/registry/config.yml:/etc/docker/registry/config.yml \
-v $(pwd)/registry/storage:/var/lib/registry \
-v $(pwd)/localhost.crt:/root/certs/certbundle \
registry:2
else
echo "Docker registry disabled."
read
fi
......@@ -30,5 +30,15 @@ c
c
gitaly_address: unix:$(pwd)/gitaly.socket
.
/^ registry:/
a
enabled: ${registry_enabled:-false}
host: 127.0.0.1
port: ${registry_port:-5000}
api_url: http://127.0.0.1:${registry_port:-5000}/
key: ../localhost.key
path: ../registry/storage/
issuer: gitlab-issuer
.
wq
EOF
#!/bin/sh
# This script will edit the file named as the first argument in-place.
ed -s "$1" <<EOF
/^ addr:/c
addr: :${registry_port:-5000}
.
/^ realm:/c
realm: http://${gitlab_host:-127.0.0.1}:${gitlab_port:-3000}/jwt/auth
.
wq
EOF
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment