Skip to content

cf install deb10

mdavidsaver edited this page Apr 28, 2022 · 5 revisions

These ~2021 instructions are out of date as of 2022

Installing natively on a Debian 10 host

Pre-requisite packages

sudo apt-get install openjdk-11-jdk maven git curl wget

Elastic Search install

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.2.deb
sudo dpkg -i elasticsearch-6.3.2.deb
sudo systemctl start elasticsearch

Checkout and build

git clone https://github.com/ChannelFinder/ChannelFinder-SpringBoot.git cf
cd cf
mvn clean install
# wait for 140MB of jars to download...

Elastic Search preparation

./src/main/resources/mapping_definitions.sh

Testing

mvn spring-boot:run

Now in parallel run:

$ curl http://localhost:8080/ChannelFinder
{
  "name" : "ChannelFinder Service",
  "version" : "4.0.0",
  "elastichttps://github.com/ChannelFinder/ChannelFinder-SpringBoot/wiki" : {
    "status" : "Connected",
    "clusterName" : "elasticsearch",
    "clusterUuid" : "sA2L_cpoRD-H46c_Mya2mA",
    "version" : "6.3.2"
  }
}

Installation w/ systemd

Setup to run service w/ systemd. Main configuration will be in /etc/channelfinder/application.properties.

This uses the internal LDAP with default credentials in /etc/channelfinder/cf.ldif. Editing is highly recommended.

# service will run as this user
sudo adduser --system channelfinder

sudo install -d /usr/local/share/channelfinder
sudo cp target/ChannelFinder-4.0.0.jar /usr/local/share/channelfinder/

sudo install -d /etc/channelfinder
# copy default internal credentials.
sudo cp src/main/resources/cf.ldif /etc/channelfinder/

# create an empty local keystore.
sudo keytool -keystore /etc/channelfinder/cf.keystore -storepass mysecretpassword -genkeypair -alias unused -dname "CN=unused"
sudo keytool -keystore /etc/channelfinder/cf.keystore -storepass mysecretpassword -delete -alias unused

# copy default application.properties while changing paths to reference files under /etc/channelfinder/
sed \
 -e 's|^\(spring.ldap.embedded.ldif=\).*|\1file:/etc/channelfinder/cf.ldif|' \
 -e 's|^\(server.ssl.key-store=\).*|\1file:/etc/channelfinder/cf.keystore|' \
 -e 's|^\(server.ssl.key-store-password=\).*|\1mysecretpassword|' \
 src/main/resources/application.properties > application.properties
sudo cp application.properties /etc/channelfinder/

cat <<EOF > channelfinder.service
[Unit]
Description=ChannelFinder directory service
Documentation=https://github.com/ChannelFinder/ChannelFinder-SpringBoot
Requires=elasticsearch.service
After=network.target elasticsearch.service

[Service]
Type=simple
ExecStart=/usr/bin/java -jar /usr/local/share/channelfinder/ChannelFinder-4.0.0.jar \
 -Dspring.config.location=file:/etc/channelfinder/application.properties
User=channelfinder
Group=nogroup
# https://docs.spring.io/spring-boot/docs/current/reference/html/deployment.html#deployment-systemd-service
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target
EOF

sudo cp channelfinder.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl start channelfinder.service
sudo systemctl enable channelfinder.service