Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
open-build-service-debian
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
obs
open-build-service-debian
Commits
b1f97e27
Verified
Commit
b1f97e27
authored
4 years ago
by
Andrej Shadura
Browse files
Options
Downloads
Patches
Plain Diff
Split docker-entrypoint.sh into three separate files
parent
4bfd6cba
Branches
Branches containing commit
No related tags found
1 merge request
!21
OBS SSO implementation
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
Dockerfile
+1
-1
1 addition, 1 deletion
Dockerfile
configure-app.sh
+26
-0
26 additions, 0 deletions
configure-app.sh
configure-db.sh
+73
-0
73 additions, 0 deletions
configure-db.sh
docker-entrypoint.sh
+2
-91
2 additions, 91 deletions
docker-entrypoint.sh
with
102 additions
and
92 deletions
Dockerfile
+
1
−
1
View file @
b1f97e27
...
@@ -68,7 +68,7 @@ VOLUME /var/lib/mysql
...
@@ -68,7 +68,7 @@ VOLUME /var/lib/mysql
ADD
https://salsa.debian.org/debian/dbconfig-common/-/commit/0908c4892c91917504b9dd15007e8085451c6a2a.diff /tmp/dbconfig-common-tmp-attr-fix.diff
ADD
https://salsa.debian.org/debian/dbconfig-common/-/commit/0908c4892c91917504b9dd15007e8085451c6a2a.diff /tmp/dbconfig-common-tmp-attr-fix.diff
RUN
patch
-p1
/usr/sbin/dbconfig-generate-include /tmp/dbconfig-common-tmp-attr-fix.diff
RUN
patch
-p1
/usr/sbin/dbconfig-generate-include /tmp/dbconfig-common-tmp-attr-fix.diff
COPY
docker-entrypoint.sh
/opt/docker-entrypoint.sh
COPY
docker-entrypoint.sh
configure-app.sh configure-db.sh /opt/
ENTRYPOINT
/opt/docker-entrypoint.sh
ENTRYPOINT
/opt/docker-entrypoint.sh
EXPOSE
80 443
EXPOSE
80 443
CMD
/usr/bin/supervisord -n
CMD
/usr/bin/supervisord -n
This diff is collapsed.
Click to expand it.
configure-app.sh
0 → 100755
+
26
−
0
View file @
b1f97e27
#!/bin/sh
if
[
-z
"
$OBS_BACKEND_HOST
"
]
;
then
echo
>
&2
'error: server backend is unavailable and hostname option is not specified '
echo
>
&2
' You need to specify OBS_BACKEND_HOST'
exit
1
fi
# Generate ssl-cert
make-ssl-cert generate-default-snakeoil
--force-overwrite
# Place api and repo url on index page
FQHOSTNAME
=
$(
hostname
)
sed
-e
"s,___API_URL___,https://
$FQHOSTNAME
,g"
\
-e
"s,___REPO_URL___,http://
$FQHOSTNAME
:82,g"
\
/usr/share/obs/overview/overview.html.TEMPLATE
>
\
/usr/share/obs/overview/index.html
if
[
!
-z
"
$OBS_BACKEND_HOST
"
]
;
then
sed
-i
s/
"source_host: localhost"
/
"source_host:
${
OBS_BACKEND_HOST
}
"
/g /etc/obs/api/config/options.yml
fi
service memcached start
echo
"Setup rails app. Skip duplicate database error if database already exist."
/usr/share/obs/api/script/rake-tasks.sh setup
service obsapidelayed start
service apache2 restart
This diff is collapsed.
Click to expand it.
configure-db.sh
0 → 100755
+
73
−
0
View file @
b1f97e27
#!/bin/sh
if
[
-z
"
$DB_HOST
"
-o
-z
"
$DB_ROOT_PASSWORD
"
-o
-z
"
$DB_NAME
"
-o
-z
"
$DB_USER
"
-o
-z
"
$DB_PASSWORD
"
]
;
then
echo
>
&2
'error: database is uninitialized and password option is not specified or OBS'
echo
>
&2
' You need to specify DB_HOST, DB_ROOT_PASSWORD, DB_NAME, DB_USER and DB_PASSWORD'
exit
1
fi
# Remember database passwords permanently in debconf?
echo
"dbconfig-common dbconfig-common/remember-admin-pass boolean true"
| debconf-set-selections
# Configure database for with dbconfig-common?
echo
"dbconfig-common dbconfig-common/dbconfig-install boolean true"
| debconf-set-selections
# Configure database for obs-api with dbconfig-common?
echo
"obs-api obs-api/dbconfig-install boolean true"
| debconf-set-selections
echo
"obs-api obs-api/dbconfig-reinstall boolean true"
| debconf-set-selections
# Password of the database's administrative user:
echo
"obs-api obs-api/mysql/admin-pass password
${
DB_ROOT_PASSWORD
}
"
| debconf-set-selections
# Password of the database's administrative user:
echo
"dbconfig-common dbconfig-common/mysql/admin-pass password
${
DB_ROOT_PASSWORD
}
"
| debconf-set-selections
# MySQL application password for :
echo
"dbconfig-common dbconfig-common/mysql/app-pass password
${
DB_PASSWORD
}
"
| debconf-set-selections
# Password confirmation:
echo
"dbconfig-common dbconfig-common/app-password password
${
DB_PASSWORD
}
"
| debconf-set-selections
echo
"dbconfig-common dbconfig-common/app-password-confirm password
${
DB_PASSWORD
}
"
| debconf-set-selections
# Password confirmation:
echo
"dbconfig-common dbconfig-common/password password
${
DB_PASSWORD
}
"
| debconf-set-selections
echo
"dbconfig-common dbconfig-common/password-confirm password
${
DB_PASSWORD
}
"
| debconf-set-selections
# Password confirmation:
echo
"obs-api obs-api/app-password password
${
DB_PASSWORD
}
"
| debconf-set-selections
echo
"obs-api obs-api/app-password-confirm password
${
DB_PASSWORD
}
"
| debconf-set-selections
# Password confirmation:
echo
"obs-api obs-api/password password
${
DB_PASSWORD
}
"
| debconf-set-selections
echo
"obs-api obs-api/password-confirm password
${
DB_PASSWORD
}
"
| debconf-set-selections
# MySQL application password for obs-api:
echo
"obs-api obs-api/mysql/app-pass password
${
DB_PASSWORD
}
"
| debconf-set-selections
# Host running the MySQL server for obs-api:
echo
"obs-api obs-api/remote/newhost string
${
DB_HOST
}
"
| debconf-set-selections
# Name of the database's administrative user:
echo
"obs-api obs-api/mysql/admin-user string root"
| debconf-set-selections
# Host name of the MySQL database server for obs-api:
# Choices:
echo
"obs-api obs-api/remote/host select
${
DB_HOST
}
"
| debconf-set-selections
# Host name of the database server for :
# Choices:
echo
"dbconfig-common dbconfig-common/remote/host select
${
DB_HOST
}
"
| debconf-set-selections
# Port number for the MySQL service:
echo
"obs-api obs-api/remote/port string 3306"
| debconf-set-selections
# Connection method for MySQL database of obs-api:
# Choices: Unix socket, TCP/IP
echo
"obs-api obs-api/mysql/method select Unix socket"
| debconf-set-selections
# MySQL database name for obs-api:
echo
"obs-api obs-api/db/dbname string
${
DB_NAME
}
"
| debconf-set-selections
# MySQL username for obs-api:
echo
"obs-api obs-api/db/app-user string
${
DB_USER
}
@
${
DB_NAME
}
"
| debconf-set-selections
echo
"mariadb-server-10.1 mysql-server/root_password password
${
DB_ROOT_PASSWORD
}
"
| debconf-set-selections
echo
"mariadb-server-10.1 mysql-server/root_password_again password
${
DB_ROOT_PASSWORD
}
"
| debconf-set-selections
echo
"Starting database server."
if
[
!
-d
"/var/lib/mysql/mysql"
]
;
then
DEBIAN_FRONTEND
=
noninteractive dpkg-reconfigure mariadb-server-10.1
service mysql start
# Run dpkg-reconfigure twice to make sure it reconfigured correctly.
echo
"Configuring database
${
DB_NAME
}
for
${
DB_USER
}
@
${
DB_NAME
}
."
DEBIAN_FRONTEND
=
noninteractive dpkg-reconfigure obs-api
else
service mysql start
cp
/usr/share/obs/api/config/database.yml.example /etc/obs/api/config/database.yml
sed
-i
s/
"database: obsapi"
/
"database:
${
DB_NAME
}
"
/g /etc/obs/api/config/database.yml
sed
-i
s/
"username: obs-api"
/
"username:
${
DB_USER
}
"
/g /etc/obs/api/config/database.yml
sed
-i
s/
"password: _DBC_DBPASS_"
/
"password:
${
DB_PASSWORD
}
"
/g /etc/obs/api/config/database.yml
fi
This diff is collapsed.
Click to expand it.
docker-entrypoint.sh
+
2
−
91
View file @
b1f97e27
...
@@ -4,96 +4,7 @@
...
@@ -4,96 +4,7 @@
rm
-rfv
/run/
*
rm
-rfv
/run/
*
mkdir
-m
a
=
rwxt /run/lock
mkdir
-m
a
=
rwxt /run/lock
if
[
-z
"
$DB_HOST
"
-o
-z
"
$DB_ROOT_PASSWORD
"
-o
-z
"
$DB_NAME
"
-o
-z
"
$DB_USER
"
-o
-z
"
$DB_PASSWORD
"
-o
-z
"
$OBS_BACKEND_HOST
"
]
;
then
/opt/configure-db.sh
echo
>
&2
'error: database is uninitialized and password option is not specified or OBS'
/opt/configure-app.sh
echo
>
&2
'error: server backend is unavailable and hostname option is not specified '
echo
>
&2
' You need to specify DB_HOST, DB_ROOT_PASSWORD, DB_NAME, DB_USER, DB_PASSWORD and OBS_BACKEND_HOST'
exit
1
fi
# Generate ssl-cert
make-ssl-cert generate-default-snakeoil
--force-overwrite
# Place api and repo url on index page
FQHOSTNAME
=
`
hostname
`
sed
-e
"s,___API_URL___,https://
$FQHOSTNAME
,g"
\
-e
"s,___REPO_URL___,http://
$FQHOSTNAME
:82,g"
\
/usr/share/obs/overview/overview.html.TEMPLATE
>
\
/usr/share/obs/overview/index.html
# Remember database passwords permanently in debconf?
echo
"dbconfig-common dbconfig-common/remember-admin-pass boolean true"
| debconf-set-selections
# Configure database for with dbconfig-common?
echo
"dbconfig-common dbconfig-common/dbconfig-install boolean true"
| debconf-set-selections
# Configure database for obs-api with dbconfig-common?
echo
"obs-api obs-api/dbconfig-install boolean true"
| debconf-set-selections
echo
"obs-api obs-api/dbconfig-reinstall boolean true"
| debconf-set-selections
# Password of the database's administrative user:
echo
"obs-api obs-api/mysql/admin-pass password
${
DB_ROOT_PASSWORD
}
"
| debconf-set-selections
# Password of the database's administrative user:
echo
"dbconfig-common dbconfig-common/mysql/admin-pass password
${
DB_ROOT_PASSWORD
}
"
| debconf-set-selections
# MySQL application password for :
echo
"dbconfig-common dbconfig-common/mysql/app-pass password
${
DB_PASSWORD
}
"
| debconf-set-selections
# Password confirmation:
echo
"dbconfig-common dbconfig-common/app-password password
${
DB_PASSWORD
}
"
| debconf-set-selections
echo
"dbconfig-common dbconfig-common/app-password-confirm password
${
DB_PASSWORD
}
"
| debconf-set-selections
# Password confirmation:
echo
"dbconfig-common dbconfig-common/password password
${
DB_PASSWORD
}
"
| debconf-set-selections
echo
"dbconfig-common dbconfig-common/password-confirm password
${
DB_PASSWORD
}
"
| debconf-set-selections
# Password confirmation:
echo
"obs-api obs-api/app-password password
${
DB_PASSWORD
}
"
| debconf-set-selections
echo
"obs-api obs-api/app-password-confirm password
${
DB_PASSWORD
}
"
| debconf-set-selections
# Password confirmation:
echo
"obs-api obs-api/password password
${
DB_PASSWORD
}
"
| debconf-set-selections
echo
"obs-api obs-api/password-confirm password
${
DB_PASSWORD
}
"
| debconf-set-selections
# MySQL application password for obs-api:
echo
"obs-api obs-api/mysql/app-pass password
${
DB_PASSWORD
}
"
| debconf-set-selections
# Host running the MySQL server for obs-api:
echo
"obs-api obs-api/remote/newhost string
${
DB_HOST
}
"
| debconf-set-selections
# Name of the database's administrative user:
echo
"obs-api obs-api/mysql/admin-user string root"
| debconf-set-selections
# Host name of the MySQL database server for obs-api:
# Choices:
echo
"obs-api obs-api/remote/host select
${
DB_HOST
}
"
| debconf-set-selections
# Host name of the database server for :
# Choices:
echo
"dbconfig-common dbconfig-common/remote/host select
${
DB_HOST
}
"
| debconf-set-selections
# Port number for the MySQL service:
echo
"obs-api obs-api/remote/port string 3306"
| debconf-set-selections
# Connection method for MySQL database of obs-api:
# Choices: Unix socket, TCP/IP
echo
"obs-api obs-api/mysql/method select Unix socket"
| debconf-set-selections
# MySQL database name for obs-api:
echo
"obs-api obs-api/db/dbname string
${
DB_NAME
}
"
| debconf-set-selections
# MySQL username for obs-api:
echo
"obs-api obs-api/db/app-user string
${
DB_USER
}
@
${
DB_NAME
}
"
| debconf-set-selections
echo
"mariadb-server-10.1 mysql-server/root_password password
${
DB_ROOT_PASSWORD
}
"
| debconf-set-selections
echo
"mariadb-server-10.1 mysql-server/root_password_again password
${
DB_ROOT_PASSWORD
}
"
| debconf-set-selections
echo
"Starting database server."
if
[
!
-d
"/var/lib/mysql/mysql"
]
;
then
DEBIAN_FRONTEND
=
noninteractive dpkg-reconfigure mariadb-server-10.1
service mysql start
# Run dpkg-reconfigure twice to make sure it reconfigured correctly.
echo
"Configuring database
${
DB_NAME
}
for
${
DB_USER
}
@
${
DB_NAME
}
."
DEBIAN_FRONTEND
=
noninteractive dpkg-reconfigure obs-api
else
service mysql start
cp
/usr/share/obs/api/config/database.yml.example /etc/obs/api/config/database.yml
sed
-i
s/
"database: obsapi"
/
"database:
${
DB_NAME
}
"
/g /etc/obs/api/config/database.yml
sed
-i
s/
"username: obs-api"
/
"username:
${
DB_USER
}
"
/g /etc/obs/api/config/database.yml
sed
-i
s/
"password: _DBC_DBPASS_"
/
"password:
${
DB_PASSWORD
}
"
/g /etc/obs/api/config/database.yml
fi
if
[
!
-z
"
$OBS_BACKEND_HOST
"
]
;
then
sed
-i
s/
"source_host: localhost"
/
"source_host:
${
OBS_BACKEND_HOST
}
"
/g /etc/obs/api/config/options.yml
fi
service memcached start
echo
"Setup rails app. Skip duplicate database error if database already exist."
/usr/share/obs/api/script/rake-tasks.sh setup
service obsapidelayed start
service apache2 restart
/usr/bin/supervisord
-n
/usr/bin/supervisord
-n
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment