Upload And Deploy Golang Application To VPS - Stack Overflow

    1. Home
    2. Questions
    3. Tags
    4. Users
    5. Companies
    6. Labs
    7. Jobs
    8. Discussions
    9. Collectives
    10. Communities for your favorite technologies. Explore all Collectives

  1. Teams

    Ask questions, find answers and collaborate at work with Stack Overflow for Teams.

    Try Teams for free Explore Teams
  2. Teams
  3. Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Get early access and see previews of new features.

Learn more about Labs Upload and Deploy Golang application to VPS Ask Question Asked 9 years, 11 months ago Modified 8 years, 3 months ago Viewed 7k times 2

I've made a Go app and when I run the exe locally it works fine. Where would I upload this to on my VPS? public_html/domain.com/somefolder ? or /usr/somefolder with SSH?

I have my app, my .exe and src-files, but what do I do with it when I deploy online on my VPS? I haven't been able to find a tutorial about this, so I hope you can help me.

  1. do I upload all files in my src folder including the binaries from when I've written "go build"?
  2. upload to where on my VPS? using ssh or cpanel / ftp program or what?

What are the steps from "go build" on your own local windows 8 computer to uploading and running it online on a linux server?

Ps.

Additionally will CentOS 5.1.1 although not supported https://golang.org/doc/install - allow for me to run an already linux compiled go program on my VPS, and does it only mean that I cannot install Go and do compilation on the CentOS 5.x server? Would CentOS 5.1.1 explain the "segmentation fault" error shh gives me when running the command "./[filename]"?

Share Improve this question Follow edited Dec 17, 2014 at 16:03 Dac0d3r asked Dec 17, 2014 at 4:35 Dac0d3r's user avatar Dac0d3rDac0d3r 1,8547 gold badges46 silver badges87 bronze badges 4
  • have you seen this ? : stackoverflow.com/questions/17440415/… – Omie Commented Dec 17, 2014 at 13:30
  • Compiling Go on the server like he proposes is not an option for me, since my VPS is running CentOS 5.1.1 - But I still should be able to say "./[filename]" right? Right now I'm just getting "Segmentation fault" response from ssh. – Dac0d3r Commented Dec 17, 2014 at 16:00
  • that is quite unfortunate. what is the purpose of this deployment ? learning ? production use ? If you want your app up on some server some how for learning/testing etc purpose then look at Heroku. You'd get it up for free. For production purposes, really out of luck, could give this a try ? dave.cheney.net/2013/06/18/how-to-install-go-1-1-on-centos-5 – Omie Commented Dec 17, 2014 at 16:32
  • But I don't need it installed on the VPS. I just need to be able to run the program there. I would be fine with compiling on my local computer. Does "unsupported" in this regard not refer to compiling and installing go? Or is it (as i fear) that go programs will not even run on these "unsupported" OS'es? :-o – Dac0d3r Commented Dec 18, 2014 at 7:30
Add a comment |

2 Answers 2

Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 1

Well, usually, you would:

  • Copy the binary you created + all resource files (html, css, images, ...)
    • (optionally the source code as well)
  • Have a way to ensure the program keeps running
    • crontab can be used to check if your program is alive, but a simple monitoring program would suffice as well (which you can write yourself)
  • Run the binary as a non-privileged user
    • (you can also combine it with something like Docker if you want)

It does not make sense to put it inside public_html/domain.com/somefolder, as it is not public html code. You'd want your files somewhere they cannot be accessed unless using the application/binary you created.

My apologies for not having neat source links to my story. However, this does seem like the best thing to do.

Another important note: Even though your VPS may run Windows, you can also deploy linux binaries to a Linux VPS (which are drastically cheaper) - looking at this SO question.

Share Improve this answer Follow edited May 23, 2017 at 10:28 Community's user avatar CommunityBot 11 silver badge answered Dec 17, 2014 at 9:40 Etienne Bruines's user avatar Etienne BruinesEtienne Bruines 3,0283 gold badges20 silver badges25 bronze badges 6
  • Thank you for your answer - I do have a few questions more though. On this url link it says Go doesn't support CentOS 5.x - I have CentOS 5.1.1 on my VPS. I get the following error message when I try (som shh - using putty on windows) to run the linux compiled file: "Segmentation fault" - is that because CentOS 5.x that I cannot run my compiled Go app? – Dac0d3r Commented Dec 17, 2014 at 11:27
  • Segmentation fault is tricky. You can set up a virtual system with another Linux distro (i.e. Debian, Ubuntu, CoreOS) and see if it runs there. That way you can localize the issue causing the segfault. It's not supported, but that doesn't mean it will never work. There's no guarantee however. – Etienne Bruines Commented Dec 17, 2014 at 21:54
  • I've been given the choice to pay $25 and get CentOS 6 installed. Do you think this is worth asking them to do? Do you think that might work? To put this short: I just need this to work, I'm willing to pay for someones help at this point. Where/who do I turn to for help? My hosting company doesnt' know about Go.. :( What would you do? Buy a new 2nd VPS? – Dac0d3r Commented Dec 18, 2014 at 7:32
  • 1 Well, first of all you need to know if CentOS is the problem. Download virtualbox, create two basic images: one with Debian, one with CentOS 6. Test your binaries on both. If it works on Debian, but not on CentOS - then getting a 2nd VPS (or replacing the 1st) would do the trick. If it doesn't work on Debian either, then CentOS is not the problem and getting a 2nd VPS wouldn't make sense. – Etienne Bruines Commented Dec 18, 2014 at 8:01
  • 1 I tried in CentOS 7 in VirtualBox - that worked fine, so I guess it was the old kernel of CentOS 5 that was the problem. :-) – Dac0d3r Commented Dec 19, 2014 at 1:58
| Show 1 more comment 0

A short note I wrote on writing golang app on osx and deploying on Linux server: http://kumargaurav.co/2016/08/10/deploy-go-lang-app-linux-server/

Share Improve this answer Follow answered Aug 13, 2016 at 1:31 kgthegreat's user avatar kgthegreatkgthegreat 1,32210 silver badges10 bronze badges Add a comment |

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid …

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

Draft saved Draft discarded

Sign up or log in

Sign up using Google Sign up using Email and Password Submit

Post as a guest

Name Email

Required, but never shown

Post Your Answer Discard

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.

  • The Overflow Blog
  • We'll Be In Touch - A New Podcast From Stack Overflow!
  • The app that fights for your data privacy rights
  • Featured on Meta
  • More network sites to see advertising test
  • We’re (finally!) going to the cloud!
  • Call for testers for an early access release of a Stack Overflow extension...

Linked

125 Golang production web application configuration 54 How to cross compile from Windows to Linux? 30 Deploying Go web applications with Apache 125 Golang production web application configuration 9 Deploying Go App 4 Automated go app deployment 6 Deploy and build my go app on my server 0 Deploy Go/Golang REST Web API on production 0 Deploying multiple Go applications using Nginx 1 Golang how to deploy a website to hosting 1 Deployment strategy for golang app, how to run golang app on production 3 How to deploy a go web application

Hot Network Questions

  • Dantzig-Wolfe Decomposition for nurse Scheduling problem
  • What if someone comits murder when they are younger but weren't caught till they got a mental disease like dementia?
  • What is the correct article before "/s/ sound"?
  • NginX Permission denied
  • Why would you not issue orders to a facility?
  • Stable points in GIT: geometric picture
  • Are "Albergue de peregrinos" typically restricted to pilgrims?
  • Scandinavian film, 1980s, possibly called Royal Toilet?
  • Strange Brackets in String Writing
  • endless looping in minimax
  • How to draw this matrix with stairs and submatrices?
  • Is every automorphism of a cone diagonalisable?
  • How to stop Apple Sports live activities watch notifications?
  • Does the canonical distribution assign probability to microstates or macrostates?
  • Why is there an erroneus Hebrew text, about the completed works on the seventh day?
  • Conditionally making environment content disappear
  • Commencement and repeal dates in UK Acts of Parliament - meaning of "From and after"
  • Can a contradiction exist in the antecedent of a sequent?
  • User temp folder is 103GB. Is it safe to delete?
  • Gifting $10k to my 17 year old nephew
  • Why「记」for shop names?
  • Are periodic functions such as sine and cosine defined on surreal numbers?
  • Why the second C in "recyceln" is pronounced [k] instead of [ts]?
  • Solana Playground - Mainnet-Beta
more hot questions Question feed Subscribe to RSS Question feed

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

lang-golang

Từ khóa » Vps Golang