Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

abilia/gobeer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gobeer

Server for flutterbeer

Running (soon) at https://innovation-242008.appspot.com/

Setup

Prerequisits

Development

Check out the code

Suggested IDE: vscode

Create database

CREATE USER gobeeruser WITH PASSWORD 'thisisthepassword';
CREATE DATABASE beerdb OWNER gobeeruser;

Create table(s)

CREATE TABLE users (id BIGSERIAL PRIMARY KEY, username TEXT);
CREATE TABLE tastings (id BIGSERIAL PRIMARY KEY, name TEXT);
CREATE TABLE beers (id BIGSERIAL PRIMARY KEY, name TEXT, tastingID int);
CREATE TABLE coronabeers (id BIGSERIAL PRIMARY KEY, name TEXT, drinker TEXT, points INTEGER, created_at TIMESTAMP NOT NULL DEFAULT NOW());

Install dependencies

go get github.com/gorilla/mux
go get github.com/lib/pq
go get github.com/google/uuid

Run locally

> go build
> ./gobeer

Deploy to beer.abilia-gbg.se

  • Stop service sudo service gobeer stop
  • Copy ./gobeer to /build/beer/gobeer
  • Start service sudo service gobeer start

Todo on beer.abilia-gbg.se

  • Setup database

docker run -p 5454:5432 --name gobeer -e POSTGRES_PASSWORD=secret -dt postgres

  • Create systemd service
[Unit]
Description=gobeer
After=docker.service

[Service]
Type=simple
Restart=on-failure
RestartSec=5
ExecStart=/build/beer/gobeer

[Install]
WantedBy=multi-user.target
  • Create nginx configuration
server {
    listen 80;
    server_name beer.abilia-gbg.se;

    root /build/beer;

    error_log /build/error.beer.log;
    access_log /build/access.beer.log;

    location / {
        proxy_pass http://127.0.0.1:8000;
    }
}
  • Use cert for beer.abilia-gbg.se

Deploy to google app engine

Google App Engine at Abilia innovation project

  • Connect GO Google App Engine with GloudSQL
  • Setup proxy for development

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published