Hello! I am attempting to snap Zookeeper and have created a yaml file as shown below:
name: zookeeper # you probably want to 'snapcraft register <name>'
base: core22 # the base snap is the execution environment for this snap
version: '3.6.3' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
This is my-snap's description. You have a paragraph or two to tell the
most important story about your snap. Keep it under 100 words though,
we live in tweetspace and your description wants to look good in the snap
store.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
apps:
init:
command: bin/zkServer-initialize.sh --config /snap/zookeeper/current/conf
environment:
JAVA_HOME: $SNAP/usr/lib/jvm/java-8-openjdk-amd64/jre
service:
command: bin/zkServer.sh --config /snap/zookeeper/current/conf start
plugs: [network, network-bind, removable-media]
install-mode: enable
daemon: simple
environment:
JAVA_HOME: $SNAP/usr/lib/jvm/java-8-openjdk-amd64/jre
ZOO_LOG_DIR: /var/snap/zookeeper/common
# LOG_DIR: $SNAP_COMMON/log
# ZOO_DATADIR: $SNAP_COMMON
# stop-command: bin/zkServer.sh --config /snap/zookeeper/current/conf stop
parts:
zookeeper:
plugin: nil
source: https://dlcdn.apache.org/zookeeper/zookeeper-${SNAPCRAFT_PROJECT_VERSION}/apache-zookeeper-${SNAPCRAFT_PROJECT_VERSION}-bin.tar.gz
stage-packages:
- openjdk-8-jre-headless
# build-environment:
# - JAVA_HOME: /usr/lib/jvm/java-8-openjdk-amd64/
override-build: |-
snapcraftctl build
sed -i "s:dataDir=/tmp/zookeeper:dataDir=/var/snap/zookeeper/common:g" conf/zoo_sample.cfg
cp conf/zoo_sample.cfg conf/zoo.cfg
sed -i '158i echo $ZOO_LOG_DIR' bin/zkServer.sh
sed -i "s:#!/usr/bin/env bash:#!/bin/bash -x:g" bin/zkServer.sh
cp -r ./* $SNAPCRAFT_PART_INSTALL
# override-prime: |
# snapcraftctl prime
# # remove dangling symlink
# # https://forum.snapcraft.io/t/resolve-package-contains-external-symlinks-error-when-trying-to-snap/2963
# # https://bugs.openjdk.java.net/browse/JDK-8253866
# rm -vf usr/lib/jvm/java-11-openjdk-*/lib/security/blacklisted.certs
Based on the logs, the service starts successfully, but Is immediately terminated as shown here:
Sep 19 10:46:15 gurren zookeeper.service[2716946]: ++ cat /var/snap/zookeeper/common/zookeeper_server.pid
Sep 19 10:46:15 gurren zookeeper.service[2716854]: + pid=2716897
Sep 19 10:46:15 gurren zookeeper.service[2716854]: + ps -p 2716897
Sep 19 10:46:15 gurren zookeeper.service[2716854]: + echo STARTED
Sep 19 10:46:15 gurren zookeeper.service[2716854]: STARTED
Sep 19 10:46:15 gurren systemd[1]: snap.zookeeper.service.service: Deactivated successfully.
Does anyone have any ideas on why the process is terminated? I have checked journalctl, snap logs, and the zookeeper logs and cannot find any errors. Is this a snapcraft issue or could it be an issue with zookeeper?
TIA