Skip to content

akosgarai/buffalo_example

Repository files navigation

Experimental CMS with Buffalo!

Build Status

CMS project. Administrator/content/user management tool. Experimental project.

Start project from scratch

How to install & start the application and it's dependencies.

Go - linux

From https://golang.org/doc/install

Download & install go

  • Download the go version from here. (You need at least 1.10.8)
  • Extract it into /usr/local (root or sudo)
tar -C /usr/local -xzf go1.11.2.linux-amd64.tar.gz
  • Add /usr/local/go/bin to the PATH environment variable. (you can paste it into your .bash_profile/.bashrc/.zshrc/etc... file & source it.)
export PATH=$PATH:/usr/local/go/bin
  • Try to run go version command to make sure, that the installation was successful.
$ go version
go version go1.11.2 linux/amd64

Setup GOPATH environment variable

From https://github.com/golang/go/wiki/SettingGOPATH Let's assume, that you have a go directory in your HOME folder, and you want to develop your gocode under that dir. Make sure that you have a bin and a src dir. under the go dir. Add the following lines in your bash/zsh rc/profile file, and then source it.

export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

Setup Dep dependency manager tool

From https://github.com/golang/dep

  • Install with apt-get
sudo apt-get install go-dep
  • Or install with script
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh

Buffalo

From https://gobuffalo.io/en/docs/installation

Frontend dependencies

Install buffalo

$ curl -OL https://github.com/gobuffalo/buffalo/releases/download/v0.14.2/buffalo_0.14.2_linux_amd64.tar.gz
$ tar -xvzf buffalo_0.14.2_linux_amd64.tar.gz
$ sudo mv buffalo /usr/local/bin/buffalo

Download this application

You have a bunch of options for getting an application from github. Due to the golang's dependencies, you have to make sure, that this application is donwloaded to the right place.

  • go get
$ go get github.com/akosgarai/buffalo_example
$ cd $GOPATH/src/github.com/akosgarai/buffalo_example
  • git clone
$ mkdir -p $GOPATH/src/github.com/akosgarai
$ cd $GOPATH/src/github.com/akosgarai
$ git clone git@github.com:akosgarai/buffalo_example.git

Setup postgres db

My buffalo example application uses postgres database, so that we need a working db server instance, that the app can use. From https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-16-04

  • Installation
$ sudo apt-get update
$ sudo apt-get install postgresql postgresql-contrib
  • DB management - switch to postgres user
$ sudo -i -u postgres
  • Starting psql app (postgres user)
$ psql

In psql shell, you are able to create users/databases, so that you can setup everything for your needs.

Setup buffalo_example application

Before the first start, you have to setup the database that contains the necessary tables, and the initial values (eg admins).

$ soda create -a
$ soda migrate up

Starting the Application

Buffalo ships with a command that will watch your application and automatically rebuild the Go binary and any assets for you. To do that run the "buffalo dev" command:

$ buffalo dev

If you point your browser to http://127.0.0.1:3000 you should be redirected to the http://127.0.0.1:3000/login page.

About the tests

Good to know

  • Use the built in tool: buffalo test
  • Don't be logged in to the database when you want to run the tests

Powered by Buffalo

About

playing with buffalo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published