Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ninnemana/goengine
Boilerplate for Go uses Sinatra style routing with some features from HTML5-Boilerplate along with Twitter Bootstrap 2.3.2
https://github.com/ninnemana/goengine
Last synced: 21 days ago
JSON representation
Boilerplate for Go uses Sinatra style routing with some features from HTML5-Boilerplate along with Twitter Bootstrap 2.3.2
- Host: GitHub
- URL: https://github.com/ninnemana/goengine
- Owner: ninnemana
- Created: 2012-07-07T19:01:06.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-07-10T20:15:50.000Z (over 11 years ago)
- Last Synced: 2024-04-14T09:27:29.367Z (8 months ago)
- Language: Go
- Homepage: http://ninnemana.github.com/goengine
- Size: 5.21 MB
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GoEngine Boilerplate [![Build Status](https://travis-ci.org/ninnemana/goengine.png?branch=non-appengine)](https://travis-ci.org/ninnemana/goengine)
GoEngine Boilerplate is combination of serveral different repositories, some made for Go some not.
The project is built using with Sinatra style routing and MySQL support. HTML Structure and design using h5bp(http://html5boilerplate.com) and Twitter Bootstrap(http://twitter.github.com/bootstrap). Javascript templating is done with mustache.js, but has not been baked into requireJS. The javascript component incorporates RequireJS for dependency management.
**IMPORTANT**: If you **__are__** using Google AppEngine, use the [_gae_](https://github.com/ninnemana/goengine/tree/gae) branch.
Deploying
-----------You can deploy this app manually or using Capistrano. If you choose to use Capistrano, here's an example to prompt for populating the ConnectionString so you can keep it out of your public repo for testing purposes:
```ruby
default_run_options[:pty] = true
ssh_options[:forward_agent] = trueset :application, "ApplicationName"
set :appname, "application-name"
set :repository, "[email protected]:youraccount/yourrepo.git"set :scm, :git
set :scm_passphrase, ""
set :user, "linuxuser"role :web, "server1.address.com", "server2.address.com"
role :app, "server1.address.com", "server2.address.com"set :deploy_to, "/home/#{user}/#{application}"
set :deploy_via, :remote_cacheset :use_sudo, false
set :sudo_prompt, ""
set :normalize_asset_timestamps, falseafter :deploy, "deploy:goget", "db:configure", "deploy:compile", "deploy:stop", "deploy:restart"
namespace :db do
desc "set database Connection String"
task :configure do
set(:database_username) { Capistrano::CLI.ui.ask("Database Username:") }
set(:database_password) { Capistrano::CLI.password_prompt("Database Password:") }db_config = <<-EOF
package databaseconst (
db_proto = "tcp"
db_addr = "databaseaddress:3306"
db_user = "#{database_username}"
db_pass = "#{database_password}"
db_name = "databasename"
)
EOF
run "mkdir -p #{deploy_to}/current/helpers/database"
put db_config, "#{deploy_to}/current/helpers/database/ConnectionString.go"
end
end
namespace :deploy do
task :goget do
run "/usr/local/go/bin/go get github.com/ziutek/mymysql/native"
run "/usr/local/go/bin/go get github.com/ziutek/mymysql/mysql"
end
task :compile do
run "GOOS=linux GOARCH=amd64 CGO_ENABLED=0 /usr/local/go/bin/go build -o #{deploy_to}/current/#{appname} #{deploy_to}/current/index.go"
end
task :start do ; end
task :stop do
kill_processes_matching "#{appname}"
end
task :restart do
restart_cmd = "#{current_release}/#{appname} -http=127.0.0.1:8080 -path=#{deploy_to}/current/"
run "nohup sh -c '#{restart_cmd} &' > nohup.out"
end
enddef kill_processes_matching(name)
run "ps -ef | grep #{name} | grep -v grep | awk '{print $2}' | sudo xargs kill -2 || echo 'no process with name #{name} found'"
end```
Depending on the server you're on, you may need to define the path of the application as a flag in the deployment script or when running manually on the server. The reason for that is the server may have issues pathing the static files in the project. The example in the script above should help get the deployment working properly with the right static file paths.
Mustache.js
-----------mustache.js has been converted to use [[ ]] as delimiters so it can play nice with golang's html/template package.
Contributors
-----------**Alex Ninneman**
+ http://twitter.com/ninnemana
+ http://github.com/ninnemana**Jessica Janiuk**
+ http://twitter.com/janiukjf
+ http://github.com/janiukjf