We will use Ubuntu 22.04.1 as a base system. Of course, in general, you can use any Linux distribution.
apt-get update
apt-get install -y unzip openjdk-19-jdk
cd /opt
curl -o membrane.zip -L https://github.com/membrane/api-gateway/releases/download/v5.2.0/membrane-api-gateway-5.2.0.zip
unzip membrane.zip
rm membrane.zip
ln -sf membrane-api-gateway-5.2.0 membrane-api-gateway
addgroup --system membrane
adduser --system --group membrane
Create a file called /etc/systemd/system/membrane.service
with the following contents:
[Unit]
Description=Membrane
After=network-online.target
Requires=network-online.target
[Service]
ExecStart=/usr/bin/bash -c /opt/membrane-api-gateway/service-proxy.sh
WorkingDirectory=/opt/membrane-api-gateway
Restart=always
RestartSec=10s
TimeoutSec=60
User=membrane
Group=membrane
[Install]
WantedBy=multi-user.target
For example, to log everything to stdout (which gets collected by Systemd and which can be monitored using journalctl -u membrane.service
), replace /opt/membrane-api-gateway/conf/log4j2.xml
by
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="%d{ABSOLUTE} %5p %tid %tn %c{1}:%L - %m%n" />
</Console>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="STDOUT" />
</Root>
</Loggers>
</Configuration>
To customize your installation, you would change /opt/membrane-api-gateway/conf/proxies.xml
. In this demo, we use the default configuration.
systemctl daemon-reload
systemctl start membrane
You might want to monitor the system log, or run
curl -v http://localhost:2000
systemctl enable membrane