azukaar / Cosmos-Server

☁️ The Most Secure and Easy Selfhosted Home Server. Take control of your data and privacy without sacrificing security and stability (Authentication, anti-DDOS, anti-bot)
https://cosmos-cloud.io
Other
2.96k stars 105 forks source link

[BUG]: Custom Entrypoint not working #250

Closed Nonobis closed 1 month ago

Nonobis commented 1 month ago

What happened?

I am trying to add UpSnap via compose, because i am not findind a version in official or custom appstore

What should have happened?

Docker should be create serving on port 8090 and custom apk "awake" should be installed correctly. If u remove custom endpoint cosmos create and run docker correctly. But i need the custom apk....

How to reproduce the bug?

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Relevant log output

Creation logs :

Creating Service...                              
Starting creation of new service...
Pulling image ghcr.io/seriousm4x/upsnap:4
4 Pulling from seriousm4x/upsnap 
{"status":"Digest: sha256:66172a9b49e93b9d705a406bc8830d2e3bc6e4231ca4b03dcab89372c2d2c894"}
{"status":"Status: Image is up to date for ghcr.io/seriousm4x/upsnap:4"}
Image ghcr.io/seriousm4x/upsnap:4 pulled
Checking service upsnap...
Creating container upsnap...
Checking directory /mnt/host/home/nonobis/upsnap for bind mount
[WARN] Container upsnap already exist, overwriting.
Stopping container: upsnap
Removing container: upsnap
Container upsnap created
Container upsnap initiated
[SUCCESS] [OPERATION SUCCEEDED]. SERVICE STARTED

Container Logs :

2024-05-10 05:08:46
update: line 0: syntax error: unterminated quoted string
2024-05-10 05:08:46
update: line 0: syntax error: unterminated quoted string
2024-05-10 05:08:47
update: line 0: syntax error: unterminated quoted string
2024-05-10 05:08:47
update: line 0: syntax error: unterminated quoted string
2024-05-10 05:08:48
update: line 0: syntax error: unterminated quoted string
2024-05-10 05:08:50
update: line 0: syntax error: unterminated quoted string
2024-05-10 05:08:53
update: line 0: syntax error: unterminated quoted string
2024-05-10 05:08:59
update: line 0: syntax error: unterminated quoted string
2024-05-10 05:09:12
update: line 0: syntax error: unterminated quoted string

Other details

Json generated by cosmos

{ "services": { "upsnap": { "container_name": "upsnap", "image": "ghcr.io/seriousm4x/upsnap:4", "environment": [ "TZ=Europe/Paris", "UPSNAP_INTERVAL=@every 10s", "UPSNAP_SCAN_RANGE=192.168.1.0/24", "UPSNAP_SCAN_TIMEOUT=500ms", "UPSNAP_PING_PRIVILEGED=true", "UPSNAP_WEBSITE_TITLE=WOL Family D.", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "labels": {}, "ports": [], "volumes": [ { "Type": "bind", "Source": "/home/nonobis/upsnap", "Target": "/app/pb_data" } ], "networks": { "host": {} }, "routes": null, "restart": "unless-stopped", "devices": null, "expose": [], "depends_on": [], **"entrypoint": "/bin/sh -c \"apk update && apk add --no-cache awake && rm -rf /var/cache/apk/* && ./upsnap serve --http 0.0.0.0:8090\"",** "working_dir": "/app", "hostname": "cosmos", "network_mode": "host", "healthcheck": { "test": [ "CMD-SHELL", "curl -fs \"http://localhost:8090/api/health\" || exit 1" ], "interval": 10, "timeout": 0, "retries": 0, "start_period": 0 }, "dns": [ "192.168.1.254" ] } } }

System details

azukaar commented 1 month ago
Nonobis commented 1 month ago

Ok so not a bug sorry.

But in my case, i have only one entrypoint (in an external lxc under docker-compose, it's working perflectly), how can i set */bin/sh -c "apk update && apk add --no-cache awake && rm -rf /var/cache/apk/ && ./upsnap serve --http 0.0.0.0:8090"** in the entrypoint in cosmos if i can't use \" for protect quotes ?

Nonobis commented 1 month ago

Found a solution ...

In Cosmos-Server json :

  "entrypoint": "sh -c /app/pb_data/startup.sh",

Extracted command in startup.sh

azukaar commented 1 month ago

You dont need quotations, edit the original compose with

    entrypoint: /bin/sh -c "apk update && apk add --no-cache <YOUR_PACKAGE> && rm -rf /var/cache/apk/* && ./upsnap serve --http 0.0.0.0:8090"

and it will work