Erro ao criar o serviço systemd para o serviço acoplado

0

Eu tentei criar um script systemd para um serviço de encaixe:

[Unit]
Description=ScyllaDB 1
After=network-online.target docker.target
Wants=network-online.target systemd-networkd-wait-online.service docker.target

[Service]
Type=notify
Restart=on-failure
RestartSec=10s

User=foo
Group=users

WorkingDirectory=/home/foo/scylladb

ExecStartPre=/usr/bin/docker pull scylladb/scylla
ExecStart=/usr/bin/docker run --volume /home/foo/scylla1:/var/lib/scylla --name scylla1 \
    scylladb/scylla --developer-mode 1 --memory 1.5G --smp 3 \
    --listen-address 127.0.0.1 
    # --overprovisioned 1 --seeds 127.0.0.1 --broadcast-address 127.0.1.1
ExecStop=/usr/bin/docker stop scylla1

LimitNOFILE=1048576

ProtectSystem=full
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target

Eu fiz a execução:

sudo usermod -aG docker foo
mkdir -p /home/foo/scylla1/commitlog /home/foo/scylla1/data
sudo chown foo:users /home/foo/scylla1
sudo systemctl daemon-reload

EDIT : Quando eu tentei executar o comando manualmente usando foo user ele funciona bem, mas ao usar sudo systemctl restart scylladb ele mostra um erro:

May 17 14:58:55 x systemd[1]: Stopped ScyllaDB 1.
May 17 14:58:55 x systemd[1]: Starting ScyllaDB 1...
May 17 14:58:55 x systemd[1]: scylladb.service: Control process exited, code=exited status=210
May 17 14:58:55 x systemd[1]: Failed to start ScyllaDB 1.
May 17 14:58:55 x systemd[1]: scylladb.service: Unit entered failed state.
May 17 14:58:55 x systemd[1]: scylladb.service: Failed with result 'exit-code'.

Manualmente:

[foo@x ~]$ /usr/bin/docker pull scylladb/scylla
Using default tag: latest
latest: Pulling from scylladb/scylla
93857f76ae30: Already exists 
fcf3425de92f: Already exists 
a9768670d266: Already exists 
eaccce6402ed: Already exists 
a564f24ba7ea: Already exists 
c1c511852d0b: Already exists 
f9c8010402b4: Already exists 
654f38ed538a: Already exists 
64856b4587d3: Already exists 
74fbc1822a2d: Already exists 
fdeb9fe209e1: Already exists 
243856d4fcb5: Already exists 
0b59d050d95e: Already exists 
e677bcc6c3d3: Already exists 
ca2f175eb91a: Already exists 
912e754404b4: Already exists 
c80ea560f85c: Already exists 
9f2fa2f93fae: Already exists 
04cfbbeb59e2: Already exists 
a9996b00766d: Already exists 
1076dbbc8e7b: Already exists 
c4eda4b22480: Already exists 
Digest: sha256:9c9d23b9ab9bd392cf647d861edc1f48498f6c7ffd142ab9905c23cc3c463345
Status: Image is up to date for scylladb/scylla:latest
[foo@x ~]$ /usr/bin/docker pull scylladb/scylla^C
[foo@x ~]$ /usr/bin/docker run --volume /home/foo/scylla1:/var/lib/scylla --name scylla1 \
>         -d scylladb/scylla --developer-mode 1 --memory 1.5G --smp 3 \
>         --listen-address 127.0.0.1 
4c6e7685e5297028e582e7c19c75424dbf3160a0e46adb69325993d333dbae7e
[foo@x ~]$ /usr/bin/docker stop scylla1
scylla1

Qual é a causa possível disso?

    
por Kokizzu 17.05.2017 / 09:24

1 resposta

0

Aparentemente, o problema é que o diretório de trabalho não existe, deve ser /home/foo/scylla1 não /home/foo/scylladb , a segunda parte do problema é 1.5G não é parâmetro válido, 1G ou 2G funciona bem.

Este é o arquivo final do systemd scylladb.service :

[Unit]
Description=ScyllaDB 1
After=network-online.target docker.target
Wants=network-online.target systemd-networkd-wait-online.service docker.target

[Service]
Type=simple
Restart=on-failure
RestartSec=10s

User=foo
Group=docker

WorkingDirectory=/home/foo/scylla1
ExecStartPre=/usr/bin/docker rm scylla1
ExecStart=/usr/bin/docker run --volume /home/foo/scylla1:/var/lib/scylla --name scylla1 scylladb/scylla --developer-mode 1 --memory 2G --smp 3 --listen-address 127.0.0.1 
    # --overprovisioned 1 --seeds 127.0.0.1 --broadcast-address 127.0.1.1
ExecStop=/usr/bin/docker stop scylla1

LimitNOFILE=1048576

ProtectSystem=full
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target
    
por 17.05.2017 / 10:53