Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dariah
search
Commits
b404d1c1
Commit
b404d1c1
authored
Jul 14, 2021
by
Gradl, Tobias
Browse files
440: Build alternative Debian package for easy distribution of multiple
instances on one machine (OPENED) Task-Url:
#440
parent
76b91aa7
Pipeline
#25459
passed with stage
in 52 seconds
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
build.gradle
View file @
b404d1c1
...
...
@@ -9,7 +9,7 @@ allprojects {
apply
plugin:
'eclipse'
group
=
'eu.dariah.de.minfba'
version
=
'4.
2.2
-SNAPSHOT'
version
=
'4.
3
-SNAPSHOT'
repositories
{
mavenLocal
()
...
...
@@ -44,7 +44,8 @@ allprojects {
repoPass
=
project
.
hasProperty
(
'nexuspass'
)
?
project
.
getProperty
(
'nexuspass'
)
:
''
// Filled dynamically by packaging tasks
debFile
=
""
primaryDebFile
=
""
alternativeDebFile
=
""
rpmFile
=
""
aptRepo
=
""
}
...
...
search-ui/build.gradle
View file @
b404d1c1
...
...
@@ -41,33 +41,13 @@ bootWar {
launchScript
()
}
ospackage
{
os
=
LINUX
arch
=
'all'
task
primaryDeb
(
type:
Deb
)
{
packageName
"dariah-$project.name"
version
=
"${project.version}"
release
=
'1'
signingKeyId
(
'CB012F105B632B46C2A7B4918FC46DAC1BC3E238'
)
//installUtils file('scripts/utils.sh')
//preInstall file('scripts/search.preinst')
postInstall
file
(
'scripts/search-ui.postinst'
)
//preUninstall file('scripts/preUninstall.sh')
//postUninstall file('scripts/postUninstall.sh')
into
"/var/dfa/webapps/$project.name/"
configurationFile
"/etc/dfa/search/search.yml"
// Copy the actual .jar file
from
(
war
.
outputs
.
files
)
{
include
'*.war'
rename
{
String
filename
->
filename
.
replace
(
"-${project.version}.war"
,
".war"
)
}
fileMode
0755
}
from
(
"src/main/resources/application.deb.yml"
)
{
into
"/etc/dfa/search"
fileType
=
CONFIG
|
NOREPLACE
...
...
@@ -75,25 +55,67 @@ ospackage {
filename
.
replace
(
"application.deb.yml"
,
"search.yml"
)
}
}
from
(
"scripts/search-ui.service"
)
{
into
"/etc/systemd/system/"
}
doLast
{
project
.
primaryDebFile
=
archiveName
;
}
}
tasks
.
withType
(
Deb
)
{
dependsOn
(
build
)
task
alternativeDeb
(
type:
Deb
)
{
packageName
"dariah-$project.name-alt"
postInstall
file
(
'scripts/search-ui-alt.postinst'
)
into
"/var/dfa/webapps/$project.name-alt/"
configurationFile
"/etc/dfa/search-alt/search.yml"
from
(
"src/main/resources/application.deb-alt.yml"
)
{
into
"/etc/dfa/search-alt"
fileType
=
CONFIG
|
NOREPLACE
rename
{
String
filename
->
filename
.
replace
(
"application.deb-alt.yml"
,
"search.yml"
)
}
}
from
(
"scripts/search-ui-alt.service"
)
{
into
"/etc/systemd/system/"
}
doLast
{
project
.
d
ebFile
=
archiveName
;
project
.
alternativeD
ebFile
=
archiveName
;
}
}
buildDeb
{
tasks
.
withType
(
Deb
)
{
dependsOn
(
build
)
requires
(
'default-jdk'
).
or
(
'default-jdk-headless'
)
requires
(
'mongodb'
).
or
(
'mongodb-org'
)
requires
(
'elasticsearch'
)
from
(
"scripts/search-ui.service"
)
{
into
"/etc/systemd/system/"
os
=
LINUX
arch
=
'all'
version
=
"${project.version}"
release
=
'1'
signingKeyId
(
'CB012F105B632B46C2A7B4918FC46DAC1BC3E238'
)
// Copy the actual .jar file
from
(
war
.
outputs
.
files
)
{
include
'*.war'
rename
{
String
filename
->
filename
.
replace
(
"-${project.version}.war"
,
".war"
)
}
fileMode
0755
}
}
task
buildDebVariants
{
dependsOn
primaryDeb
dependsOn
alternativeDeb
}
publishing
{
publications
{
...
...
@@ -105,20 +127,25 @@ publishing {
}
}
task
publishDebPackage
{
dependsOn
buildDeb
task
publishDebPackage
s
{
dependsOn
buildDeb
Variants
def
distroPath
=
"$buildDir/distributions/"
doLast
{
println
"VERSON $version"
if
(
version
.
endsWith
(
'SNAPSHOT'
)
||
version
.
endsWith
(
'RELEASE'
))
{
aptRepo
=
version
.
endsWith
(
'SNAPSHOT'
)
?
aptTestingRepo
:
aptReleasesRepo
println
"Publishing Debian package $debFile as user $repoUser to $aptRepo"
println
"Publishing Debian package $primaryDebFile as user $repoUser to $aptRepo"
exec
{
executable
"curl"
args
"-f"
,
"-u"
,
"$repoUser:$repoPass"
,
"-H"
,
"Content-Type: multipart/form-data"
,
"--data-binary"
,
"@$distroPath$primaryDebFile"
,
"$aptRepo"
;
}
println
"Publishing Debian package $alternativeDebFile as user $repoUser to $aptRepo"
exec
{
executable
"curl"
args
"-f"
,
"-u"
,
"$repoUser:$repoPass"
,
"-H"
,
"Content-Type: multipart/form-data"
,
"--data-binary"
,
"@$distroPath$
d
ebFile"
,
"$aptRepo"
;
args
"-f"
,
"-u"
,
"$repoUser:$repoPass"
,
"-H"
,
"Content-Type: multipart/form-data"
,
"--data-binary"
,
"@$distroPath$
alternativeD
ebFile"
,
"$aptRepo"
;
}
}
}
}
publish
.
finalizedBy
publishDebPackage
\ No newline at end of file
publish
.
finalizedBy
publishDebPackages
\ No newline at end of file
search-ui/scripts/search-ui-alt.postinst
0 → 100644
View file @
b404d1c1
#!/bin/sh
# preinst script for search-ui
#
# create a search-ui group and user
if
!
getent passwd search
>
/dev/null 2>&1
;
then
adduser
--system
--no-create-home
--home
/var/lib/dfa/search-alt search
addgroup
--system
search
adduser search search
fi
# create db -- note: this should agree with dbpath in mongod.conf
if
[
!
-d
/var/lib/dfa/search-alt
]
;
then
mkdir
-p
/var/lib/dfa/search-alt
chown
search:search /var/lib/dfa/search-alt
fi
# create logdir -- note: this should agree with logpath in mongod.conf
if
[
!
-d
/var/log/search-alt
]
;
then
mkdir
-p
/var/log/search-alt
chown
search:search /var/log/search-alt
fi
# Check for changes to the service file
systemctl daemon-reload
search-ui/scripts/search-ui-alt.service
0 → 100644
View file @
b404d1c1
[Unit]
Description
=
search-alt
After
=
syslog.target
[Service]
User
=
search
ExecStart
=
/var/dfa/webapps/search-ui-alt/search-ui.war --spring.config.location=file:/etc/dfa/search-alt/search.yml
SuccessExitStatus
=
143
[Install]
WantedBy
=
multi-user.target
search-ui/src/main/resources/application.deb-alt.yml
0 → 100644
View file @
b404d1c1
server
:
port
:
8403
paths
:
main
:
/var/lib/dfa/search-alt
log
:
dir
:
/tmp
# pattern: "%-4relative [%thread] %-5level %logger{35}[%line]- %msg%n"
indexing
:
baseDir
:
/tmp/indexing_logs
log_queries
:
false
localization
:
defaultLocale
:
de
debug
:
true
theme
:
dariah-theme
mongo
:
host
:
127.0.0.1
port
:
27017
database
:
search-alt
contextPath
:
/search
baseUrl
:
http://localhost:8403${contextPath:/}
#baseUrl: https://externally.visible.example.com${contextPath:/}
spring
:
mvc
:
view
:
prefix
:
/WEB-INF/views/
suffix
:
.jsp
#logging:
# level:
# web: DEBUG
#es:
# hostname: localhost
# port: 9200
# useSSL: false
# username:
# password:
indexing
:
index_name_prefix
:
gs_alt_
index_config_file
:
index_config.json
search
:
log_all_queries
:
false
datamodels
:
integration
:
5eb11e106117b10b7b6c7c11
indexing
:
5a27ab9b0246440d479c6c46
presentation
:
5b9004394c7b0405ccf90b00
metadata
:
5cd3f505dd960f585e960f63
crawling
:
60812e54667bd50488d2b237
# modelsWithMessageCodes:
# - 598f06e706bffc03a8e44f82
# - 598f06e706bffc03a8e44f83
# modelsMessageCodePrefix: ~de.mww
# many default options missing here...
api
:
colreg
:
#base_url: https://teaching.clariah.de/colreg-ui/
base_url
:
http://localhost:8081/
dme
:
base_url
:
https://teaching.clariah.de/dme/
crawling
:
max_threads_per_service_type
:
6
api_access_politeness_span_ms
:
200
auth
:
baseUrl
:
${baseUrl}
#defaultLoginUrl: ${auth.baseUrl}
#defaultLogoutUrl: ${auth.baseUrl}
salt
:
Qmwp4CO7LDkOUDouAcCcUqd9ZGNbRG5Jyr5lpntOuB9
permissionHierarchy
:
ROLE_ADMINISTRATOR > ROLE_CONTRIBUTOR > ROLE_USER
permissionDefinitions
:
-
permissionSet
:
ROLE_ADMINISTRATOR
level
:
100
roleMappings
:
local
:
[
"
application_admin"
]
saml
:
[
"
generic-search-admins"
]
-
permissionSet
:
ROLE_CONTRIBUTOR
level
:
50
roleMappings
:
local
:
[
"
application_contributor"
]
saml
:
[
"
generic-search-contributors"
]
-
permissionSet
:
ROLE_USER
level
:
10
roleMappings
:
local
:
[
"
application_user"
]
saml
:
[
"
application_user"
]
local
:
enabled
:
true
authorizerName
:
local
# Same password for each user: 1234
users
:
-
username
:
'
tgradl'
passhash
:
'
$2a$10$EeajSQQUepa7H7.g4xQCaeO.hjUwh0yzYCMrfOkWCZGe1IiWaexa6'
roles
:
[
"
application_admin"
]
-
username
:
'
admin'
passhash
:
'
$2y$10$nmTcpRxs.RFUstkJJms6U.AW61Jmr64s9VNQLuhpU8gYrgzCapwka'
roles
:
[
"
application_admin"
]
-
username
:
'
contributor'
passhash
:
'
$2y$10$nmTcpRxs.RFUstkJJms6U.AW61Jmr64s9VNQLuhpU8gYrgzCapwka'
roles
:
[
"
application_contributor"
]
-
username
:
'
user'
passhash
:
'
$2y$10$nmTcpRxs.RFUstkJJms6U.AW61Jmr64s9VNQLuhpU8gYrgzCapwka'
roles
:
[
"
application_user"
]
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment