How to deploy a site

I have a Go site running in a server as http://localhost:8080. It is working in the server. I want to deploy that site and used it as a site. Currently if I am using the link as http://888.888.888.888:8080, it is not working. I know this is not the process, Can anyone please help me to work out the deployment process, how to implement and deploy my site in internet.

Thanks
Deepak

888.888.888.888 is not a valid IP address. But what exactly are you trying to do?

I imagine you do this:

  • You build an executable binary from Go code.
  • This code contains configuration that tells the program to listen on port 8080.
  • If you execute the binary on your local computer, you can access a HTTP interface on http://localhost:8080.

Now you want to execute the binary on a different computer, a server.

Do do this, you will have to find out the IP address or the host name of this server. When you know it, let’s call it example.com, you can access the HTTP interface of your program as http://example.com:8080.

Thanks for the reply. 888.888.888.888 represents my IP address, and that is running. Sorry to write in this way. Can you please help me more how to implement the 3 points that you have discussed. I am new in GO programming and I am trying to work out a site with the help of information in the net.
Once again thanks for your help.

Thanks
Deepak

Do you have a server you want to deploy this program on? What kind of server is it: Windows, Linux, AWS, …?

I don’t understand you when you write

What do you mean by that?

Yes exactly, I have a windows server. Work out a site a means to run my site as “http://example.com”.

Thanks
Deepak

If the computer you program on is Windows, too, you can just copy your executable to the server and execute it there.

I am sorry currently I do not know how to make executable. I am searching for it. Exactly my issue is like this:
I have worked out a GO site in my local machine. It is working fine there as “http://localhost:8080”. My local machine is also windows. Then I put that GO site from my local machine to my Windows server. There also it is working locally as “http://localhost:8080”. But I want to run that site as “http://example.com” from any where. I do not have much idea, how to implement this. I know I may be wrong in implementing the above process that I have tell you. So if you can help me in getting the correct way, I will be thankful to you.

Thanks
Deepak

To build an executable, just call

go build yourfile.go

Then you can execute yourfile.

Do you have a domain registered and a host name in that domain configured for your server?

Sorry, but your questions are so broad that it is very hard to help you. You must provide more information about you setup, what you have, what you want to do, what you have tried.

I think I was doing some thing wrong and so I was not able to tell you the exact problem. I already have used “go build yourfile.go” and I have "yourfile.exe"
I do not have a domain registered and a host name in that domain configured in my server.
I think I have to first work out this process and then I have to connect my “yourfile.exe” file with that domain and after that I can run my site as “http://example.com”, with the help of that domain and “yourfile.exe” file.

Thanks
Deepak

You only need a domain if you want to expose your program to the internet. If your server is on an internal network, you can just copy the executable to it, run it, and acces port 8080 in the internal name or IP address of the server.

If I not misunderstood, the OP wants to deploy his code to the public Internet and make it available for everyone around the world through a domain name.

In this case, you must follow some steps:

  1. Register a domain name, whatever you want on a domain registrar (like GoDaddy, Namecheap, Gandi, etc.)
  2. (Optionally) Buy a VPS server on your favourite provider like Amazon, Azure, Digital Ocean or whatever other which provides you with your favourite OS to deploy your application. A shared hosting provider is not enough, as they usually won’t allow custom software to be run directly.
  3. Upload your application to your freshly new VPS or to your local server and run it
  4. Now, your application should be available on http://1.1.1.1:8080, being “1.1.1.1” the public IP address assigned to your VPS by your provider or your public IP address if running locally.
  5. Finally, edit your DNS settings on your domain provider (step 1) and point the “A” record to that IP address. Wait for changes to propagate. This may take even 24h or more, but usually much less.

Hope this helps.

Hello deepak,
Can you please try below:
run “go install yourfile.go” to generate an exe file (yourfile.exe) under the directory bin
Then copy this yourfile.exe file to the server and double click it to run it.

You might want to have a look at the link:
https://golang.org/doc/code.html

Thanks for the reply. I am following the steps as per discussed by you. In case of any issue will discuss with you further.

Thanks
Deepak

Thanks for the reply. I have already generated the exe file. But my purpose is to run the application as a site, not only in the server.

Thanks
Deepak

This sentence makes no sense. Again: What do you mean by “run as a site”?

Currently I can run my site in server as http://localhost:8080, but I want to run my site as “http://example.com” from any where. Means if you want to run it from your machine it should run as “http://example.com”. “run as a site” refer to this scenario,

Thanks
Deepak

You can’t bind a name in a matter of seconds to a new ip, that’s not how the Internet works.

Either register a name and associate it with a public server or use a service like noip.me and have your name rebound to another ip in a couple of minutes.

You simply can’t run your server on a domain without having a domain. First of all get it one, also get a public ip address, next host the domain on your server (by the way in this case Windows is a bad choice, try using a Linux machine) and after your domain point your server run the go program. The go server is the last piece of your project.

I have been working a lot in C#, ASP.NET. Now I have started working in GO. My main question here is, as in ASP.NET, if we want to host a site in IIS, we just configure that site and give a domain name in IIS in our server and we can run that site easily in any machine. There is no need of domain name or domain registration. This works as a test site, before our real production site starts. Is there any thing similar to this process in GO. Can we use IIS in configuring a test site for GO. Hope some one will help me in clearing my doubts.

Thanks
Deepak

I hope this helps you: https://stackoverflow.com/questions/33916771/run-go-web-application-on-iis

But this is a lesson in programming from start of the thread to this message, having the proper problem scope will find you the appropriate solution, having an incorrect problem scope will find you an incorrect solution. Had you stated what you were working with explicitly from the beginning you would have found the responses more helpful.