Commit 52a9e3ec authored by BAIRE Anthony's avatar BAIRE Anthony

remove the factories

Fix #185

- webapps are now located directly at the root of the registry
  (not in the /webapp subdir)

- factories are no longer stored in our registry, we directly reference
  images on the official docker registry
parent b0807974
......@@ -56,36 +56,6 @@ EOF
fi
}
# generate the factories
#
# this function is run after the rails container is initialised because the
# list of factories is read from the database
build_factories()
{
# build the factories
for name in `echo 'select concat(name, ":", version) as img from docker_os order by img;' | docker exec -i dev-mysql mysql -uroot allgo | grep -v '^img$'`
do
tag="localhost:8002/allgo/dev/factory/$name"
if docker inspect --type image -- "$name" >/dev/null 2>/dev/null
then
echo "$name: already pulled"
(set -x
docker tag -- "$name" "$tag"
docker push -- "$tag"
docker rmi -- "$name" || true
)
else
echo "$name:"
(set -x
docker pull -- "$name"
docker tag -- "$name" "$tag"
docker push -- "$tag"
docker rmi -- "$name"
)
fi
done
}
# remove container and its data
purge_container()
{
......@@ -196,11 +166,6 @@ do
init_container "$name"
done
# build the factories (if the rail container was initialised)
if [ -z "$NOBUILD" ] && echo "$TODO" | grep -q dev-rails ; then
build_factories
fi
install_secrets
# display running containers
......
......@@ -1561,7 +1561,7 @@ class DockerController:
return "%s-sandbox-%s" % (self.env, webapp.docker_name)
def gen_image_name(self, webapp):
return "%s/webapp/%s" % (self.registry, webapp.docker_name)
return "%s/%s" % (self.registry, webapp.docker_name)
def gen_job_name(self, job):
return "%s-job-%s-%d-%s" % (self.env, job.queue.name, job.id, job.webapp.docker_name)
......@@ -1571,7 +1571,17 @@ class DockerController:
str(job.webapp_id), job.access_token)
def gen_factory_name(self, docker_os):
return "%s/factory/%s" % (self.registry, docker_os.docker_name)
# NOTE: factory names now refer to an image from the official docker
# registry. To enforce this (and avoid a user using an allgo image as
# the docker_os), we explicitely prepend "registry-1.docker.io" in the
# repository name. Once the registry authentication is clarified and
# correctly secured we will be able to remove this restriction and
# allow using any docker images).
#
repo = docker_os.docker_name
if "/" not in repo:
repo = "library/" + repo
return "registry-1.docker.io/"+ repo
def inspect_job_container(self, client, job):
"""inspect the underlying container of a job + safety checks
......
......@@ -80,7 +80,7 @@ services:
- "/:/vol/host:ro"
environment:
ENV: "dev"
REGISTRY: "localhost:5000/allgo/dev"
REGISTRY: "localhost:5000"
DEBUG: "1"
networks: [dev]
......
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