-
-
Notifications
You must be signed in to change notification settings - Fork 494
feat: added seenode recipe for go #3338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| --- | ||
| title: Seenode | ||
| keywords: [seenode, deploy, cloud] | ||
| description: Deploying to Seenode cloud platform. | ||
| --- | ||
|
|
||
| # Seenode Deployment Example | ||
|
|
||
| [](https://github.com/gofiber/recipes/tree/master/seenode) [](https://stackblitz.com/github/gofiber/recipes/tree/master/seenode) | ||
|
|
||
| This project demonstrates how to deploy a Go application using the Fiber framework on Seenode. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Ensure you have the following installed: | ||
|
|
||
| - Golang | ||
| - [Fiber](https://github.com/gofiber/fiber) package | ||
| - [Seenode account](https://cloud.seenode.com) | ||
|
|
||
| ## Setup | ||
|
|
||
| 1. Clone the repository: | ||
| ```sh | ||
| git clone https://github.com/gofiber/recipes.git | ||
| cd recipes/seenode | ||
| ``` | ||
|
|
||
| 2. Install dependencies: | ||
| ```sh | ||
| go get | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ``` | ||
|
|
||
| 3. Create a Seenode account and connect your repository: | ||
| - Go to [Seenode Dashboard](https://cloud.seenode.com) | ||
| - Create a new Web Service | ||
| - Connect your Git repository | ||
|
|
||
| 4. Configure deployment: | ||
| - **Build Command**: `go build -o app main.go` | ||
| - **Start Command**: `./app` | ||
|
|
||
| 5. Deploy the application: | ||
| ```sh | ||
| git add . | ||
| git commit -m "Deploy to Seenode" | ||
| git push | ||
| ``` | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## Running the Application | ||
|
|
||
| 1. Open the application in your browser using the provided Seenode URL. | ||
|
|
||
| ## Example | ||
|
|
||
| Here is an example `main.go` file for the Fiber application: | ||
|
|
||
| ```go | ||
| package main | ||
| import ( | ||
| "fmt" | ||
| "os" | ||
| "github.com/gofiber/fiber/v2" | ||
| ) | ||
| func main() { | ||
| app := fiber.New() | ||
| app.Get("/", func(c *fiber.Ctx) error { | ||
| return c.SendString("Hello, Welcome to seenode 👋") | ||
| }) | ||
| port := os.Getenv("PORT") | ||
| if port == "" { | ||
| port = "80" | ||
| } | ||
| app.Listen(fmt.Sprintf(":%s", port)) | ||
| } | ||
| ``` | ||
| ## References | ||
| - [Fiber Documentation](https://docs.gofiber.io) | ||
| - [Seenode Documentation](https://seenode.com/docs/frameworks/go/fiber/) | ||
| - [Seenode Dashboard](https://cloud.seenode.com) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| module seenode-example | ||
|
|
||
| go 1.23 | ||
|
|
||
| require github.com/gofiber/fiber/v2 v2.52.9 | ||
|
|
||
| require ( | ||
| github.com/andybalholm/brotli v1.1.0 // indirect | ||
| github.com/google/uuid v1.6.0 // indirect | ||
| github.com/klauspost/compress v1.17.9 // indirect | ||
| github.com/mattn/go-colorable v0.1.13 // indirect | ||
| github.com/mattn/go-isatty v0.0.20 // indirect | ||
| github.com/mattn/go-runewidth v0.0.16 // indirect | ||
| github.com/rivo/uniseg v0.2.0 // indirect | ||
| github.com/valyala/bytebufferpool v1.0.0 // indirect | ||
| github.com/valyala/fasthttp v1.51.0 // indirect | ||
| github.com/valyala/tcplisten v1.0.0 // indirect | ||
| golang.org/x/sys v0.28.0 // indirect | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= | ||
| github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= | ||
| github.com/gofiber/fiber/v2 v2.52.9 h1:YjKl5DOiyP3j0mO61u3NTmK7or8GzzWzCFzkboyP5cw= | ||
| github.com/gofiber/fiber/v2 v2.52.9/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw= | ||
| github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= | ||
| github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= | ||
| github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= | ||
| github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= | ||
| github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= | ||
| github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= | ||
| github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= | ||
| github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= | ||
| github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= | ||
| github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= | ||
| github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= | ||
| github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= | ||
| github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= | ||
| github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= | ||
| github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= | ||
| github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA= | ||
| github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g= | ||
| github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= | ||
| github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= | ||
| golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||
| golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||
| golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= | ||
| golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "os" | ||
| "github.com/gofiber/fiber/v2" | ||
| ) | ||
|
|
||
| func main() { | ||
| app := fiber.New() | ||
|
|
||
| app.Get("/", func(c *fiber.Ctx) error { | ||
| return c.SendString("Hello, Welcome to seenode 👋") | ||
| }) | ||
|
|
||
| port := os.Getenv("PORT") | ||
| if port == "" { | ||
| port = "80" | ||
| } | ||
|
|
||
| app.Listen(fmt.Sprintf(":%s", port)) | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
Comment on lines
1
to
25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good start for the example application. I have a couple of suggestions to make it more robust and align with common Go practices:
Here's an updated version of the file that incorporates these changes. Please also update the code example in package main
import (
"fmt"
"log"
"os"
"github.com/gofiber/fiber/v2"
)
func main() {
app := fiber.New()
app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("Hello, Welcome to seenode 👋")
})
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
if err := app.Listen(fmt.Sprintf(":%s", port)); err != nil {
log.Fatalf("failed to start server: %v", err)
}
} |
||
Uh oh!
There was an error while loading. Please reload this page.