Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Mendelson AS2 server build #5

Merged
merged 3 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
MENDELSON_VERSION=1.1b63
JAVA_VERSION=11
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
include .env

DOWNLOAD_BASE_URL=https://downloads.sourceforge.net/project/mec-as2
DOWNLOAD_FILE=install_mendelson_opensource_as2_$(MENDELSON_VERSION).zip
DOWNLOAD_PARAMS=ts=$(shell date +%s)
DOWNLOAD_URL=$(DOWNLOAD_BASE_URL)/$(DOWNLOAD_FILE)?$(DOWNLOAD_PARAMS)

.PHONY : image start

image : image/mendelson-$(MENDELSON_VERSION).zip
docker build --build-arg MENDELSON_VERSION=$(MENDELSON_VERSION) -t saver/mendelson-as2:$(MENDELSON_VERSION) image
docker build \
--build-arg MENDELSON_VERSION=$(MENDELSON_VERSION) \
--build-arg JAVA_VERSION=$(JAVA_VERSION) \
-t saver/mendelson-as2:$(MENDELSON_VERSION) \
image

image/mendelson-$(MENDELSON_VERSION).zip :
curl -L http://downloads.sourceforge.net/project/mec-as2/install_mendelson_opensource_as2_$(MENDELSON_VERSION).zip > $@
curl -L $(DOWNLOAD_URL) --output $@

start :
docker-compose up -d
HTTP_PORT=$$(docker-compose port as2 8080 | cut -d: -f2);\
echo Use http://localhost:$${HTTP_PORT} to connect to your Mendelson AS2
echo Use http://localhost:$${HTTP_PORT} to connect to your Mendelson AS2
11 changes: 8 additions & 3 deletions image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ MAINTAINER Dmitry Myasnikov <[email protected]>

ENV MENDELSON_HOME /opt/mendelson/as2
ARG MENDELSON_VERSION=1.1b51

RUN yum install -y java-11-openjdk unzip tigervnc-server xorg-x11-server-Xvfb && \
yum clean all && mkdir -p $MENDELSON_HOME
ARG JAVA_VERSION=1.8.0

RUN yum install -y \
java-${JAVA_VERSION}-openjdk \
unzip \
tigervnc-server \
xorg-x11-server-Xvfb
RUN yum clean all && mkdir -p $MENDELSON_HOME

COPY custom $MENDELSON_HOME/custom

Expand Down
10 changes: 8 additions & 2 deletions image/custom/runas2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ else
echo "Workdir $WD is empty, performing preparation"
fi

# webas2 will crash if the file "database.acl" is not present in $WD
if [ ! -f $WD/database.acl ]; then
echo "File database.acl not found. Using default."
cp $MENDELSON_HOME/database.acl $WD/database.acl
fi

if [ ! -f $WD/webpasswd ]; then
echo "Web password file not found. Creating default."
cp $MENDELSON_HOME/custom/webpasswd $WD/webpasswd
Expand Down Expand Up @@ -77,7 +83,7 @@ done
cleanup() {
if [ "$(pidof java)" ]; then
echo "Gracefully stopping Mendelson AS2"
java -Xmx192M -Xms92M -classpath $CLASSPATH de.mendelson.comm.as2.AS2Shutdown;
java -Xmx192M -Xms92M -classpath $CLASSPATH de.mendelson.comm.as2.AS2Shutdown;
fi;
for f in $(find /tmp/ -name ".X*-lock"); do
num=$(echo $f | rev | cut -d'X' -f 1 | rev | cut -d- -f1) #get display number
Expand All @@ -93,7 +99,7 @@ cleanup

echo "$(cat $WD/vncpasswd)" > /tmp/passwd
echo "$(cat $WD/vncpasswd)" >> /tmp/passwd
vncpasswd < /tmp/passwd
vncpasswd < /tmp/passwd
rm -f /tmp/passwd

export DISPLAY=:1
Expand Down
Loading