letsgorip

module
v0.0.0-...-91b8838 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2022 License: BSD-3-Clause

README

Build Tests Go Report Card Stargazers Issues BSD 3-Clause License LinkedIn


Lets Go Rip

Lets Go Rip is an application hosting a community to help like minded motorsports enthusiasts, find places to ride/drive/drift/jump/race and people to go with.
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Example Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

This project is a work in progress that does not yet have a live demo that can be seen at https://www.letsgo.rip.

Lets Go Rip is a portfolio project. The project is written in Go(lang) and has microservices for Auth, Forums, Places and an HTTP API. I used this project to learn more about gRPC and Kubernetes. I use PostgreSQL for my data store and Angular for the front end. The app is currently running in a cluster on Google Kubernetes Engine (GKE).

The Journey

After finishing school and learning 4 languages in the process (C++, C#, Java, Python), I felt the need to pick a language and start a great portfolio project. Looking around a little in different communities and job postings, I decided to learn Go and build microservice's. I wanted to learn more about Kubernetes so I needed the services to be deployed in easily replicable containers for scaling and be ephemeral for easy CD. I also wanted to learn about gRPC because some article or click baity title somewhere, painted gRPC as a "Hot Topic", I also love learning so adding another concept to the list seemed like a good idea.

Challenges

First challenge was finding out what gRPC is and how it works. I found that gRPC is an RPC framework that uses protocol buffers to define how data is to be structured. You define your data structures as "Messages", because your data will be transmitted as a message. You define your service with RPC functions that use messages as parameters and return types. Once messages and services are defined, the protocol buffer compiler (protoc) can be used to generate code in the language of your choosing. The generate code defines service and client interfaces to be used to transmit the messages. The messages will be serialized into a compact binary format and transmitted.

OK, so I planned out my data structures and basic CRUD methods for services in .proto files and compiled them. Next challenge was implementing the services servers. This consisted of creating the data structures as models (so I can add gorm tags as I will be using gorm as my ORM), creating repository interfaces to utilize gorm for database storage and create a service structure that implements the protocol buffers NameServiceServer interface. The structure that implements the ServiceServer interface receives a repository, the service methods call the repository methods to interact with the data store. The service methods also convert the data into the protocol buffers data structures. Once the service methods are sorted out, all that's left is to create a grpc.NewServer(), register the service with the server and listen on my chosen port.

After my services were all set, I created an HTTP API that has separate handlers for each service, each handler implementing the given services NameServiceClient interface.

To be continued...

(back to top)

Built With

(back to top)

Getting Started

To run this application you will need to install the prerequisites and use the different Make targets.

Prerequisites

  • Go
  • Docker
  • MiniKube
  • Make

Usage

  1. Install Prerequisites
  2. Clone the repo
    git clone https://github.com/rs401/letsgorip.git
    
  3. Start MiniKube and set local docker repo
    minikube start
    eval $(minikube -p minikube docker-env)
    
  4. Build the container images
    make build-docker
    
  5. Start the kubernetes deployments and services
    make kube
    
  6. To stop the kubernetes deployments and services
    make kube-down
    

(back to top)

Roadmap

  • Complete Protocol Buffers Messages
  • Generate Protocol Buffers Go files
  • Complete API
    • Auth
      • Handlers
      • Routes
      • Implement JWT
      • Middleware
    • Forums
      • Forum handlers
      • Thread handlers
      • Post handlers
      • Routes
    • Places
      • Handlers
      • Routes
  • Build docker image from API
  • Build docker image from auth
  • Build docker image from forums
  • Build docker image from places
  • Build k8s configs with label selectors and environment variables for communication
  • Build k8s configs for services
  • Rebuild images for k8s
  • UI
    • Models
    • Auth components
    • Forum components
    • Thread components
    • Post components
    • Places components
      • Google maps
  • GKE
    • Setup cluster
    • Setup artifact registry
      • Push images to registry
    • Execute kubernetes configs
    • Setup letsgo.rip domain with GKE DNS
    • Setup ingress
    • Setup SSL certificates with GKE
    • Setup Persistent Volume for Postgres db
  • Add Google OAuth for identity

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

WANTED Code reviews: I am eager to be a better programmer.

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the BSD 3-Clause License. See LICENSE for more information.

(back to top)

Contact

LinkedIn

Project Link: https://github.com/rs401/letsgorip

(back to top)

Acknowledgments

(back to top)

Directories

Path Synopsis
api
Package api provides HTTP endpoints
Package api provides HTTP endpoints
handlers
Package handlers provides handlerfuncs
Package handlers provides handlerfuncs
middlewares
Package middlewares provides middlewares
Package middlewares provides middlewares
routes
Package routes provides utility to setup routes
Package routes provides utility to setup routes
tokenutils
Package tokenutils provides utilities for JWTs
Package tokenutils provides utilities for JWTs
Package auth provides authentication/user API
Package auth provides authentication/user API
models
Package models provides the data models for the auth service
Package models provides the data models for the auth service
repository
Package repository provides methods for interacting with the data store.
Package repository provides methods for interacting with the data store.
service
Package service implements the pb AuthServiceServer
Package service implements the pb AuthServiceServer
Package db provides access to the database.
Package db provides access to the database.
Package forums provides forums API
Package forums provides forums API
models
Package models provides the data models for the forum service.
Package models provides the data models for the forum service.
repository
Package repository provides methods for interacting with the data store.
Package repository provides methods for interacting with the data store.
service
Package service implements the pb ForumServiceServer
Package service implements the pb ForumServiceServer
Package places provides the Places API
Package places provides the Places API
models
Package models provides places data models.
Package models provides places data models.
repository
Package repository provides methods for interacting with the data store.
Package repository provides methods for interacting with the data store.
service
Package service implements the pb PlaceServiceServer
Package service implements the pb PlaceServiceServer
Package validation provides methods to validate the various models for this project.
Package validation provides methods to validate the various models for this project.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL