File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 - master
77jobs :
88 build :
9- runs-on : ubuntu-latest
9+ runs-on : ubuntu-18.04
1010
1111 services :
1212 db :
Original file line number Diff line number Diff line change 77jobs :
88 build :
99 if : github.repository == 'hexlet-codebattle/codebattle'
10- runs-on : ubuntu-latest
10+ runs-on : ubuntu-18.04
1111
1212 services :
1313 db :
@@ -98,14 +98,22 @@ jobs:
9898 file : ./services/app/cover/excoveralls.json
9999 fail_ci_if_error : true
100100
101- - name : Pull dockers
102- run : mix dockers.pull
103- working-directory : ./services/app
104- env :
105- MIX_ENV : test
101+ - run : make release
106102
107- - name : Run code checkers tests
108- run : make test-code-checkers
109- env :
110- MIX_ENV : test
103+ - name : Login to Docker Hub
104+ run : echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
105+
106+ - run : docker-build-app
107+ - run : docker-push-app
108+
109+ # - name: Pull dockers
110+ # run: mix dockers.pull
111+ # working-directory: ./services/app
112+ # env:
113+ # MIX_ENV: test
114+
115+ # - name: Run code checkers tests
116+ # run: make test-code-checkers
117+ # env:
118+ # MIX_ENV: test
111119
Original file line number Diff line number Diff line change @@ -30,3 +30,12 @@ ansible-edit-secrets:
3030
3131ansible-vault-edit-production :
3232 docker run -v $(CURDIR ) :/app -it -w /app williamyeh/ansible:ubuntu18.04 ansible-vault edit --vault-password-file tmp/ansible-vault-password ansible/production/group_vars/all/vault.yml
33+
34+ release :
35+ make -C services/app release
36+
37+ docker-build-app :
38+ docker build --cache-from=codebattle/app --tag codebattle/app --file services/app/Dockerfile.rel services/app
39+
40+ docker-push-app :
41+ docker push codebattle/app:latest
Original file line number Diff line number Diff line change @@ -2,28 +2,33 @@ PWD:=$(shell pwd)
22
33kb-% : export KUBECONFIG=$(PWD ) /kubeconfig.yml
44helm-% : export KUBECONFIG=$(PWD ) /kubeconfig.yml
5+ kb-app-% : POD_NAME = $(shell kubectl get pod -l "app.kubernetes.io/instance=app" -o name --kubeconfig=$(KUBECONFIG ) )
56
67kb-get-pods :
78 kubectl get pod -w -o wide
89
910kb-get-nodes :
1011 kubectl get nodes
1112
12- helm-init :
13- helm install --name app $(PWD ) /app-chart
13+ helm-init : helm-add-repos helm-install-ingress helm-install-app helm-install-keel
14+
15+ helm-add-repos :
16+ helm repo add stable https://kubernetes-charts.storage.googleapis.com
17+ helm repo add keel https://charts.keel.sh
18+
19+ helm-install-app :
20+ helm install app $(PWD ) /app-chart
1421
1522helm-upgrade-app :
1623 helm upgrade app $(PWD ) /app-chart
1724
1825helm-install-ingress :
19- helm install stable/nginx-ingress --name ingress --set rbac.create=true
26+ helm repo update
27+ helm install ingress stable/nginx-ingress
2028
2129helm-install-keel :
22- helm repo add keel https://charts.keel.sh
2330 helm repo update
24- helm upgrade --install keel --namespace keel keel/keel
25-
26- kb-app-% : POD_NAME = $(shell kubectl get pod -l "app.kubernetes.io/instance=app" -o name --kubeconfig=$(KUBECONFIG ) )
31+ helm upgrade --install keel --namespace=kube-system keel/keel
2732
2833kb-app-tailf :
2934 kubectl logs -f $(POD_NAME ) -c app
Original file line number Diff line number Diff line change 8080 env :
8181 - name : CODEBATTLE_VERSION
8282 value : {{ .Values.version }}
83+ - name : CODEBATTLE_PORT
84+ value : " 4000"
8385 - name : DEPLOYED_AT
8486 value : " {{ now }}"
Original file line number Diff line number Diff line change 1- _build
21deps
32node_modules
43priv /static
Original file line number Diff line number Diff line change 11FROM elixir:1.10.1
22
3- # Install hex (Elixir package manager)
4- # Install rebar (Erlang build tool)
53RUN mix local.hex --force \
64 && mix local.rebar --force
75
8- # RUN mix archive.install --force https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez
9-
106RUN mix local.rebar --force
117
128RUN apt-get update \
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ FROM ubuntu:18.04
2+
3+ WORKDIR /app
4+
5+ RUN apt-get update \
6+ && apt-get install -y inotify-tools vim curl postgresql-client make
7+
8+ ENV DOCKER_CHANNEL edge
9+ ENV DOCKER_VERSION 19.03.5
10+ RUN curl -fsSL "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/x86_64/docker-${DOCKER_VERSION}.tgz" \
11+ | tar -xzC /usr/local/bin --strip=1 docker/docker
12+
13+ COPY _build/prod/rel/codebattle .
14+ COPY Makefile Makefile
15+ CMD exec /app/bin/codebattle start
Original file line number Diff line number Diff line change 1- .PHONY : test tarball
1+ .PHONY : test release test-code-checkers
22
33CACHE_MANIFEST := priv/static/cache_manifest.json
4- RELEASE := _build/prod/rel/codebattle
5- RELEASE_TARBALL := release.tar.gz
64WEBPACK := ./node_modules/webpack/bin/webpack.js
75
86default : format lint-js-fix credo test
@@ -24,13 +22,8 @@ lint-js-fix:
2422 yarn lint --fix
2523
2624start :
27- mix ecto.migrate
28- mix phx.server
29-
30- update :
31- mix deps.update --all
32- ncu -u
33- npm update
25+ bin/codebattle eval " Codebattle.Utils.Release.migrate"
26+ bin/codebattle start
3427
3528console :
3629 iex -S mix
@@ -42,12 +35,7 @@ test-code-checkers: export CODEBATTLE_RUN_CODE_CHECK = true
4235test-code-checkers :
4336 mix test test/code_check --max-failures 1
4437
45- tarball : $(RELEASE_TARBALL )
46-
47- $(RELEASE_TARBALL ) : build-release
48- tar czf $(RELEASE_TARBALL ) $(RELEASE )
49-
50- build-release : $(CACHE_MANIFEST )
38+ release : $(CACHE_MANIFEST )
5139 MIX_ENV=prod mix release --overwrite
5240
5341$(CACHE_MANIFEST ) : build-assets
@@ -58,3 +46,7 @@ build-assets: $(WEBPACK)
5846
5947$(WEBPACK ) :
6048 yarn install --frozen-lockfile
49+
50+ build-and-push-base :
51+ docker build -t codebattle/base --file Dockerfile.base .
52+ docker push codebattle/base:latest
You can’t perform that action at this time.
0 commit comments