如何部署Iris(Go Web框架)项目?

I'm very new to the Golang as well as iris (Go web framework). Right now I'm play with them and trying to understand whether they fit my needs. As I understand, after we completed a iris project, what we have is a bunch of .go files. Then we compile them and get one executable. How should we deploy this output? Simply put it at some where in the file system and run it (probably as a service on Windows or background job in Linux)? Is it that simple?

Go allows very simple deployment with a standalone binary you can push to all servers without worrying about available libraries:

  1. Compile your code for the targeted operating system
  2. Push the executable to your server
  3. Run it with whatever you want : service, supervisord...

A good read: Go in production.

depends on yours root project it's a bit different to build. i prefer to configure my project so

AppName

  • Models
  • Services
    • service1
    • service2
  • Helpers
  • Controllers
  • Web
    • Views
    • Assets
    • Locals
    • main.go

for that go to the root directory , in windows for development you should execute

go run web\main.go

for production when the project complied

Set GOOS=linux //(if your server is linux)
go build web\main.go

after it you will see a binary file when you put the file on the server in linux it's better to define a services for the binary file to execute on start up and restart on any error.