C
Coder.com6mo ago
farah

how do i get coder to run all the time?

I understand what the below error literally means. just not in the context of coder. listen tcp 127.0.0.1:3000: bind: address already in use i ran the coder v2 install script and then set coder service to enable and run on reboot. but get the above error. so then i kill the process on port 3000. and run $coder server and everything works. but the coder server doesn’t run 24/7. because i killed the process what am i missing?
Solution:
What if you change it like this ```env #CODER_ACCESS_URL= CODER_HTTP_ADDRESS=127.0.0.1:3000 #CODER_PG_CONNECTION_URL=...
Jump to solution
14 Replies
Codercord
Codercord6mo ago
<#1235332377358893106>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Atif
Atif6mo ago
There is something else running in port 3000 Edit your /etc/coder.d/coder.env file and change CODER_HTTP_ADDRESS port to another port Or Find what's running on port 3000 and kill that process
farah
farah6mo ago
i should have been clearer, it’s coder that is running on that port 3000. i have the same issue, even after changing the port.
farah
farah6mo ago
it’s failing and it gives no logs coder.service - "Coder - Self-hosted developer workspaces on your infra" Loaded: loaded (/usr/lib/systemd/system/coder.service; enabled; preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Thu 2024-05-02 19:26:51 UTC;> Docs: https://coder.com/docs/coder-oss Process: 5690 ExecStart=/usr/bin/coder server (code=exited, status=1/FAILURE) Main PID: 5690 (code=exited, status=1/FAILURE) CPU: 39ms
farah
farah6mo ago
the webui is on a try coder domain. is this the problem? i was able to figure out how to find the error Failed to start coder.service - "Coder - Self-hosted developer workspaces on your infra". May 02 18:51:20 localhost systemd[1]: coder.service: Scheduled restart job, restart counter is at 5. May 02 18:51:20 localhost systemd[1]: Starting coder.service - "Coder - Self-hosted developer workspaces on your infra"... May 02 18:51:20 localhost coder[931]: Encountered an error running "coder server", see "coder server --help" for more information May 02 18:51:20 localhost coder[931]: error: configure http(s): listen tcp: address 1597: missing port in address May 02 18:51:20 localhost systemd[1]: coder.service: Main process exited, code=exited, status=1/FAILURE May 02 18:51:20 localhost systemd[1]: coder.service: Failed with result 'exit-code'. May 02 18:51:20 localhost systemd[1]: Failed to start coder.service - "Coder - Self-hosted developer workspaces on your infra". i changed the port to 1597. what else should i have changed?
Atif
Atif6mo ago
can you share what do you have in /etc/coderd./coder.env file
farah
farah6mo ago
farah@localhost:~$ cat /etc/coder.d/coder.env Coder must be reachable from an external URL for users and workspaces to connect. e.g. https://coder.example.com CODER_ACCESS_URL=https://<>.try.coder.app CODER_HTTP_ADDRESS=1597 CODER_PG_CONNECTION_URL= CODER_TLS_CERT_FILE= CODER_TLS_ENABLE= CODER_TLS_KEY_FILE= Run "coder server --help" for flag information.
Solution
Atif
Atif6mo ago
What if you change it like this
#CODER_ACCESS_URL=
CODER_HTTP_ADDRESS=127.0.0.1:3000
#CODER_PG_CONNECTION_URL=
#CODER_ACCESS_URL=
CODER_HTTP_ADDRESS=127.0.0.1:3000
#CODER_PG_CONNECTION_URL=
And then run
sudo systemctl daemon-reload
sudo systemctl restart coder
sudo systemctl enable coder --now
sudo systemctl daemon-reload
sudo systemctl restart coder
sudo systemctl enable coder --now
farah
farah6mo ago
i made the change and when i go the url this is the message {"message":"Peer is not connected."}
Atif
Atif6mo ago
Is it the same machine where you are running Coder and accessing it?
farah
farah6mo ago
no. im going to my access url, https://<>.pit-1.try.coder.app/login and the error is {"message":"Peer is not connected."} i’m unable to keep the instance alive 24/7. do i have to get my own domain name for that access url? i don’t understand what needs to be done. the only way i can get to the access url is to do ‘coder server’ on the server but then that is only for testing. as you know. once the terminal closes the instance is offline and i get the message ‘peer is not connected’
Atif
Atif6mo ago
you do not need to run coder server when you run it using the systemctl as a service It will keep running Yes if you have your own domain thats the best
farah
farah6mo ago
i understand this. my original ticket is saying it is not running as a service, what do i need to do to fix this. the error is peer is not connected. i can add a domain, but if that is not what’s causing the issue, i’ll add a domain after solving for coder not running on system start up.
Atif
Atif6mo ago
Could you come in https://discord.com/channels/747933592273027093/1204825825476616202 Lets debug this When its running as a servive you do not see the logs in your console. you need to get the try.coder URL from the journalctl logs these After checking the correct URL, the coder service is running fine.
Want results from more Discord servers?
Add your server