Giter Club home page Giter Club logo

go-autoreload-example's People

Contributors

mikemadisonweb avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

go-autoreload-example's Issues

Error while bringing up the go application "changes are not synced and port is not matching with the server file code"

Directory structure
test
|-app
|--app_settings
|---log_wrapper.go
|--root
|---entrypoint.sh
|--Dockerfile
|--main.go
|-.env
|-docker-compose.yaml

Dockerfile looks like :-

FROM golang:1.9-alpine
COPY ./root /
COPY ./app_settings/ /go/src/app_settings/
RUN apk add --no-cache ca-certificates \
        dpkg \
        gcc \
        git \
        musl-dev \
        bash

ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH

RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" \
    && chmod -R 777 "$GOPATH" \
    && chmod +x /entrypoint.sh

# RUN go get github.com/tockins/realize #<---placing this code giving me the error ERROR: Service 'app' #failed to build: The command '/bin/sh -c go install -v ./...' returned a non-zero code: 1
RUN go get -d -v ./...

RUN go install -v ./...
RUN go get github.com/tockins/realize #works fine here but when i output realize.yaml which is #created in root directory gives me output mentioned below (which is same as your common app)
WORKDIR $GOPATH
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 8080
CMD ["realize", "start"]

docker-compose.yaml

version: '3'
services:
  app:
    container_name: "app"
    build: "./app/"
    volumes:
      - ".:${GO_PROJECT_DIR}"
    ports:
      - "8080:8080"
    environment:
      GO_WORK_DIR: "${GO_PROJECT_DIR}/app"

main.go



import (
	l "app_settings/log_wrapper"
	"fmt"
	"io/ioutil"
	"os"

	"github.com/qiangxue/fasthttp-routing"
	"github.com/valyala/fasthttp"
)

func main() {

	l.Init(ioutil.Discard, os.Stdout, os.Stdout, os.Stderr)

	l.Trace.Println("I have something standard to say")
	l.Info.Println("Special Information")
	l.Warning.Println("There is something you need to know about")
	l.Error.Println("Something has failed")

	router := routing.New()

	router.Get("/", func(c *routing.Context) error {
		fmt.Fprintf(c, "UP, and running with golang app!")
		l.Info.Println("fasthttp, Hello, Go!")
		return nil
	})

	panic(fasthttp.ListenAndServe(":8080", router.HandleRequest))
}

entrypoint.sh

#!/usr/bin/env bash
GO_WORK_DIR=${GO_WORK_DIR:-$GOPATH/src}
cd ${GO_WORK_DIR}
cd root && ls -a && exec "$@"

.realize.yaml output

app    |   legacy:
app    |     force: false
app    |     interval: 0s
app    | server:
app    |   status: false
app    |   open: false
app    |   port: 5002
app    |   host: localhost
app    | schema:
app    | - name: app
app    |   path: .
app    |   commands:
app    |     run:
app    |       status: true
app    |   watcher:
app    |     paths:
app    |     - /
app    |     - ./../common
app    |     extensions:
app    |     - go
app    |     - html
app    |     - css
app    |     - js
app    |     - yaml

output of the above code base
[22:33:04][ROOT] : Watching 0 file/s 1 folder/s
but the changes made in main.go is not reflected, furthermore there seems to be some issue with the post as well.
I am still a newbie with go, try to bring up my own go test app. Any help would be appreciated. thanks!

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.