I am new using go. I’ve built a static webpage that has a contact form. I have handled the data of that form by using the net/http package. I want to deploy that site to a server. How do I do that? Can I manage just the contact form with the golang program or should I manage the whole site by using the package templates/html?
I want to use the caddy webserver to automate the ssl certs every 90 days.
Can you give further info? What do you mean by “handled the form”? Are you emailing the data, writing it to a database, etc? Also why do you want to change your SSL cert every 90 days? Most people will issue a cert for a min. of 1 year.
Let’s Encrypt automatically renews the certificate every 90 days. Caddy uses Let’s Encrypt out of the box and therefore is a dead-easy way of getting a TLS-secured Web site up and running.
I am using the LetsEncrypt certs services which is free, but have expiration period of 90 days.
Thank you for your reply. I am emailing the data. Well that is the goal. I am using Let’s encrypt certs which are valid only for 90 days as far as I know.
Since you already have to deploy the contact form handler, you might as well have that same program deal with ssl and serve your static assets.
For LetsEncrypt, start with this autocert example, but make sure and add a cache so that when your program restarts it doesn’t have to replace certs that aren’t expired yet.
To serve your static assets, start with this file server example.
I run my site, https://pocketgophers.com in a similar way and described my deployment in another thread. This post describes things like graceful restarts, process management, and
git push to deploy.
Thank you @nathankerr I’ll take a look at it and let you know if I get troubles.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.