Skip to content

Commit

Permalink
[dist] remove package obs-container-registry
Browse files Browse the repository at this point in the history
As the backend now can act as container registry/notary itself,
this package is no longer needed
  • Loading branch information
M0ses committed Oct 16, 2018
1 parent 44f2332 commit e1089f7
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 178 deletions.
1 change: 0 additions & 1 deletion Makefile.include
Expand Up @@ -11,7 +11,6 @@ APACHE_GROUP=www
APACHE_CONIFGDIR=/etc/apache2
APACHE_CONIFGDIR_VHOST=$(APACHE_CONIFGDIR)/vhosts.d
APACHE_VHOST_CONF=obs-apache24.conf
APACHE_VHOST_CONTAINER_REGISTRY_CONF=obs-container-registry.conf

# some sortcuts
test: test_unit
Expand Down
6 changes: 1 addition & 5 deletions dist/Makefile
Expand Up @@ -12,7 +12,7 @@ FILLUPDIR := /var/adm/fillup-templates

UNITDIR=/usr/lib/systemd/system/

install: install_obsapisetup install_apache install_initscripts install_project_update install_logrotate install_fillups install_slp install_obs_bin install_overview install_tests_appliance install_crontabs install_systemd_services install_registry_dirs
install: install_obsapisetup install_apache install_initscripts install_project_update install_logrotate install_fillups install_slp install_obs_bin install_overview install_tests_appliance install_crontabs install_systemd_services

#install_overview

Expand All @@ -23,7 +23,6 @@ install_obsapisetup: system_dirs
install_apache:
$(INSTALL) -d -m 755 $(DESTDIR)$(APACHE_CONIFGDIR_VHOST)
$(INSTALL) -m 644 $(APACHE_VHOST_CONF) $(DESTDIR)$(APACHE_CONIFGDIR_VHOST)/obs.conf
$(INSTALL) -m 644 $(APACHE_VHOST_CONTAINER_REGISTRY_CONF) $(DESTDIR)$(APACHE_CONIFGDIR_VHOST)/$(APACHE_VHOST_CONTAINER_REGISTRY_CONF)

install_initscripts: system_dirs
$(foreach script,$(INIT_SCRIPTS),$(shell $(INSTALL) -m 755 $(script) $(DESTDIR)/etc/init.d/$(script)) )
Expand Down Expand Up @@ -72,9 +71,6 @@ install_overview:
$(INSTALL) -d -m 755 $(DESTDIR)$(OBS_DOCUMENT_ROOT)/overview
$(INSTALL) -m 644 overview.html.TEMPLATE $(DESTDIR)$(OBS_DOCUMENT_ROOT)/overview

install_registry_dirs:
mkdir -p $(DESTDIR)/srv/www/obs/container-registry{,/log,/htdocs}

install_tests_appliance:
cp -r ./t/* $(DESTDIR)/usr/lib/obs/tests/appliance/

Expand Down
4 changes: 4 additions & 0 deletions dist/obs-apache24.conf
Expand Up @@ -110,4 +110,8 @@ LimitRequestFieldsize 20000

## Older firefox versions needs this, otherwise it wont cache anything over SSL.
Header append Cache-Control "public"

ProxyPass /v2 http://localhost:5352/registry
ProxyPassReverse /v2 http://localhost:5352/registry

</VirtualHost>
66 changes: 0 additions & 66 deletions dist/obs-container-registry.conf

This file was deleted.

23 changes: 0 additions & 23 deletions dist/obs-server.spec
Expand Up @@ -731,27 +731,4 @@ usermod -a -G docker obsservicerun
%config(noreplace) /etc/obs/cloudupload/.aws/credentials
%config /etc/obs/cloudupload/.ec2utils.conf

%package -n obs-container-registry
Summary: The Open Build Service -- container registry
Group: Productivity/Networking/Web/Utilities
Requires: docker-distribution-registry

%description -n obs-container-registry
The OBS Container Registry, based on the docker registry, which allows

* anonymous pulls from anywhere
* anonymous pushes from localhost.

This is done by proxying access to the registry through
apache and restricting any other http method than GET and HEAD
to localhost.


%files -n obs-container-registry
%defattr(-,root,root)
%dir /srv/www/obs/container-registry
%dir /srv/www/obs/container-registry/log
%dir /srv/www/obs/container-registry/htdocs
%config /etc/apache2/vhosts.d/obs-container-registry.conf

%changelog
66 changes: 0 additions & 66 deletions dist/setup-appliance.sh
Expand Up @@ -573,70 +573,6 @@ EOF

}

function setup_registry {
# check if docker registry is installed or return
logline "Starting container registry setup!"
rpm -q --quiet obs-container-registry
if [ $? -gt 0 ];then
logline "Package 'obs-container-registry' not found. Skipping registry setup!"
return
fi

# check if $container_registries already configured in BSConfig and return
grep -q -P '^\s*our\s+\$container_registries\s*=' /usr/lib/obs/server/BSConfig.pm
if [ $? -lt 1 ];then
logline "Configuration for container_registries already active in BSConfig. Skipping registry setup!"
return
fi

# check if $publish_containers already configured in BSConfig and return
grep -q -P '^\s*our\s+\$publish_containers\s*=' /usr/lib/obs/server/BSConfig.pm
if [ $? -lt 1 ];then
logline "Configuration for publish_containers already active in BSConfig. Skipping registry setup!"
return
fi

# reconfigure docker registry only to be accessible via apache proxy
logline "Bind registry to loopback interface only"
BN=`basename $0`
perl -p -i -e "s/0.0.0.0:5000/127.0.0.1:5000 # config changed by $BN/" /etc/registry/config.yml

# restart registry to reread confi if already started
logline "Activating registry startup"
systemctl status registry && systemctl restart registry

systemctl enable registry
systemctl start registry

# configure $container_registries and $publish_containers
# in BSConfig
logline "Configuring local container registry in BSConfig"
cat <<EOF >> /usr/lib/obs/server/BSConfig.pm
### Configuration added by $0
our \$container_registries = {
'localhost' => {
server => 'https://localhost:444',
user => 'ignored',
password => 'ignored',
# Please be aware of the trailing slash
repository_base => '/',
}
};
our \$publish_containers = [
'.*' => ['localhost'],
];
###
1;
EOF

# check obspublisher and restart if needed
logline "Checking obspublisher and restart if required."
systemctl status obspublisher && systemctl restart obspublisher

logline "Finished container registry setup!"
}

###############################################################################
#
# MAIN
Expand Down Expand Up @@ -762,8 +698,6 @@ if [[ ! $BOOTSTRAP_TEST_MODE == 1 && $0 != "-bash" ]];then

create_issue_file

setup_registry

if [ -n "$FQHOSTNAME" ]; then
create_overview_html
add_login_info_to_issue
Expand Down
3 changes: 1 addition & 2 deletions dist/t/osc/0200-check_docker_registry.ts
Expand Up @@ -11,7 +11,6 @@ BEGIN {
unshift @INC, "/usr/lib/obs/server";
};

use BSRPC;
use JSON::XS;

# These test need a lot of resources, so they should be
Expand Down Expand Up @@ -53,7 +52,7 @@ SKIP: {
my $repo;
while (1) {
$timeout--;
my $response = BSRPC::rpc("http://localhost:5000/v2/_catalog");
my $response = `curl https://localhost/v2/_catalog 2>/dev/null`;
my $json = decode_json($response);
if ( $json->{repositories}->[0]) {
$repo = $json->{repositories}->[0];
Expand Down
25 changes: 10 additions & 15 deletions src/backend/BSConfig.pm.template
Expand Up @@ -231,15 +231,11 @@ our $servicedispatch = 1;
# print all messages with a lower level than $debuglevel in addition to the normal log messages
#our $debuglevel = 1;

#our $container_registries = {
# 'localhost' => {
# server => 'https://my_public_registry',
# pushserver => 'https://localhost:444', # optional private push server
# user => 'ignored',
# password => 'ignored',
# # Please be aware of the trailing slash
# repository_base => '/',
# },
our $container_registries = {
'local' => {
server => $hostname,
pushserver => 'local:'
},
# 'staging-registry.example.com' => {
# server => '',
# user => '',
Expand All @@ -252,15 +248,15 @@ our $servicedispatch = 1;
# password => '',
# repository_base => '',
# },
#};
};

#our $publish_containers = [
our $publish_containers = [
# # key: regex to match projid
# # value: ArrayRef with identifiers for registries configured in $container_registries
# 'SUSE:.*' => [ 'registry.example.com', 'hub.docker.com' ],
# 'SUSE:.*' => [ 'registry.example.com', 'hub.docker.com' ],
# '.*:branches:.*' => [ 'staging-registry.example.com' ],
# '.*' => ['localhost'],
#];
'.*' => ['local'],
];


# special options to use for starting containers in call-service-in-docker.sh
Expand All @@ -276,5 +272,4 @@ our $servicedispatch = 1;
# public cloud uploader configuration
# our $cloudupload_pubkey = "/etc/obs/cloudupload/_pubkey"; # default setting


1;

0 comments on commit e1089f7

Please sign in to comment.