User Tools

Site Tools


buffalo

gobuffalo Pi 4b

Install

wget https://github.com/gobuffalo/buffalo/releases/download/v0.15.5/buffalo_0.15.5_Linux_armv7.tar.gz
tar xfvz buffalo_0.15.5_Linux_armv7.tar.gz # extract binary
sudo mv buffalo /usr/local/bin/ # Move binary to make it available as global command

Add following code to /home/pi/.bashrc

/home/pi/.bashrc
export GOPATH="$HOME/go"
export PATH="$PATH:$GOPATH/bin"

Populate new exports source ~/.bashrc

PostgreSQL

Install:

sudo apt install postgresql

Set password (buffalo uses postgres/postgres by default):

sudo -u postgres psql # Login without password
postgres=# \password postgres # Sets the password for user postgres
sudo service postgresql restart
psql -U postgres -h 127.0.0.1 # Test login, should show password prompt

Create databases

buffalo db create -a

Generate CRUD

buffalo g resource device name description:text gpio:integer room:integer

Run migrations:

buffalo db migrate

Undo single migration

buffalo db migrate down 20200229202131

Apply migration

buffalo db migrate up 20200229202131

Set ENV Vars

Add to .env file in your project folder:

ADDR=192.168.178.100

SQL Migration

 buffalo db generate sql switch_type
buffalo.txt · Last modified: 2020/03/02 21:55 by admin