statping/Makefile

109 lines
5.7 KiB
Makefile
Raw Normal View History

2018-11-29 02:03:41 +00:00
VERSION=$(shell cat version.txt)
2018-12-04 10:13:08 +00:00
SIGN_KEY=B76D61FAA6DB759466E83D9964B9C6AAE2D55278
2018-12-04 04:17:29 +00:00
BINARY_NAME=statping
2019-12-29 21:52:19 +00:00
GOBUILD=go build -a
2020-02-27 10:04:27 +00:00
GOVERSION=1.13.5
2019-12-29 21:52:19 +00:00
XGO=xgo -go $(GOVERSION) --dest=build
2018-11-29 02:03:41 +00:00
BUILDVERSION=-ldflags "-X main.VERSION=${VERSION} -X main.COMMIT=$(TRAVIS_COMMIT)"
2020-01-08 03:44:26 +00:00
TRVIS_SECRET=lRqWSt5BoekFK6+padJF+b77YkGdispPXEUKNuD7/Hxb7yJMoI8T/n8xZrTHtCZPdjtpy7wIlJCezNoYEZB3l2GnD6Y1QEZEXF7MIxP7hwsB/uSc5/lgdGW0ZLvTBfv6lwI/GjQIklPBW/4xcKJtj4s1YBP7xvqyIb/lDN7TiOqAKF4gqRVVfsxvlkm7j4TiPCXtz17hYQfU8kKBbd+vd3PuZgdWqs//5RwKk3Ld8QR8zoo9xXQVC5NthiyVbHznzczBsHy2cRZZoWxyi7eJM1HrDw8Jn/ivJONIHNv3RgFVn2rAoKu1X8F6FyuvPO0D2hWC62mdO/e0kt4X0mn9/6xlLSKwrHir67UgNVQe3tvlH0xNKh+yNZqR5x9t0V54vNks6Pgbhas5EfLHoWn5cF4kbJzqkXeHjt1msrsqpA3HKbmtwwjJr4Slotfiu22mAhqLSOV+xWV+IxrcNnrEq/Pa+JAzU12Uyxs8swaLJGPRAlWnJwzL9HK5aOpN0sGTuSEsTwj0WxeMMRx25YEq3+LZOgwOy3fvezmeDnKuBZa6MVCoMMpx1CRxMqAOlTGZXHjj+ZPmqDUUBpzAsFSzIdVRgcnDlLy7YRiz3tVWa1G5S07l/VcBN7ZgvCwOWZ0QgOH0MxkoDfhrfoMhNO6MBFDTRKCEl4TroPEhcInmXU8=
2018-12-19 19:07:05 +00:00
PUBLISH_BODY='{ "request": { "branch": "master", "message": "Homebrew update version v${VERSION}", "config": { "env": { "VERSION": "${VERSION}", "COMMIT": "$(TRAVIS_COMMIT)" } } } }'
2020-01-08 03:44:26 +00:00
TRAVIS_BUILD_CMD='{ "request": { "branch": "master", "message": "Compile master for Statping v${VERSION}", "config": { "os": [ "linux" ], "language": "go", "go": [ "${GOVERSION}" ], "go_import_path": "github.com/hunterlong/statping", "install": true, "sudo": "required", "services": [ "docker" ], "env": { "VERSION": "${VERSION}", "secure": "${TRVIS_SECRET}" }, "matrix": { "allow_failures": [ { "go": "master" } ], "fast_finish": true }, "before_deploy": [ "git config --local user.name \"hunterlong\"", "git config --local user.email \"info@socialeck.com\"", "git tag v$(VERSION) --force"], "deploy": [ { "provider": "releases", "api_key": "$$TAG_TOKEN", "file_glob": true, "file": "build/*", "skip_cleanup": true, "on": {"branch": "master"} } ], "notifications": { "email": false }, "before_script": ["gem install sass"], "script": [ "travis_wait 30 docker pull crazymax/xgo:$(GOVERSION)", "make release" ], "after_success": [], "after_deploy": [ "make publish-homebrew" ] } } }'
2018-12-04 04:17:29 +00:00
TEST_DIR=$(GOPATH)/src/github.com/hunterlong/statping
2019-12-29 21:52:19 +00:00
PATH:=/usr/local/bin:$(GOPATH)/bin:$(PATH)
2018-08-15 08:08:50 +00:00
2020-02-28 06:37:48 +00:00
up:
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml up -d --remove-orphans
make print_details
2020-02-27 10:04:27 +00:00
down:
2020-02-28 06:37:48 +00:00
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml down --volumes --remove-orphans
reup: down clean compose-build-full up
start:
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml start
stop:
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml stop
2020-01-15 04:58:22 +00:00
2020-02-27 10:04:27 +00:00
logs:
docker logs statping --follow
2018-12-04 19:13:24 +00:00
2020-02-27 10:04:27 +00:00
console:
docker exec -t -i statping /bin/sh
2018-08-17 16:13:20 +00:00
2020-02-28 06:37:48 +00:00
compose-build-full: docker-base
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml build --parallel --build-arg VERSION=${VERSION}
2020-02-27 10:04:27 +00:00
docker-base:
docker build -t hunterlong/statping:base -f Dockerfile.base --build-arg VERSION=${VERSION} .
2020-02-27 10:04:27 +00:00
docker-latest: docker-base
docker build -t hunterlong/statping:latest --build-arg VERSION=${VERSION} .
2018-10-08 21:15:01 +00:00
2020-02-27 10:04:27 +00:00
docker-vue:
docker build -t hunterlong/statping:vue --build-arg VERSION=${VERSION} .
2020-02-27 10:04:27 +00:00
top:
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml top
2019-12-18 11:36:29 +00:00
2020-02-27 10:04:27 +00:00
frontend-build:
cd frontend && rm -rf dist && yarn build
rm -rf source/dist && cp -r frontend/dist source/ && cp -r frontend/src/assets/scss source/dist/
cp -r source/tmpl/*.* source/dist/
2019-12-18 11:36:29 +00:00
# compile assets using SASS and Rice. compiles scss -> css, and run rice embed-go
2020-02-27 10:04:27 +00:00
compile: generate
2019-12-18 11:36:29 +00:00
cd source && rice embed-go
2018-08-14 04:13:06 +00:00
2020-02-27 10:04:27 +00:00
build:
$(GOBUILD) $(BUILDVERSION) -o $(BINARY_NAME) ./cmd
2018-08-14 05:10:51 +00:00
2020-02-27 10:04:27 +00:00
install:
mv $(BINARY_NAME) $(GOPATH)/bin/$(BINARY_NAME)
2018-08-14 04:13:06 +00:00
2020-02-27 10:04:27 +00:00
generate:
cd source && go generate
cd handlers/graphql && go generate
2018-08-14 04:13:06 +00:00
# remove files for a clean compile/build
2018-08-14 04:13:06 +00:00
clean:
2019-12-29 21:06:12 +00:00
rm -rf ./{logs,assets,plugins,*.db,config.yml,.sass-cache,config.yml,statping,build,.sass-cache,index.html,vendor}
rm -rf cmd/{logs,assets,plugins,*.db,config.yml,.sass-cache,*.log,*.html,*.json}
rm -rf core/{logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
rm -rf handlers/{logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
rm -rf notifiers/{logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
rm -rf source/{logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
rm -rf types/{logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
rm -rf utils/{logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
rm -rf dev/{logs,assets,plugins,*.db,config.yml,.sass-cache,*.log,test/app,plugin/*.so}
2018-11-29 04:47:35 +00:00
rm -rf {parts,prime,snap,stage}
2018-08-19 08:48:02 +00:00
rm -rf dev/test/cypress/videos
2018-08-25 16:10:28 +00:00
rm -f coverage.* sass
2018-11-07 09:28:46 +00:00
rm -f source/rice-box.go
rm -rf **/*.db-journal
2018-11-29 04:47:35 +00:00
rm -rf *.snap
find . -name "*.out" -type f -delete
find . -name "*.cpu" -type f -delete
find . -name "*.mem" -type f -delete
2020-02-27 10:04:27 +00:00
rm -rf {build,tmp,docker}
2018-08-17 01:43:12 +00:00
2020-02-28 06:37:48 +00:00
print_details:
@echo \==== Statping Development Instance ====
@echo \Statping Vue Frontend: http://localhost:8888
@echo \Statping Backend API: http://localhost:8585
@echo \==== Statping Instances ====
@echo \Statping SQLite: http://localhost:4000
@echo \Statping MySQL: http://localhost:4005
@echo \Statping Postgres: http://localhost:4010
@echo \==== Databases ====
@echo \PHPMyAdmin: http://localhost:6000 \(MySQL database management\)
@echo \SQLite Web: http://localhost:6050 \(SQLite database management\)
@echo \PGAdmin: http://localhost:7000 \(Postgres database management \| email: admin@admin.com password: admin\)
@echo \Prometheus: http://localhost:7050 \(Prometheus Web UI\)
@echo \==== Monitoring and IDE ====
@echo \Grafana: http://localhost:3000 \(username: admin, password: admin\)
.PHONY: all build build-all build-alpine test-all test test-api docker frontend up down print_details
2019-12-29 21:01:53 +00:00
.SILENT: travis_s3_creds