From 583b7bd6c1e0d939fb214b04fddacfe35263f717 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Thu, 30 Apr 2020 11:35:33 +0200 Subject: [PATCH 1/2] miniobs: Fix database setup for rails 6 --- dist/ci/miniobs/BSConfig.pm.patch | 21 ++++++++++++++++----- dist/ci/miniobs/Dockerfile | 14 ++------------ dist/ci/miniobs/prepare.sh | 17 +++++++++++++++++ 3 files changed, 35 insertions(+), 17 deletions(-) create mode 100644 dist/ci/miniobs/prepare.sh diff --git a/dist/ci/miniobs/BSConfig.pm.patch b/dist/ci/miniobs/BSConfig.pm.patch index 3f1962a2..82689510 100644 --- a/dist/ci/miniobs/BSConfig.pm.patch +++ b/dist/ci/miniobs/BSConfig.pm.patch @@ -1,11 +1,17 @@ ---- /usr/lib/obs/server/BSConfig.pm.back 2019-04-30 06:21:39.000000000 +0000 -+++ /usr/lib/obs/server/BSConfig.pm 2019-04-30 06:32:04.000000000 +0000 -@@ -34,3 +34,3 @@ +--- /usr/lib/obs/server/BSConfig.pm.orig 2020-04-29 19:34:39.000000000 +0000 ++++ /usr/lib/obs/server/BSConfig.pm 2020-04-30 10:05:14.000000000 +0000 +@@ -32,7 +32,7 @@ + my $frontend = undef; # FQDN of the WebUI/API server if it's not $hostname + # If defined, restrict access to the backend servers (bs_repserver, bs_srcserver, bs_service) -our $ipaccess = { +our $removed_ipaccess = { '^::1$' => 'rw', # only the localhost can write to the backend -@@ -48,5 +48,5 @@ + '^127\..*' => 'rw', # only the localhost can write to the backend + "^$ip\$" => 'rw', # Permit IP of FQDN +@@ -49,9 +49,9 @@ + #our $ssl_certfile = "/path/to/tls.pem"; + # Change also the SLP reg files in /etc/slp.reg.d/ when you touch hostname or port -our $srcserver = "http://$hostname:5352"; -our $reposerver = "http://$hostname:5252"; @@ -14,8 +20,13 @@ +our $reposerver = "http://repserver:5252"; +our $serviceserver = "http://serviceserver:5152"; our $clouduploadserver = "http://$hostname:5452"; -@@ -226,3 +226,3 @@ + + # you can use different ports for worker connections +@@ -250,7 +250,7 @@ + #our $modifyrepo = '/usr/bin/modifyrepo_c'; + # enable service dispatcher -our $servicedispatch = 1; +our $servicedispatch = 0; # max of 4 parallel running services (default) + # our $servicedispatch_maxchild = 4; diff --git a/dist/ci/miniobs/Dockerfile b/dist/ci/miniobs/Dockerfile index 2e50f6cf..6d5f6d12 100644 --- a/dist/ci/miniobs/Dockerfile +++ b/dist/ci/miniobs/Dockerfile @@ -10,22 +10,12 @@ RUN zypper install -y obs-api obs-worker obs-server \ COPY database.yml.local /srv/www/obs/api/config/database.yml -RUN /usr/lib/mysql/mysql-systemd-helper install ;\ - sed -e 's,127.0.0.1,0.0.0.0,' -i /etc/my.cnf ;\ - sed -e 's,server-id,skip-grant-tables,' -i /etc/my.cnf ;\ - /usr/lib/mysql/mysql-systemd-helper start & \ - /usr/lib/mysql/mysql-systemd-helper wait ;\ - /usr/bin/mysql -u root -e "SELECT @@version; CREATE USER 'root'@'%' IDENTIFIED BY 'opensuse'; GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION;" ;\ - chroot --userspec=wwwrun / /bin/bash -c "cd /srv/www/obs/api && DISABLE_DATABASE_ENVIRONMENT_CHECK=1 RAILS_ENV=production bundle exec rails db:create db:setup" ;\ - mysqladmin shutdown +COPY prepare.sh / +RUN bash -xe /prepare.sh COPY config.yml /srv/www/obs/api/config/options.yml COPY database.yml /srv/www/obs/api/config/database.yml -RUN sed -i -e 's,\(config.public_file_server.enabled\).*,\1 = true,; s,\(config.log_level\).*,\1 = :debug,' \ - /srv/www/obs/api/config/environments/production.rb -RUN rm -f /srv/www/obs/api/tmp/pids/server.pid - COPY BSConfig.pm.patch /tmp RUN patch /usr/lib/obs/server/BSConfig.pm /tmp/BSConfig.pm.patch diff --git a/dist/ci/miniobs/prepare.sh b/dist/ci/miniobs/prepare.sh new file mode 100644 index 00000000..f9f67dd4 --- /dev/null +++ b/dist/ci/miniobs/prepare.sh @@ -0,0 +1,17 @@ +#! /bin/sh + +/usr/lib/mysql/mysql-systemd-helper install +sed -e 's,127.0.0.1,0.0.0.0,' -i /etc/my.cnf +sed -e 's,server-id,skip-grant-tables,' -i /etc/my.cnf + +/usr/lib/mysql/mysql-systemd-helper start & +/usr/lib/mysql/mysql-systemd-helper wait + +#/usr/bin/mysqladmin -u root password 'opensuse' + +chroot --userspec=wwwrun / /bin/bash -c "cd /srv/www/obs/api && DISABLE_DATABASE_ENVIRONMENT_CHECK=1 SAFETY_ASSURED=1 RAILS_ENV=production bundle exec rake db:create db:setup" +mysqladmin shutdown + +sed -i -e 's,\(config.public_file_server.enabled\).*,\1 = true,; s,\(config.log_level\).*,\1 = :debug,' /srv/www/obs/api/config/environments/production.rb +rm -f /srv/www/obs/api/tmp/pids/server.pid + From 704ea52fda8e7d73f1b0bb984a10f94a944b7c61 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Thu, 30 Apr 2020 12:22:55 +0200 Subject: [PATCH 2/2] Update docker to run tumbleweed container --- .travis.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.travis.yml b/.travis.yml index 01f066f3..f3770110 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,24 @@ language: bash +sudo: required services: - docker script: + - sed -i -e "s,../..:,$PWD:," dist/ci/docker-compose.yml - docker-compose -f dist/ci/docker-compose.yml run flaker - for var in TRAVIS_BRANCH TRAVIS_JOB_ID TRAVIS_PULL_REQUEST; do echo "$var=${!var}"; done > travis.settings - docker-compose -f dist/ci/docker-compose.yml run test +before_install: + - > + if [ "$TRAVIS_OS_NAME" = "linux" ]; then + # Ensure that Travis uses the latest version of Docker. + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + sudo apt-get update + sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce + fi + notifications: email: recipients: