Open siennathesane opened 2 years ago
Update: I did get it working, just not with the network/user/group configs. I'm going to leave this open for now since network-online.target
isn't available, even though I was able to work through my issue.
Given this configuration:
[Unit]
Description="HashiCorp Consul - A service mesh solution"
Documentation=https://www.consul.io/
[Service]
ExecStart=/home/linuxbrew/.linuxbrew/bin/consul agent -server -ui -datacenter dc1 -data-dir /tmp/pleiades -bind 127.0.0.1
ExecReload=/bin/kill --signal HUP $MAINPID
KillMode=process
KillSignal=SIGTERM
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
And this command to setup symlinks:
sudo ln -s $PWD/consul.service /etc/systemd/system/consul.service
When this command is run:
sudo systemctl enable consul
Then this is the result:
$ sudo systemctl start consul
$ sudo systemctl status consul
● consul.service - "HashiCorp Consul - A service mesh solution"
Loaded: loaded (/etc/systemd/system/consul.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2022-05-21 13:08:34 MDT; 4s ago
Docs: https://www.consul.io/
Main PID: 6956 (consul)
Tasks: 13 (limit: 30700)
Memory: 28.5M
CGroup: /system.slice/consul.service
└─6956 /home/linuxbrew/.linuxbrew/bin/consul agent -server -ui -datacenter dc1 -data-dir /tmp/pleiades -bind 127.0.0.1
May 21 13:08:34 DESKTOP-S8SIUD6 consul[6956]: 2022-05-21T13:08:34.265-0600 [INFO] agent.router: Initializing LAN area manager
May 21 13:08:34 DESKTOP-S8SIUD6 consul[6956]: 2022-05-21T13:08:34.266-0600 [INFO] agent.server: Adding LAN server: server="DESKTOP-S8SIUD6 (Addr: tcp/127.0.0.1:8300) (DC: dc1)"
May 21 13:08:34 DESKTOP-S8SIUD6 consul[6956]: 2022-05-21T13:08:34.266-0600 [INFO] agent.server.autopilot: reconciliation now disabled
May 21 13:08:34 DESKTOP-S8SIUD6 consul[6956]: 2022-05-21T13:08:34.266-0600 [INFO] agent.server: Handled event for server in area: event=member-join server=DESKTOP-S8SIUD6.dc1 area=wan
May 21 13:08:34 DESKTOP-S8SIUD6 consul[6956]: 2022-05-21T13:08:34.266-0600 [WARN] agent: [core]grpc: addrConn.createTransport failed to connect to {dc1-127.0.0.1:8300 DESKTOP-S8SIUD6.dc1 <nil> 0 <nil>}. Err: connection error: desc = "transport: Error while dialing dia>
May 21 13:08:34 DESKTOP-S8SIUD6 consul[6956]: 2022-05-21T13:08:34.267-0600 [INFO] agent: Started DNS server: address=127.0.0.1:8600 network=udp
May 21 13:08:34 DESKTOP-S8SIUD6 consul[6956]: 2022-05-21T13:08:34.267-0600 [INFO] agent: Started DNS server: address=127.0.0.1:8600 network=tcp
May 21 13:08:34 DESKTOP-S8SIUD6 consul[6956]: 2022-05-21T13:08:34.267-0600 [INFO] agent: Starting server: address=127.0.0.1:8500 network=tcp protocol=http
May 21 13:08:34 DESKTOP-S8SIUD6 consul[6956]: 2022-05-21T13:08:34.267-0600 [INFO] agent: started state syncer
May 21 13:08:34 DESKTOP-S8SIUD6 consul[6956]: 2022-05-21T13:08:34.267-0600 [INFO] agent: Consul agent running!
And it was verified to be available via curl:
curl -v localhost:8500
* Trying 127.0.0.1:8500...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8500 (#0)
> GET / HTTP/1.1
> Host: localhost:8500
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 301 Moved Permanently
< Content-Type: text/html; charset=utf-8
< Location: /ui/
< Date: Sat, 21 May 2022 19:08:55 GMT
< Content-Length: 39
<
<a href="/ui/">Moved Permanently</a>.
* Connection #0 to host localhost left intact
And the browser:
Describe the bug
Some unit configurations won't be able to exist due to missing network target.
I don't think WSL2 needs a
network-online.target
, but it might help to simulate it for units which need it.Steps to reproduce
Given this service file:
When this command is run under a user slice (see #13):
Then this is the expected result:
Expected behavior
The unit
consul.service
should run.Windows version
19044.1706
Linux kernel version
Linux DESKTOP-S8SIUD6 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Distro
Ubuntu 20.04
How did you install that distro?
Enabled
distrod
in an existing WSL2 distroLogs
additional comment
Interestingly, if you remove the
network-online.target
and then run the command again,brew
thinks it starts, but the unit isn't actually running:Not quite sure why it's not registered, but it doesn't error out.