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

Docker logs empty after recreating simplexmq container #638

Closed
mrg358 opened this issue Feb 15, 2023 · 5 comments
Closed

Docker logs empty after recreating simplexmq container #638

mrg358 opened this issue Feb 15, 2023 · 5 comments

Comments

@mrg358
Copy link

mrg358 commented Feb 15, 2023

After recreating simplexmq container, docker no longer outputs smp-server.log content.

@shumvgolove
Copy link
Collaborator

Please specify exact steps to reproduce the issue.

@mrg358
Copy link
Author

mrg358 commented Feb 16, 2023

Sure. I tried to reproduce again fresh. Same results.

Step 1.

docker run -d -e addr="smp1.example.net" -p 5223:5223 -v $HOME/simplex/config:/etc/opt/simplex:z -v $HOME/simplex/logs:/var/opt/simplex:z --name simplexmq simplexchat/simplexmq
--name simplexmq simplexchat/simplexmq
0aa8c59aac27456c14bbd5f24c80e8ab667306f0779dfbc1d24a3aabcdef455b

Step 2.

docker logs -f simplexmq
Signature ok
subject=CN = smp1.example.net
Getting CA Private Key
Server initialized, you can modify configuration in /etc/opt/simplex/smp-server.ini.
Run `smp-server start` to start server.
----------
You should store CA private key securely and delete it from the server.
If server TLS credential is compromised this key can be used to sign a new one, keeping the same server identity and established connections.
CA private key location:
/etc/opt/simplex/ca.key
----------
SMP server v4.3.1
Fingerprint: IJzSOqjnrF-dsybOHO0DVSRY3oXq5abFZ3M347htB5g=
Server address: smp://IJzSOqjnrF-dsybOHO0DVSRY3oXq5abFZ3M347htB5g=@smp1.example.net

fresh start with newly created volumes looks ok.

Step 3.

docker stop simplexmq && docker rm simplexmq

Step 4.

docker run -d -e addr="smp1.example.net" -p 5223:5223 -v $HOME/simplex/config:/etc/opt/simplex:z -v $HOME/simplex/logs:/var/opt/simplex:z --name simplexmq simplexchat/simplexmq
--name simplexmq simplexchat/simplexmq
31c5d07de2b307ac011b1c9ab5f473194b0e6cb17ac486e06e51440e546e837a

Step 5.

docker logs -f simplexmq
 

docker logs empty, no status.

Step 6.

sudo tail -f /home/ubuntu/simplex/logs/smp-server.log
SMP server v4.3.1
Fingerprint: IJzSOqjnrF-dsybOHO0DVSRY3oXq5abFZ3M347htB5g=
Server address: smp://IJzSOqjnrF-dsybOHO0DVSRY3oXq5abFZ3M347htB5g=@smp1.example.net
Store log: /var/opt/simplex/smp-server-store.log
Listening on port 5223 (TLS)...
not expiring inactive clients
creating new queues allowed
[INFO 2023-02-16 14:00:45 +0000 src/Simplex/Messaging/Server.hs:739] restoring messages from file /var/opt/simplex/smp-server-messages.log
[INFO 2023-02-16 14:00:45 +0000 src/Simplex/Messaging/Server.hs:749] messages restored

i can confirm simplexmq runs and functions ok, but docker fails to output smp-server.log file after container re-creation.

@samsapti
Copy link
Contributor

@mrg358 the reason there's no output in docker logs, is probably due to the last line in entrypoint:

exec smp-server start > "$logd"/smp-server.log 2>&1

It redirects all output to smp-serverlog instead of stdout/stderr. Now, the reason it's printed the first time SimpleXMQ is run, is due to line 19 in entrypoint:

smp-server init -y -l "$@"

This is the first time initialization of the SMP server (hence it only outputs info on first run), notice that the output is not redirected to a file, so it prints to stdout/stderr, which is why it's catched by docker logs.

@shumvgolove
Copy link
Collaborator

shumvgolove commented Apr 23, 2023

Hey @samsapti

Yeah, you're right. Since docker logs is the proper way to log (duh) output of containers, I'll remove the redirection to the file in the entrypoint. Thanks for investigating.

@shumvgolove
Copy link
Collaborator

Should be fixed with 605970f . Please pull recent image from simplexchat/smp-server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants