In this post, we’re going to host a simple static website without so much pain. Using Go as a server script but fear not, you don’t have to learn Go in this post since this post focus on the most simplest and reliable way to host static website.
Have you heard of Google App Engine ?
- Upgrade to paid service if required.
- Can add server’s features using Go later.
- Free to use custom domain.
- Not easy enough if you’re not a developer or a geek.
- Familiar with command-line interface. (If you’re not, google it)
- Some knowledge about website.
- 15-30 mins of your times at most.
Getting Start: Prepare your simple website
Download and install go_appengine_sdk on your own machine, by follow this Link
You can play with your HTML all you want from this point on. Just add structure like this and copy script from below to server.go and app.yaml .
Up to this point, you must be able to run “goapp” command (details).
Try “goapp serve” command at website’s root directory and check your result at http://localhost:8080
Deploy to Google App Engine
- Go to https://cloud.google.com/, Sign-in or Sign-up then get to your console.
- Create New Project (If it’s your first time here, they will prompt you to create new project immediately.)}
- After Successfully created your project, Save your Project-ID and put it in app.yaml
- In your website’s root directory, Run “goapp deploy” and input your Google credential to deploy your website.
- Your website will now be running at “project-id.appspot.com” , check it out.
- Custom domain can be set using this details
Maintenance and update
Can be easily done using “goapp” command by
- goapp serve: test website in development (No need to restart server, automatically change when files are changed.)
- goapp deploy: deploy to GAE