An open API service indexing awesome lists of open source software.

https://github.com/mungujn/weather-server

A weather app backend built using go, gRPC, Redis and docker
https://github.com/mungujn/weather-server

docker docker-compose go grpc grpc-go redis tls

Last synced: about 1 year ago
JSON representation

A weather app backend built using go, gRPC, Redis and docker

Awesome Lists containing this project

README

          

# Weather app backend

[![Build Status](https://travis-ci.com/mungujn/weather-server.svg?branch=master)](https://travis-ci.com/mungujn/weather-server)
[![Go Report Card](https://goreportcard.com/badge/github.com/mungujn/weather-server)](https://goreportcard.com/report/github.com/mungujn/weather-server)

Backend for a weather app. App consists of 3 services; an api, a database service and the core weather service.

## API Service

This service exposes an API endpoint that client apps access to retrieve information on the weather in a given location, at a particular time.

## Weather service

This service retrieves weather information from a provider. The server for this service is an RPC server, built using gRPC. It exposes one RPC service, 'GetWeather' for retrieving the weather. The GetWeather operation first uses an RPC client (that connects to the database RPC service) to read weather data cached in the database.
If the weather request is for a location not in the database, or if the weather data retrieved from the database is too old, the service fetches fresh data from a weather provider (still not yet determined), immediately returns this data to the API service and then uses a separate thread (goroutine) to cache the newly retrieved weather data by making a create RPC call to the database service

## Redis Database service

A slightly customised redis server. Based on the alpine redis image with a modified configuration file.

Communication between services is encrypted and secured with SSL/TLS.

Run

`docker-compose up`

to bring up all the services

Supply two SSL key file pairs; "wapi.crt", "wapi.key" and "weather.crt", "weather.key" in a docker volume (or bind mount like in my docker-compose.yml file)