Code Monkey home page Code Monkey logo

field-services's Introduction

Field Services Golang Server

Go gRPC Server for Purchasing and Mobile clients.

Table of Contents

Client Apps

Mobile client (Flutter): field-services-mobile

Purchasing client (ReactJS): field-services-purchasing

Getting Started

Use the following command in the root directory to start the docker containers.

docker-compose up -d

Running Go server without docker

  1. Stop all running containers with docker-compose down
  2. Open the .env file and change the SERVICE variable from grpcsvc to localhost on linux or host.docker.internal if using windows
  3. Comment out the entire grpcsvc in docker-compose.yml
  4. Restart docker containers with docker-compose up -d
  5. In the root directory run go run cmd/grpcsvc/main.go

Potential Errors

It may take a few seconds for the containers to start up. If you are getting errors, first try shutting down and restarting the containers

Error: Http response at 400 or 500 level
Issue connecting to Envoy, check envoy has not crashed

Error: upstream connect error or disconnect/reset before headers. reset reason: connection failure
Envoy cannot connect to outgoing service, check SERVICE environmental variable in .env file is correct

Error: no healthy upstream
Envoy OK, check Go service is running and has not crashed

Todo

  • Fix tests
  • More...

field-services's People

Contributors

longfellowone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

field-services's Issues

Potential import collision: import path should be "go.mongodb.org/mongo-driver", not "github.com/mongodb/mongo-go-driver"

Background

I find that go.mongodb.org/mongo-driver and github.com/mongodb/mongo-go-driver coexist in this repo:
https://github.com/longfellowone/field-services/blob/master/go.mod (Line 22 & 32)

github.com/mongodb/mongo-go-driver v1.0.1
go.mongodb.org/mongo-driver v1.0.1 // indirect

That’s because the mongodb/mongo-go-driver has already renamed it’s import path from "github.com/mongodb/mongo-go-driver" to "go.mongodb.org/mongo-driver". When you use the old path "github.com/mongodb/mongo-go-driver" to import the mongodb/mongo-go-driver, will reintroduces mongodb/mongo-go-driver through the import statements "import go.mongodb.org/mongo-driver" in the go source file of mongodb/mongo-go-driver.

https://github.com/mongodb/mongo-go-driver/blob/v1.0.1/mongo/client.go#L16

package mongo
import (
	"go.mongodb.org/mongo-driver/bson"
	"go.mongodb.org/mongo-driver/bson/bsoncodec"
	…
)

The "go.mongodb.org/mongo-driver" and "github.com/mongodb/mongo-go-driver" are the same repos. This will work in isolation, bring about potential risks and problems.

Solution

Follow the requirements of mongodb/mongo-go-driver README.md:

To get started with the driver, import the mongo package, create a mongo.Client:

import (
    "go.mongodb.org/mongo-driver/mongo"
    "go.mongodb.org/mongo-driver/mongo/options"
)
…

Replace all the old import paths, change "github.com/mongodb/mongo-go-driver" to "go.mongodb.org/mongo-driver".
Where did you import it: https://github.com/longfellowone/field-services/search?q=github.com%2Fmongodb%2Fmongo-go-driver&unscoped_q=github.com%2Fmongodb%2Fmongo-go-driver

How do you handle migrations / SQL schema?

This project is exactly what I've been looking for in terms of architecture, however I'm trying to find a way to generate my SQL schema through the use of structs or something similar to that.

Right now what I have is a single variable that contains all of my CREATE TABLE statements and it's somewhat ugly. I was wondering what do you use, as I can't seem to find anything similar to that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.