Deploy go project to live serve?

Hello i’m new in go languages. how can i deploy go project to live server ?
i actually have no idea to do, in local computer we cen run project like this ./web. but how about in server ? which folder or file i must put on server and how i can run it ?

Recommend using the caddy Web server and its reverse proxy capability.

https://caddyserver.com/docs/proxy

That way you can still use the default port and proxy to the front end, for example in the Caddyfile:

proxy / localhost:8000

Then start your go program as a service. Caddy will automatically serve the site over https.

1 Like

Pretty much the same thing as on your local computer. I sometimes use nohup ./web & to run it in the background for a long time, but if your system gets rebooted you’ll have to bring the process up again.

Running a Go binary isn’t really any different in production or in dev, you just need to make sure that your production system is tuned for the kind of performance and permissions your application needs.

1 Like

Hi,

These days you get tons of advice for shipping and deploying stuff in docker containers. But as go build will create a single binary, have you considered to package your software as a deb or rpm package? Search for fpm from Jordan Sissel. Packaging is super easy with it.

If you have a modern OS with systems it is very easy to write a ~10 lines unit file to start your software with it. Put that into your rpm/deb and you’ll be fine in under an hour.

According to the Linux filesystem hierarchy standard your binary would go to /use/bin.

Regards
Marcus

i guess this is what you looking for…
:yum:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.