Skip to content

Commit

Permalink
rework
Browse files Browse the repository at this point in the history
  • Loading branch information
gsanchietti committed Jan 27, 2025
1 parent 7018a4b commit f224b1c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
18 changes: 10 additions & 8 deletions build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ pecbridge_tmp_dir=$(mktemp -d)
cleanup_list+=("${pecbridge_tmp_dir}")
tar -C "${pecbridge_tmp_dir}" -x -v -z -f pecbridge-*.tar.gz

# Download tmce plugin jar: plugin is encrypted with GPG, the password is 'subscription'
tmce_jar_url="https://distfeed.nethserver.org/webtop/webtop-tmceplugins-6.3.1.0.jar.gpg"
tmce_jar_path="${PWD}/webtop-tmceplugins-6.3.1.0.jar.gpg"
echo "Downloading encrypted tmce plugin jar from ${tmce_jar_url}..."
curl --fail -L -o "${tmce_jar_path}" "${tmce_jar_url}"

#Create webtop-webapp container
reponame="webtop-webapp"
container=$(buildah from docker.io/library/tomcat:8-jre8)
Expand All @@ -85,8 +79,6 @@ buildah add ${container} ${PWD}/zfaker/wrappers/php /usr/share/webtop/bin/php
buildah add ${container} ${PWD}/zfaker/wrappers/z-push-admin-wapper /usr/share/webtop/bin/z-push-admin-wrapper
buildah add ${container} ${pecbridge_tmp_dir}/pecbridge /usr/share/pecbridge
buildah add ${container} ${PWD}/webapp/ /
buildah add ${container} "${tmce_jar_path}" /usr/local/tomcat/webapps/webtop/WEB-INF/lib/webtop-tmceplugins.jar.gpg
buildah config --entrypoint=/entrypoint.sh ${container}
# Commit the image
buildah commit --rm "${container}" "${repobase}/${reponame}"

Expand Down Expand Up @@ -172,6 +164,16 @@ fi
echo "Build static UI files with node..."
buildah run --env="NODE_OPTIONS=--openssl-legacy-provider" nodebuilder-webtop sh -c "cd /usr/src/ui && yarn install && yarn build"

# Download tmce plugin jar: plugin is encrypted with GPG, the password is 'subscription'
tmce_jar_url="https://distfeed.nethserver.org/webtop/webtop-tmceplugins-6.3.1.0.jar.gpg"
tmce_jar_path="${PWD}/webtop-tmceplugins-6.3.1.0.jar.gpg"
echo "Downloading encrypted tmce plugin jar from ${tmce_jar_url}..."
curl --fail -L -o "${tmce_jar_path}" "${tmce_jar_url}"

# Add tmce plugin jar to the image
mkdir -p imageroot/plugins
cp "${tmce_jar_path}" imageroot/plugins/

# Add imageroot directory to the container image
buildah add "${container}" imageroot /imageroot
buildah add "${container}" ui/dist /ui
Expand Down
5 changes: 4 additions & 1 deletion imageroot/actions/configure-module/30subscription
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#

import agent
import subprocess

rdb = agent.redis_connect(privileged=False)

Expand All @@ -14,6 +15,8 @@ subscription = rdb.hgetall('cluster/subscription')
with open('subscription.env', 'w') as env:
if subscription:
env.write(f'VALID_SUBSCRIPTION=true\n')
env.write("TMCE_PLUGIN=--volume=./webtop-tmceplugins.jar:/usr/local/tomcat/webapps/webtop/WEB-INF/lib/webtop-tmceplugins.jar:z\n")
subprocess.run(['gpg', '--batch', '--yes', '--passphrase', 'subscription', '-d', '-o', 'webtop-tmceplugins.jar', '../plugins/webtop-tmceplugins.jar.gpg'])
else:
env.write(f'VALID_SUBSCRIPTION=false\n')

env.write(f"TMCE_PLUGIN=\n")
4 changes: 3 additions & 1 deletion imageroot/systemd/user/webapp.service
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ PartOf=webtop.service
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
EnvironmentFile=%S/state/environment
EnvironmentFile=%S/state/subscription.env
WorkingDirectory=%S/state
Restart=always
ExecStartPre=/bin/rm -f %t/webapp.pid %t/webapp.ctr-id
Expand All @@ -22,9 +23,10 @@ ExecStart=/usr/bin/podman run \
-Dcom.sun.jndi.ldap.object.disableEndpointIdentification=true \
-Dmail.mime.address.strict=false -Dwebtop.etc.dir=/etc/webtop \
-Duser.timezone=${WEBTOP_TIMEZONE}" \
--env-file=%S/state/subscription.env \
${TMCE_PLUGIN} \
--volume=webtop-home:/var/lib/nethserver/webtop \
--volume=./webtop.properties:/etc/webtop/webtop.properties:z \
--volume=./webtop-tmceplugins.jar:/usr/local/tomcat/webapps/webtop/WEB-INF/lib/webtop-tmceplugins.jar:z \
--pod=webtop \
--detach \
--conmon-pidfile=%t/webapp.pid \
Expand Down

0 comments on commit f224b1c

Please sign in to comment.