mirror of https://github.com/statping/statping
building
parent
02ab91b55c
commit
f06ca9ef18
|
@ -25,4 +25,9 @@ source/dist
|
||||||
frontend/dist
|
frontend/dist
|
||||||
Dockerfile
|
Dockerfile
|
||||||
Dockerfile.base
|
Dockerfile.base
|
||||||
|
!dev/dev-env.sh
|
||||||
|
!dev/modd.conf
|
||||||
|
!dev/grafana
|
||||||
|
!dev/prometheus.yml
|
||||||
docker
|
docker
|
||||||
|
statping.db
|
||||||
|
|
|
@ -9,36 +9,25 @@ RUN curl -L -s https://assets.statping.com/sass -o /usr/local/bin/sass && \
|
||||||
|
|
||||||
WORKDIR /go/src/github.com/hunterlong/statping
|
WORKDIR /go/src/github.com/hunterlong/statping
|
||||||
|
|
||||||
ADD go.mod go.sum version.txt ./
|
ADD go.mod go.sum ./
|
||||||
|
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
RUN go get github.com/stretchr/testify/assert && \
|
ENV GO111MODULE on
|
||||||
go get golang.org/x/tools/cmd/cover && \
|
|
||||||
go get github.com/mattn/goveralls && \
|
RUN go get github.com/stretchr/testify/... && \
|
||||||
go install github.com/mattn/goveralls && \
|
|
||||||
go get github.com/rendon/testcli && \
|
|
||||||
go get github.com/robertkrimen/godocdown/godocdown && \
|
|
||||||
go get github.com/crazy-max/xgo && \
|
|
||||||
go get github.com/GeertJohan/go.rice && \
|
|
||||||
go get github.com/GeertJohan/go.rice/rice && \
|
go get github.com/GeertJohan/go.rice/rice && \
|
||||||
go get github.com/axw/gocov/gocov && \
|
go get github.com/cortesi/modd/cmd/modd
|
||||||
go get github.com/matm/gocov-html && \
|
|
||||||
go get github.com/fatih/structs && \
|
|
||||||
go get github.com/ararog/timeago && \
|
|
||||||
go get gopkg.in/natefinch/lumberjack.v2 && \
|
|
||||||
go get golang.org/x/crypto/bcrypt
|
|
||||||
|
|
||||||
ADD frontend/package.json frontend/yarn.lock ./frontend/
|
ADD frontend/package.json frontend/yarn.lock ./frontend/
|
||||||
|
|
||||||
RUN cd frontend && yarn install --pure-lockfile --network-timeout 1000000 && \
|
RUN cd frontend && yarn install --pure-lockfile --network-timeout 1000000 && \
|
||||||
yarn cache clean
|
yarn cache clean
|
||||||
|
|
||||||
ADD . ./
|
COPY . ./
|
||||||
|
|
||||||
RUN make clean frontend-build compile
|
RUN make clean frontend-build compile
|
||||||
RUN make build
|
RUN make build
|
||||||
RUN chmod a+x statping && mv statping /go/bin/statping
|
RUN chmod a+x statping && mv statping /go/bin/statping
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -19,7 +19,9 @@ down:
|
||||||
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml down --volumes --remove-orphans
|
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml down --volumes --remove-orphans
|
||||||
|
|
||||||
lite: clean
|
lite: clean
|
||||||
docker-compose -f dev/docker-compose.lite.yml up -d --remove-orphans
|
docker build -t hunterlong/statping:dev -f dev/Dockerfile.dev .
|
||||||
|
docker-compose -f dev/docker-compose.lite.yml down
|
||||||
|
docker-compose -f dev/docker-compose.lite.yml up --remove-orphans
|
||||||
|
|
||||||
reup: down clean compose-build-full up
|
reup: down clean compose-build-full up
|
||||||
|
|
||||||
|
|
|
@ -13,35 +13,24 @@ ADD go.mod go.sum version.txt ./
|
||||||
|
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
RUN go get github.com/stretchr/testify/assert && \
|
RUN go get github.com/stretchr/testify/... && \
|
||||||
go get golang.org/x/tools/cmd/cover && \
|
|
||||||
go get github.com/mattn/goveralls && \
|
|
||||||
go install github.com/mattn/goveralls && \
|
|
||||||
go get github.com/rendon/testcli && \
|
|
||||||
go get github.com/robertkrimen/godocdown/godocdown && \
|
|
||||||
go get github.com/crazy-max/xgo && \
|
|
||||||
go get github.com/GeertJohan/go.rice && \
|
|
||||||
go get github.com/GeertJohan/go.rice/rice && \
|
go get github.com/GeertJohan/go.rice/rice && \
|
||||||
go get github.com/axw/gocov/gocov && \
|
go get github.com/cortesi/modd/cmd/modd
|
||||||
go get github.com/matm/gocov-html && \
|
|
||||||
go get github.com/fatih/structs && \
|
|
||||||
go get github.com/ararog/timeago && \
|
|
||||||
go get gopkg.in/natefinch/lumberjack.v2 && \
|
|
||||||
go get golang.org/x/crypto/bcrypt && \
|
|
||||||
go get github.com/cortesi/devd/cmd/devd && \
|
|
||||||
env GO111MODULE=on go get github.com/cortesi/modd/cmd/modd
|
|
||||||
|
|
||||||
ADD frontend/package.json frontend/yarn.lock ./frontend/
|
ADD frontend/package.json frontend/yarn.lock ./frontend/
|
||||||
|
|
||||||
RUN cd frontend && yarn install --pure-lockfile --network-timeout 1000000 && \
|
RUN cd frontend && yarn install --pure-lockfile --network-timeout 1000000 && yarn cache clean
|
||||||
yarn cache clean
|
|
||||||
|
|
||||||
ENV IS_DOCKER=true
|
ENV IS_DOCKER=true
|
||||||
ENV STATPING_DIR=/go/src/github.com/hunterlong/statping
|
ENV STATPING_DIR=/go/src/github.com/hunterlong/statping
|
||||||
ENV PORT=8585
|
|
||||||
EXPOSE 8585
|
EXPOSE 8585
|
||||||
EXPOSE 8888
|
EXPOSE 8888
|
||||||
|
|
||||||
VOLUME /go/src/github.com/hunterlong/statping
|
RUN cd frontend && yarn build && cp -R dist ../source/
|
||||||
|
|
||||||
CMD /go/src/github.com/hunterlong/statping/dev/dev-env.sh
|
RUN pwd && ls
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
CMD dev/dev-env.sh
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
modd -f ./dev/modd.conf
|
echo "Starting!"
|
||||||
|
|
||||||
devd -w ./src http://localhost:8585
|
echo "Serving Vue frontend first..."
|
||||||
|
|
||||||
|
cd frontend && yarn serve &
|
||||||
|
|
||||||
|
echo "Now serving Vue, lets build the golang backend now..."
|
||||||
|
|
||||||
|
modd -f dev/modd.conf
|
||||||
|
|
|
@ -0,0 +1,116 @@
|
||||||
|
version: '2.3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
container_name: postgres
|
||||||
|
image: postgres
|
||||||
|
volumes:
|
||||||
|
- ./docker/databases/postgres:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
POSTGRES_PASSWORD: password123
|
||||||
|
POSTGRES_DB: statping
|
||||||
|
POSTGRES_USER: root
|
||||||
|
networks:
|
||||||
|
- statping
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U root"]
|
||||||
|
interval: 15s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 20
|
||||||
|
|
||||||
|
mysql:
|
||||||
|
container_name: mysql
|
||||||
|
image: mysql:5.7
|
||||||
|
volumes:
|
||||||
|
- ./docker/databases/mysql:/var/lib/mysql
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: password123
|
||||||
|
MYSQL_DATABASE: statping
|
||||||
|
MYSQL_USER: root
|
||||||
|
MYSQL_PASSWORD: password
|
||||||
|
networks:
|
||||||
|
- statping
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
||||||
|
timeout: 20s
|
||||||
|
interval: 15s
|
||||||
|
retries: 30
|
||||||
|
|
||||||
|
phpmyadmin:
|
||||||
|
container_name: phpmyadmin
|
||||||
|
image: phpmyadmin/phpmyadmin
|
||||||
|
restart: on-failure
|
||||||
|
depends_on:
|
||||||
|
mysql:
|
||||||
|
condition: service_healthy
|
||||||
|
ports:
|
||||||
|
- 5050:80
|
||||||
|
links:
|
||||||
|
- mysql:db
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: password123
|
||||||
|
PMA_HOST: mysql
|
||||||
|
PMA_USER: root
|
||||||
|
PMA_PASSWORD: password123
|
||||||
|
PMA_PORT: 3306
|
||||||
|
networks:
|
||||||
|
- statping
|
||||||
|
|
||||||
|
sqlite-web:
|
||||||
|
container_name: sqlite-web
|
||||||
|
image: coleifer/sqlite-web
|
||||||
|
restart: on-failure
|
||||||
|
command: sqlite_web -H 0.0.0.0 -r -x /data/statping.db
|
||||||
|
depends_on:
|
||||||
|
statping:
|
||||||
|
condition: service_healthy
|
||||||
|
ports:
|
||||||
|
- 6050:8080
|
||||||
|
links:
|
||||||
|
- statping
|
||||||
|
volumes:
|
||||||
|
- ./docker/statping/sqlite/statping.db:/data/statping.db:ro
|
||||||
|
environment:
|
||||||
|
SQLITE_DATABASE: /data/statping.db
|
||||||
|
networks:
|
||||||
|
- statping
|
||||||
|
|
||||||
|
pgadmin4:
|
||||||
|
container_name: pgadmin4
|
||||||
|
image: fenglc/pgadmin4
|
||||||
|
restart: on-failure
|
||||||
|
environment:
|
||||||
|
DEFAULT_USER: admin@admin.com
|
||||||
|
DEFAULT_PASSWORD: admin
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
ports:
|
||||||
|
- 7000:5050
|
||||||
|
links:
|
||||||
|
- postgres:postgres
|
||||||
|
networks:
|
||||||
|
- statping
|
||||||
|
|
||||||
|
prometheus:
|
||||||
|
container_name: prometheus
|
||||||
|
image: prom/prometheus:v2.0.0
|
||||||
|
restart: on-failure
|
||||||
|
volumes:
|
||||||
|
- ./dev/prometheus.yml:/etc/prometheus/prometheus.yml
|
||||||
|
- ./docker/databases/prometheus:/prometheus
|
||||||
|
links:
|
||||||
|
- statping
|
||||||
|
- statping_mysql
|
||||||
|
- statping_postgres
|
||||||
|
- statping_dev
|
||||||
|
ports:
|
||||||
|
- 7050:9090
|
||||||
|
networks:
|
||||||
|
- statping
|
||||||
|
healthcheck:
|
||||||
|
test: "/bin/wget -q -Y off http://localhost:9090/status -O /dev/null > /dev/null 2>&1"
|
||||||
|
interval: 10s
|
||||||
|
timeout: 3s
|
|
@ -6,7 +6,7 @@ services:
|
||||||
container_name: statping_dev
|
container_name: statping_dev
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.dev
|
dockerfile: ./dev/Dockerfile.dev
|
||||||
args:
|
args:
|
||||||
VERSION: DEV
|
VERSION: DEV
|
||||||
COMMIT: DEV
|
COMMIT: DEV
|
||||||
|
@ -14,6 +14,7 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/go/src/github.com/hunterlong/statping
|
- ./:/go/src/github.com/hunterlong/statping
|
||||||
environment:
|
environment:
|
||||||
|
GO_ENV: test
|
||||||
DB_CONN: sqlite
|
DB_CONN: sqlite
|
||||||
API_KEY: exampleapikey
|
API_KEY: exampleapikey
|
||||||
API_SECRET: exampleapisecret
|
API_SECRET: exampleapisecret
|
||||||
|
@ -29,10 +30,10 @@ services:
|
||||||
networks:
|
networks:
|
||||||
- statping
|
- statping
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "curl -f http://localhost:8080/health || false"]
|
test: ["CMD-SHELL", "curl -f http://localhost:8585/health || false"]
|
||||||
timeout: 2s
|
timeout: 2s
|
||||||
interval: 5s
|
interval: 20s
|
||||||
retries: 10
|
retries: 30
|
||||||
|
|
||||||
statping:
|
statping:
|
||||||
container_name: statping
|
container_name: statping
|
||||||
|
@ -57,8 +58,8 @@ services:
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "curl -f http://localhost:8080/health || false"]
|
test: ["CMD-SHELL", "curl -f http://localhost:8080/health || false"]
|
||||||
timeout: 2s
|
timeout: 2s
|
||||||
interval: 5s
|
interval: 10s
|
||||||
retries: 10
|
retries: 20
|
||||||
|
|
||||||
statping_mysql:
|
statping_mysql:
|
||||||
container_name: statping_mysql
|
container_name: statping_mysql
|
||||||
|
@ -93,8 +94,8 @@ services:
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "curl -f http://localhost:8080/health || false"]
|
test: ["CMD-SHELL", "curl -f http://localhost:8080/health || false"]
|
||||||
timeout: 2s
|
timeout: 2s
|
||||||
interval: 5s
|
interval: 10s
|
||||||
retries: 10
|
retries: 20
|
||||||
|
|
||||||
statping_postgres:
|
statping_postgres:
|
||||||
container_name: statping_postgres
|
container_name: statping_postgres
|
||||||
|
@ -128,9 +129,9 @@ services:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "curl -f http://localhost:8080/health || false"]
|
test: ["CMD-SHELL", "curl -f http://localhost:8080/health || false"]
|
||||||
timeout: 2s
|
timeout: 5s
|
||||||
interval: 5s
|
interval: 5s
|
||||||
retries: 10
|
retries: 30
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
container_name: postgres
|
container_name: postgres
|
||||||
|
@ -146,8 +147,8 @@ services:
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U root"]
|
test: ["CMD-SHELL", "pg_isready -U root"]
|
||||||
interval: 15s
|
interval: 15s
|
||||||
timeout: 5s
|
timeout: 10s
|
||||||
retries: 5
|
retries: 20
|
||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
container_name: mysql
|
container_name: mysql
|
||||||
|
@ -166,7 +167,7 @@ services:
|
||||||
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
||||||
timeout: 20s
|
timeout: 20s
|
||||||
interval: 15s
|
interval: 15s
|
||||||
retries: 10
|
retries: 30
|
||||||
|
|
||||||
phpmyadmin:
|
phpmyadmin:
|
||||||
container_name: phpmyadmin
|
container_name: phpmyadmin
|
||||||
|
@ -268,7 +269,7 @@ services:
|
||||||
- statping
|
- statping
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: "/usr/bin/wget -q -Y off http://localhost:3000/api/health -O /dev/null > /dev/null 2>&1"
|
test: "/usr/bin/wget -q -Y off http://localhost:3000/api/health -O /dev/null > /dev/null 2>&1"
|
||||||
interval: 5s
|
interval: 10s
|
||||||
retries: 20
|
retries: 20
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
|
|
|
@ -4,15 +4,19 @@ services:
|
||||||
|
|
||||||
statping_dev:
|
statping_dev:
|
||||||
container_name: statping_dev
|
container_name: statping_dev
|
||||||
build:
|
image: hunterlong/statping:dev
|
||||||
context: ./
|
|
||||||
dockerfile: Dockerfile.dev
|
|
||||||
args:
|
|
||||||
VERSION: DEV
|
|
||||||
COMMIT: DEV
|
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
volumes:
|
volumes:
|
||||||
- .:/go/src/github.com/hunterlong/statping:ro
|
- ./cmd:/go/src/github.com/hunterlong/statping/cmd/
|
||||||
|
- ./core:/go/src/github.com/hunterlong/statping/core/
|
||||||
|
- ./database:/go/src/github.com/hunterlong/statping/database/
|
||||||
|
- ./dev:/go/src/github.com/hunterlong/statping/dev/
|
||||||
|
- ./frontend:/go/src/github.com/hunterlong/statping/frontend/
|
||||||
|
- ./handlers:/go/src/github.com/hunterlong/statping/handlers/
|
||||||
|
- ./notifiers:/go/src/github.com/hunterlong/statping/notifiers/
|
||||||
|
- ./source:/go/src/github.com/hunterlong/statping/source/
|
||||||
|
- ./types:/go/src/github.com/hunterlong/statping/types/
|
||||||
|
- ./utils:/go/src/github.com/hunterlong/statping/utils/
|
||||||
environment:
|
environment:
|
||||||
DB_CONN: sqlite
|
DB_CONN: sqlite
|
||||||
API_KEY: exampleapikey
|
API_KEY: exampleapikey
|
||||||
|
|
|
@ -25,4 +25,4 @@ scrape_configs:
|
||||||
scrape_interval: 15s
|
scrape_interval: 15s
|
||||||
bearer_token: 'exampleapisecret'
|
bearer_token: 'exampleapisecret'
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: ['statping_dev:8080']
|
- targets: ['statping_dev:8585']
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
"@babel/preset-env": "~7.8.3",
|
"@babel/preset-env": "~7.8.3",
|
||||||
"@vue/babel-preset-app": "^4.1.2",
|
"@vue/babel-preset-app": "^4.1.2",
|
||||||
"@vue/cli-plugin-babel": "^4.1.0",
|
"@vue/cli-plugin-babel": "^4.1.0",
|
||||||
|
"@vue/cli-service": "^4.2.3",
|
||||||
"@vue/test-utils": "^1.0.0-beta.31",
|
"@vue/test-utils": "^1.0.0-beta.31",
|
||||||
"babel-eslint": "~10.0",
|
"babel-eslint": "~10.0",
|
||||||
"babel-loader": "~8.0",
|
"babel-loader": "~8.0",
|
||||||
|
|
1252
frontend/yarn.lock
1252
frontend/yarn.lock
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue