[Deployment: docker-compose.yml | registry (website) | registry (api)]
Backstory: The current version of the website uses Jekyll and a submission portal that pushes to Git. However, on our new setup, none of the services should have push access to GitHub, and anyway it is better to move to a proper CMS so that we can add additional sections to the website without Jekyll hackery. Hence, due to my obsession with Go and APIs, here we are.
The AppVenture website is a Go webapp that generates pages out of static templates and JSON data obtained from the API. It also serves the static files in the assets folder.
api.go
: A thin wrapper to perform requests to the APIrouter.go
: Each request path (example: /about) is defined here and a handler inhandlers.go
is calledhandlers.go
: Each page is "handled" (API request and rendering) as defined herehelpers.go
: Functions used in templatestemplatemanager.go
: Templating engine manager, loads and provides functions for each templatemain.go
: Glue to bind the layers together and provide a commandline interface
The stylesheets are written in Sass's SCSS format and complied into a single stylesheet using Grunt. JavaScript is written plain using prototype syntax.
In the api folder is where the resources the API provides are defined. It uses Ponzu to automatically generate an API from the types defined in the content folder.
It also exposes an admin interface at the path /admin/
Requirements:
- Go
- Node.js
- Ponzu (
go get github.com/ponzu-cms/ponzu/...
)
ORG=$(go env GOPATH)/src/github.com/appventure-nush
mkdir -p $ORG
git clone [email protected]:appventure-nush/appventure-website.git $ORG/appventure-website
cd $ORG/appventure-website
# build CSS
yarn && yarn grunt
# format CSS and HTML
yarn fmt
# build and run website
go get && go build && ./appventure-website -debug
# build and run API
cd api && ponzu build && ponzu run --port 8081
When greeted by the init page in Ponzu (http://localhost:8081/admin/init), configure the following:
- Site Name: AppVenture
- Domain: localhost
- Admin Details:
- Email: [email protected]
- Password: any test password