Project

Profile

Help

Story #1051 » setup_v2.sh

rbarlow, 08/17/2015 09:14 PM

 
#!/usr/bin/bash -e


# You need the .bashrc that the Vagrant or dev-setup.sh environment creates. You can get it from
# playpen/ansible/roles/dev/files/bashrc if you aren't using one of those envs.
. ~/.bashrc

# Switch back to pulp-2.6
pstop
mongo pulp_database drop_database.js
pushd ~/devel
for r in {pulp_deb,pulp_docker,pulp_openstack,pulp_ostree,pulp_puppet,pulp_python,pulp_rpm,pulp}; do
if [ -d $r ]; then
pushd $r
sudo ./pulp-dev.py -U
popd
fi
done
pushd pulp
git checkout 2.6-testing
sudo ./pulp-dev.py -I
popd
# This one is necessary to work around a Pulp httpd config bug, where some plugin MUST install an
# httpd config.
pushd pulp_rpm
git checkout 2.6-release
sudo ./pulp-dev.py -I
popd
pushd pulp_docker
git checkout docker_v2_api
sudo ./pulp-dev.py -I
popd
popd
find ~/devel -name "*.pyc" -delete
sudo -u apache pulp-manage-db
sudo dnf install -y python-webpy
pstart


# Create a couple of docker repos in Pulp
pulp-admin login -u admin -p admin
pulp-admin docker repo create --repo-id v2_registry --feed http://localhost:5000 --upstream-name registry
pulp-admin docker repo create --repo-id v1_busybox --feed https://index.docker.io --upstream-name busybox


# Configure a local v2 docker registry
if ! grep -q "INSECURE_REGISTRY='--insecure-registry localhost:5000" /etc/sysconfig/docker; then
sudo sed -i "s/# INSECURE_REGISTRY='--insecure-registry '/INSECURE_REGISTRY='--insecure-registry localhost:5000'/" /etc/sysconfig/docker
fi
sudo systemctl restart docker
sudo docker pull registry:2
sudo docker run -p 5000:5000 registry:2 &
sleep 8


# Upload the docker registry to the local v2 registry
sudo docker tag registry:2 localhost:5000/registry:2
sudo docker push localhost:5000/registry:2


# These commented lines should sync & publish correctly if we get everything right in the end
# pulp-admin docker repo sync run --repo-id v1_busybox
# pulp-admin docker repo sync run --repo-id v2_registry
(2-2/2)