Skip to content

kumparan/kumgo-stack

Repository files navigation

kumgo-stack

Kumparan Stack Framework for Go Lang

Project Structure

  1. buff - This folder is used to store the *.proto files and the compilation result.
  2. client - Client folder is used for other services clients.
  3. config - This folder used for the configuration setting.
  4. console - All the terminal commands goes here.
  5. deploy - Deployment scripts.
  6. {{YOUR_SERVICE}}svc - Your service handler.
  7. repository - Service model, query and logic.
  8. example - contain client example for tutorial purpose only. Remove when you use the boilerplate in your service.

Installing Go

MacOS

  1. You can follow the steps here
  2. Make sure you set your $GOPATH right. Check how to set your $GOPATH here

Some plugin will need to be installed in the $GOBIN. Default $GOBIN is $GOPATH/bin. It must be in your $PATH for the plugin to find it.

  1. Add this line in your .zshrc or .bash_profile
$ export PATH=$PATH:$GOPATH/bin
  1. Then reload the profile
$ source ~/.zshrc #if you are using zsh
$ source ~/.bash_profile #if you are using bash

Installing Protobuf Compiler

MacOS

  1. Download the appropriate release here
  2. Unzip the folder
  3. Enter the folder and run ./autogen.sh && ./configure && make ...If you run into this error: autoreconf: failed to run aclocal: No such file or directory, run brew install libtool && brew install autoconf && brew install automake. And run the command from step 3 again.
  4. Then run these other commands. They should run without issues
$ make check
$ sudo make install
$ which protoc
$ protoc --version
  1. Install the protoc plugin for go.
$ go get -u github.com/golang/protobuf/protoc-gen-go

Installing Dep (Go Dependency Manager)

You can follow the steps here

Story Service Example (with ArangoDB Connection)

Run the server in your local

  1. Make sure you already clone this repository in your $GOPATH/src folder.
  2. Install the dependencies by running dep ensure in your terminal.
  3. Compile the protobuf for the server example using make proto.
  4. Create a configuration file called config.yml in the root directory.
  5. You can copy the configuration in config.yml.example to your config.yml, or you also can change the config.
  6. Run the service using make run.
  7. You should see something like this:
INFO : Connection to Arango Server success...
INFO : Connection to database success...
INFO : Listening on 9001

Test the client

  1. With the server running, open new terminal.
  2. Type make story-client-example. This command will create a new gRPC client of the server run in port 9001. The client will send a GetStories request to the server, and get the response from the server.
  3. You should see something like this:
INFO : Echo result: [author:<group:"kumparan" id:"22251320" name:"Muhammad Iqbal" username:"mohamad-iqbal" > editor:<id:"22251320" name:"Mohamad Iqbal" username:"mohamad-iqbal" >  author:<id:"10512612" name:"Faisal Faisal" username:"faisal admin" >  author:<group:"kumparan" id:"33363617" name:"Jofie Yordan" username:"jofie-yordan" > editor:<id:"16871000" name:"Aditya Panji" username:"aditya-panji" >  author:<id:"21342092" name:"Faisal F" username:"faisal-f" >  author:<group:"kumparan" id:"36644670" name:"denny armandhanu" username:"denny-armandhanu" > editor:<id:"36644670" name:"Denny Armandhanu" username:"denny-armandhanu" >  author:<group:"kumparan" id:"15416990" name:"Rizki Sunaryo" username:"rizkisunaryo-1" > editor:<id:"54819011" name:"Joan Riffaldy" username:"joan-riffaldy" >  author:<group:"kumparan" id:"44607550" name:"angga sukmawijaya" username:"angga-sukmawijaya" > editor:<id:"44607550" name:"angga sukmawijaya" username:"angga-sukmawijaya" >  author:<id:"10048204" name:"Agung Surya Bangsa" username:"agung-surya" >  author:<group:"kumparan" id:"16871876" name:"Indra Subagja" username:"indra-subagja" > editor:<id:"22261855" name:"Salmah Muslimah" username:"salmah-muslimah" >  author:<id:"76853821" name:"Ganesha Dwi Adynugraha" username:"ganesha-dwi-adynugraha" > ]

Echo Example (without ArangoDB Connection)

Run the server in your local

  1. Make sure you already clone this repository in your $GOPATH/src folder.
  2. Install the dependencies by running dep ensure in your terminal.
  3. Compile the protobuf for the server example using make echo-example-proto.
  4. Run the service using make echo-server-example.
  5. You should see something like this:
INFO : Listening on 9001

Test the client

  1. With the server running, open new terminal.
  2. Type make echo-client-example. This command will create a new gRPC client of the server run in port 9001. The client will send a Echo request to the server, and get the response from the server.
  3. You should see something like this:
INFO : Echo result: i'm screaming

About

Kumparan Stack Framework for Go Lang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published