-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathMakefile
72 lines (59 loc) · 2.24 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
GIT_VERSION := $(shell git describe --abbrev=8 --dirty --always --tags)
GIT_COMMIT := $(shell git rev-parse --short HEAD)
BUILD_TIME := $(shell date +%s)
CONTAINER_ID := $(shell docker ps | grep publishers | grep web | awk '{print $$1}')
EYESHADE_CONTAINER_ID := $(shell docker ps | grep eyeshade | grep web | awk '{print $$1}')
EMAIL=
default: certs build reload-db all
certs:
bin/ssl-gen
build:
docker-compose build
all:
docker-compose up
admin:
if [ -z $(EMAIL) ]; then\
echo "No email passed to command";\
else\
docker exec -it $(CONTAINER_ID) rake create_admin_user["$(EMAIL)"];\
fi\
docker-shell:
docker exec -it $(CONTAINER_ID) bash
reload-db:
docker-compose run web sh -c 'rake db:reset; rake db:fixtures:load; RAILS_ENV=test rake db:reset'
eyeshade-integration:
@if [ -z $(EYESHADE_CONTAINER_ID) ]; then\
echo "ERROR: Eyeshade container not detected running in docker context. Please clone 'bat-ledgers' and run 'make'";\
else\
echo "INFO Running eyeshade migrations";\
docker exec -it $(EYESHADE_CONTAINER_ID) ./bin/migrate-up.sh\
echo "INFO Loading eyeshade balances";\
docker-compose -f docker-compose.yml -f docker-compose.eyeshade.yml up;\
fi
eyeshade-balances:
# This attaches to a running container rather than creating an intermediate one
docker exec -it $(CONTAINER_ID) rails eyeshade:create_channel_balances
#### Everything from here needs review. These commands may be in use or may simply be convenience methods.
ci:
bundle install
yarn
bundle exec bundle-audit update
RAILS_ENV=test bundle exec rails test
bundle exec brakeman
bundle exec standardrb
docker:
docker build --build-arg COMMIT=$(GIT_COMMIT) --build-arg VERSION=$(GIT_VERSION) \
--build-arg BUILD_TIME=$(BUILD_TIME) -t publishers:latest .
docker tag publishers:latest publishers:$(GIT_VERSION)
docker-test:
docker-compose up --detach postgres web
docker-compose run -e "RAILS_ENV=test" web sh -c "./scripts/entrypoint.sh && rails test && yarn test"
docker-compose down
k8:
kubectl delete -f web-deployment.yaml
kubectl delete services publishers
kubectl apply -f web-deployment.yaml
kubectl rollout status deployment.v1.apps/publishers
kubectl expose deployment publishers --type=NodePort --port=3000
kubectl get pods
minikube service publishers --url