Merge pull request #2434 from coolo/fix_miniobs

miniobs: Fix database setup for rails 6
This commit is contained in:
Stephan Kulow 2020-04-30 14:18:41 +02:00 committed by GitHub
commit 56213c5d5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 17 deletions

View File

@ -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:

View File

@ -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;

View File

@ -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

17
dist/ci/miniobs/prepare.sh vendored Normal file
View File

@ -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