Git Product home page Git Product logo

godorp's Introduction

GoDoRP

GoDoRP (Golang, Docker, React, Postgres) project starter.

Disclaimer: This project is not actively supported and not recommended for production apps. Hope it serves as a learning resource.

Features

  • Start a GoDoRP project with one command on any computer with docker-compose installed
  • Dev mode features hot reloading on code changes for both the GoLang backend and React frontend (no need to rebuild containers while coding)
  • Production mode features optimized static React frontend and binary goLang backend
  • Production images built by passing a single arg option (images can then run on any computer with Docker)

Benefits

  • Anyone can contribute to your project locally without having to setup/install GOPATH, Postgres, node etc
  • Dev environment is the same as production environment
  • Quickly get your GoDoRP project off the ground
  • Forking the repo allows for customization of the template for your preferences

Getting started:

  • download docker-compose if not already installed Then run the following commands:
$ mkdir myApp
$ cd myApp
$ git clone https://github.com/McMenemy/GoDoRP.git .
$ docker-compose up

Then you can open the React frontend at localhost:3000 and the RESTful GoLang API at localhost:5000

Changing any frontend (React) code locally will cause a hot-reload in the browser with updates and changing any backend (GoLang) code locally will also automatically update any changes.

Then to build production images run:

$ docker build ./api --build-arg app_env=production 
$ docker build ./frontend --build-arg app_env=production
$ docker build ./db

godorp's People

Contributors

atilkan avatar

Stargazers

samirtrootech avatar Bezmen Evgeny avatar Harsh Sharma avatar Marky avatar Prince avatar Akhil Sharma avatar Stone Sha avatar  avatar MS avatar Sorawong L. avatar Zalfrie Januardi avatar Adam Hollock avatar Yaroslav avatar woodrow avatar Satish avatar  avatar Bùi Đặng Bình avatar Dmitry Shipunov avatar Kriangsak Loisaeng avatar Wojciech Palacz avatar Sergey Karpenko avatar José Henrique da Luz avatar Bartosz Lenart avatar  avatar Fedir RYKHTIK avatar Benji Nguyen avatar Dennis Leszkowicz Fleron avatar ivan kondratiuk avatar Yago Ernandes avatar Josh Akeman avatar wshi avatar NoharaMasato avatar Aaron avatar Jared Baur avatar Sadi avatar Mostafa Gad avatar Vadim Arkadov avatar Omept Technology Ltd avatar Vlad Ilin avatar Yuji Takahashi avatar Turing Junkie avatar ismail simsek avatar William Duarte avatar fuubit avatar Ken Fletcher avatar Dave Brannigan avatar  avatar James Au avatar Dariusz Gierejkiewicz avatar Laney Smith avatar Matthew Nelson - Silverark avatar Milan Thapa avatar Izabela avatar SkarYxD avatar  avatar yuzujoe avatar Samir Prakash avatar Rahadian Arthapati avatar Timothy Yoseph avatar Kir Yusupov avatar vulcangz avatar keo avatar  avatar Qasim Soomro avatar 木头981 avatar digenaldo neto avatar VaraPrasad avatar Nikita Lyzhov avatar Nick White avatar Dmitriy.Arkhipov avatar  avatar Thiện avatar  avatar Josh Slate avatar nate pappenhagen avatar Stas Zhilin avatar v1rtl avatar amey avatar Alan Price avatar Philippe Boblet avatar Coleman Word avatar Prithvi Raju M avatar Jean Carlo Flores Carrasco avatar  avatar  avatar Pavel Myshev avatar Marc Cantwell avatar Atique Ansari (Bz) avatar Wessel van der Pal avatar RJ Deutschman avatar  avatar  avatar Dev avatar Sacha Arbonel avatar Justin Davidson avatar meission avatar Kenan Fallon avatar Orkhan ALIYEV avatar Sadik Ay avatar qskane avatar

Watchers

Josef Materi avatar James Cloos avatar Lucky Ong avatar Jason Holmberg avatar  avatar Johnny Pacheco avatar  avatar Ken Fletcher avatar

godorp's Issues

Provide support for goose and create-react-app

This is an extremely handy starter project. Thanks a lot.

I am filing this as an enhancement (not a bug). It will be nice if you can integrate create-react-app for the front-end and goose (or some such) database migration tool, on the api side.

Creating tables and databases should be done in a reliable, verifiable way to ensure that two instances of a API service may not run the same sql commands, etc.

build error: $ go build api.go:4:2: no Go files in /usr/local/go/src/database

build success in docker environment, but build failed outside docker.
the following is the steps build api outside docker:

DJdeMacBook-Pro:api dj$ go get ./vendor/database
go install: no install location for directory /Users/dj/WorkSpace/GitSpace/10_19/goDR_12_16/GoDoRP/api/vendor/database outside GOPATH
	For more details see: 'go help gopath'
DJdeMacBook-Pro:api dj$ go get .
api.go:4:2: no Go files in /usr/local/go/src/database
DJdeMacBook-Pro:api dj$ go build
api.go:4:2: no Go files in /usr/local/go/src/database
DJdeMacBook-Pro:api dj$ go version
go version go1.9.2 darwin/amd64
DJdeMacBook-Pro:api dj$ 
`DJdeMacBook-Pro:api dj$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/dj/WorkSpace/GitSpace/10_19/goDR_12_16/GoDoRP"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/dz/n0nt7d3924g6h5436gfc6xsc0000gn/T/go-build606782250=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
DJdeMacBook-Pro:api dj$ `

golang version is 1.9.2;

I guess this error is related with vendor fearture, but I don't know how to fix.

can you help me for this issue?

Trouble w/ hot reload

I'm having trouble getting the hot reload to work with the Go API. I ran the steps below:
https://github.com/McMenemy/GoDoRP#getting-started
After running docker-compose up I went to http://localhost:5000/ and saw the This is the RESTful api message. If I change that in the api.go file to anything else I don't see the change unless I rebuild the docker image (docker-compose build).
I can confirm from the output the api server is running in dev mode:

api_1       | 1:19:07 runner      | InitFolders
api_1       | 1:19:07 runner      | mkdir ./tmp
api_1       | 1:19:07 runner      | mkdir ./tmp: file exists
api_1       | 1:19:07 watcher     | Watching .
api_1       | 1:19:07 watcher     | Watching vendor
api_1       | 1:19:07 watcher     | Watching vendor/database
api_1       | 1:19:07 main        | Waiting (loop 1)...
api_1       | 1:19:07 main        | receiving first event /
api_1       | 1:19:07 main        | sleeping for 600 milliseconds
api_1       | 1:19:07 main        | flushing events
api_1       | 1:19:07 main        | Started! (11 Goroutines)
api_1       | 1:19:07 main        | remove tmp/runner-build-errors.log: no such file or directory
api_1       | 1:19:07 build       | Building...
api_1       | 1:19:08 runner      | Running...
api_1       | 1:19:08 main        | --------------------
api_1       | 1:19:08 main        | Waiting (loop 2)...
api_1       | 1:19:13 app         | 2018/01/05 01:19:13 connected to DB
api_1       | 2018/01/05 01:19:13 Running api server in dev mode

Am I doing something wrong?

Containers won't connect to the nerwork

I don't know how you (or I) did this but containers won't connect to the internet.

After cloning project and doing

docker-compose up --build

all I get is this for frontend:

npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/react failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-08-25T15_17_34_837Z-debug.log
ERROR: Service 'frontend' failed to build: The command '/bin/sh -c npm install' returned a non-zero code: 1

and this for api:

# git clone https://github.com/jinzhu/gorm /go/src/github.com/jinzhu/gorm
Cloning into '/go/src/github.com/jinzhu/gorm'...
fatal: unable to access 'https://github.com/jinzhu/gorm/': Could not resolve host: github.com
package github.com/jinzhu/gorm: exit status 128
ERROR: Service 'api' failed to build: The command '/bin/sh -c go get github.com/jinzhu/gorm' returned a non-zero code: 1

Setup:

docker version
Client:
Version: 1.13.1
API version: 1.26
Go version: go1.6.2
Git commit: 092cba3
Built: Thu Nov 2 20:40:23 2017
OS/Arch: linux/amd64

Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Go version: go1.6.2
Git commit: 092cba3
Built: Thu Nov 2 20:40:23 2017
OS/Arch: linux/amd64
Experimental: false

docker-compose version
docker-compose version 1.21.2, build a133471
docker-py version: 3.3.0
CPython version: 3.6.5
OpenSSL version: OpenSSL 1.0.1t 3 May 2016

FATAL: data directory "/pgdata" has wrong ownership

during startup, the following error is displayed, have you seen it?

db_1 | FATAL: data directory "/pgdata" has wrong ownership
db_1 | HINT: The server must be started by the user that owns the data directory.
godorp_db_1 exited with code 1

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.