unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Debugging Shepherd Daemon. Possible escape char issue.
@ 2024-11-29 19:08 Jesse Millwood
  2024-11-29 21:25 ` Felix Lechner via
  2024-12-10 12:11 ` Jesse Millwood
  0 siblings, 2 replies; 5+ messages in thread
From: Jesse Millwood @ 2024-11-29 19:08 UTC (permalink / raw)
  To: help-guix

Hello,

I am trying to run some docker services as an oci-service-configuration 
entry.

I have one simple one running fine. However the one that I am having 
trouble with, I assume is an issue with quoting and escaping. I don't 
see any issue in /var/log/messages. I'd like to be able to see the 
actual command that Shepherd is trying to run. Is there a way to do that?

The Shepherd service I am trying to run is this:


(service oci-container-service-type
   (list
    (oci-container-configuration
     (image "traefik/whoami")
     (network "traefik-network")
     (extra-arguments
      '("--label"
"traefik.http.routers.whoami.rule=Host\(\\\"whoami.geekslab\\\")"))
     (log-file "/var/docker.whoami.log")
    )
))

The only feedback I get is this:

admin@geekslab ~/geekslab/scripts$ sudo herd status docker-whoami
Status of docker-whoami:
  It is stopped.
  It is enabled.
  Provides (docker-whoami).
  Requires (dockerd user-processes).
  Will not be respawned.

admin@geekslab ~/geekslab/scripts$ sudo herd start docker-whoami
  Service user-homes has been started.
  Service dockerd depends on elogind.
  Service docker-whoami depends on dockerd.
  herd: error: failed to start service docker-whoami

As stated before, nothing in /var/log/messages. I'm not sure where else 
to look. I feel like I'm missing something when trying to debug Shepherd 
services. I've also tried a lot of different combinations of escapes and 
such.

If I run the following from the shell though, it works fine:

sudo docker run --rm --name whoami --label 
"traefik.http.routers.whoami.rule=Host(\"whoami.geekslab\")" traefik/whoami

Notice the escaped quotes that need to be passed through. I am 
essentially trying to daemonize this docker run command.

Any Shepherd pointers here would be appreciated!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Debugging Shepherd Daemon. Possible escape char issue.
  2024-11-29 19:08 Debugging Shepherd Daemon. Possible escape char issue Jesse Millwood
@ 2024-11-29 21:25 ` Felix Lechner via
  2024-11-29 23:52   ` Jesse Millwood
  2024-12-10 12:11 ` Jesse Millwood
  1 sibling, 1 reply; 5+ messages in thread
From: Felix Lechner via @ 2024-11-29 21:25 UTC (permalink / raw)
  To: Jesse Millwood; +Cc: help-guix

Hi Jesse,

On Fri, Nov 29 2024, Jesse Millwood wrote:

> "traefik.http.routers.whoami.rule=Host\(\\\"whoami.geekslab\\\")"

It's a bit of a long short, but I might try:

> "traefik.http.routers.whoami.rule=Host(\"whoami.geekslab\")"

I dropped the escape from the opening parenthesis \( which which worked
on Geiser but seemed not needed.

Perhaps more significantly, I also the dropped escape character \\
before each of the escaped quotes because I'm not sure the Shepherd
offers shell expansion.

Kind regards
Felix


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Debugging Shepherd Daemon. Possible escape char issue.
  2024-11-29 21:25 ` Felix Lechner via
@ 2024-11-29 23:52   ` Jesse Millwood
  0 siblings, 0 replies; 5+ messages in thread
From: Jesse Millwood @ 2024-11-29 23:52 UTC (permalink / raw)
  To: help-guix

Thanks Felix,

I tried that just now and get the same exact error message when trying 
to start it.

Fwiw, this is in my operating system guile file. I run "sudo guix system 
-L <path-to-modules>/modules system.scm", where I have my services 
defined in modules in the modules directory structure. Then I try to run 
"sudo herd start docker-whoami" but I get the same error message on the 
cli but I don't see any error messages in /var/log/messages.

Is there a better interactive way to try running these services for 
debugging purposes?

On 11/29/24 16:25, Felix Lechner via wrote:
> Hi Jesse,
>
> On Fri, Nov 29 2024, Jesse Millwood wrote:
>
>> "traefik.http.routers.whoami.rule=Host\(\\\"whoami.geekslab\\\")"
> It's a bit of a long short, but I might try:
>
>> "traefik.http.routers.whoami.rule=Host(\"whoami.geekslab\")"
> I dropped the escape from the opening parenthesis \( which which worked
> on Geiser but seemed not needed.
>
> Perhaps more significantly, I also the dropped escape character \\
> before each of the escaped quotes because I'm not sure the Shepherd
> offers shell expansion.
>
> Kind regards
> Felix
>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Debugging Shepherd Daemon. Possible escape char issue.
  2024-11-29 19:08 Debugging Shepherd Daemon. Possible escape char issue Jesse Millwood
  2024-11-29 21:25 ` Felix Lechner via
@ 2024-12-10 12:11 ` Jesse Millwood
  2024-12-10 13:17   ` Jesse Millwood
  1 sibling, 1 reply; 5+ messages in thread
From: Jesse Millwood @ 2024-12-10 12:11 UTC (permalink / raw)
  To: help-guix

For what it's worth I figured this out with help from giacomo of the 
gocix project. He has a really neat herd action where you can query the 
command line invocation that was used. That helped quite a bit to figure 
out what the issue was. Turns out for passing labels to the docker 
invocation you have to wrap the argument in escaped quotes so that the 
whole thing is passed to the --label argument as a string:

                      (oci-extra-arguments
                       '("--label" 
"\"traefik.http.routers.whoami.rule=Host(`whoami.geekslab`)\""))

The backticks used here are because that is a string literal that is 
evaluated by docker, which is written in the Go programming language.

Jesse


On 11/29/24 14:08, Jesse Millwood wrote:
> Hello,
>
> I am trying to run some docker services as an 
> oci-service-configuration entry.
>
> I have one simple one running fine. However the one that I am having 
> trouble with, I assume is an issue with quoting and escaping. I don't 
> see any issue in /var/log/messages. I'd like to be able to see the 
> actual command that Shepherd is trying to run. Is there a way to do that?
>
> The Shepherd service I am trying to run is this:
>
>
> (service oci-container-service-type
>   (list
>    (oci-container-configuration
>     (image "traefik/whoami")
>     (network "traefik-network")
>     (extra-arguments
>      '("--label"
> "traefik.http.routers.whoami.rule=Host\(\\\"whoami.geekslab\\\")"))
>     (log-file "/var/docker.whoami.log")
>    )
> ))
>
> The only feedback I get is this:
>
> admin@geekslab ~/geekslab/scripts$ sudo herd status docker-whoami
> Status of docker-whoami:
>  It is stopped.
>  It is enabled.
>  Provides (docker-whoami).
>  Requires (dockerd user-processes).
>  Will not be respawned.
>
> admin@geekslab ~/geekslab/scripts$ sudo herd start docker-whoami
>  Service user-homes has been started.
>  Service dockerd depends on elogind.
>  Service docker-whoami depends on dockerd.
>  herd: error: failed to start service docker-whoami
>
> As stated before, nothing in /var/log/messages. I'm not sure where 
> else to look. I feel like I'm missing something when trying to debug 
> Shepherd services. I've also tried a lot of different combinations of 
> escapes and such.
>
> If I run the following from the shell though, it works fine:
>
> sudo docker run --rm --name whoami --label 
> "traefik.http.routers.whoami.rule=Host(\"whoami.geekslab\")" 
> traefik/whoami
>
> Notice the escaped quotes that need to be passed through. I am 
> essentially trying to daemonize this docker run command.
>
> Any Shepherd pointers here would be appreciated!
>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Debugging Shepherd Daemon. Possible escape char issue.
  2024-12-10 12:11 ` Jesse Millwood
@ 2024-12-10 13:17   ` Jesse Millwood
  0 siblings, 0 replies; 5+ messages in thread
From: Jesse Millwood @ 2024-12-10 13:17 UTC (permalink / raw)
  To: help-guix

Actually I'm not sure what my issue was before but I have this working 
as the extra arguments:

    (extra-arguments
     '("--label"
       "traefik.http.routers.whoami.rule=Host(`whoami.geekslab`)"))

Didn't have to wrap the whole thing in escaped quotes and used backticks 
for the go lang string literal in the rule.


On 12/10/24 07:11, Jesse Millwood wrote:
> For what it's worth I figured this out with help from giacomo of the 
> gocix project. He has a really neat herd action where you can query 
> the command line invocation that was used. That helped quite a bit to 
> figure out what the issue was. Turns out for passing labels to the 
> docker invocation you have to wrap the argument in escaped quotes so 
> that the whole thing is passed to the --label argument as a string:
>
>                      (oci-extra-arguments
>                       '("--label" 
> "\"traefik.http.routers.whoami.rule=Host(`whoami.geekslab`)\""))
>
> The backticks used here are because that is a string literal that is 
> evaluated by docker, which is written in the Go programming language.
>
> Jesse
>
>
> On 11/29/24 14:08, Jesse Millwood wrote:
>> Hello,
>>
>> I am trying to run some docker services as an 
>> oci-service-configuration entry.
>>
>> I have one simple one running fine. However the one that I am having 
>> trouble with, I assume is an issue with quoting and escaping. I don't 
>> see any issue in /var/log/messages. I'd like to be able to see the 
>> actual command that Shepherd is trying to run. Is there a way to do 
>> that?
>>
>> The Shepherd service I am trying to run is this:
>>
>>
>> (service oci-container-service-type
>>   (list
>>    (oci-container-configuration
>>     (image "traefik/whoami")
>>     (network "traefik-network")
>>     (extra-arguments
>>      '("--label"
>> "traefik.http.routers.whoami.rule=Host\(\\\"whoami.geekslab\\\")"))
>>     (log-file "/var/docker.whoami.log")
>>    )
>> ))
>>
>> The only feedback I get is this:
>>
>> admin@geekslab ~/geekslab/scripts$ sudo herd status docker-whoami
>> Status of docker-whoami:
>>  It is stopped.
>>  It is enabled.
>>  Provides (docker-whoami).
>>  Requires (dockerd user-processes).
>>  Will not be respawned.
>>
>> admin@geekslab ~/geekslab/scripts$ sudo herd start docker-whoami
>>  Service user-homes has been started.
>>  Service dockerd depends on elogind.
>>  Service docker-whoami depends on dockerd.
>>  herd: error: failed to start service docker-whoami
>>
>> As stated before, nothing in /var/log/messages. I'm not sure where 
>> else to look. I feel like I'm missing something when trying to debug 
>> Shepherd services. I've also tried a lot of different combinations of 
>> escapes and such.
>>
>> If I run the following from the shell though, it works fine:
>>
>> sudo docker run --rm --name whoami --label 
>> "traefik.http.routers.whoami.rule=Host(\"whoami.geekslab\")" 
>> traefik/whoami
>>
>> Notice the escaped quotes that need to be passed through. I am 
>> essentially trying to daemonize this docker run command.
>>
>> Any Shepherd pointers here would be appreciated!
>>
>
>



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-12-10 13:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-29 19:08 Debugging Shepherd Daemon. Possible escape char issue Jesse Millwood
2024-11-29 21:25 ` Felix Lechner via
2024-11-29 23:52   ` Jesse Millwood
2024-12-10 12:11 ` Jesse Millwood
2024-12-10 13:17   ` Jesse Millwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).