Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KranjQ committed Dec 21, 2024
2 parents d4b885e + 0e6800b commit 0e57d44
Show file tree
Hide file tree
Showing 256 changed files with 30,881 additions and 4,006 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/flow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: SparkIt build
on:
push:
branches:
- main
- final

jobs:
linters-act:
name: linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
tests-act:
name: tests
needs: linters-act
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: ImageData
run: cd /home/runner && mkdir imagedata
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...

deploy:
name: Deploy SparkIt
needs: tests-act
runs-on: ubuntu-latest
steps:
- name: Pull Code
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME}}
key: ${{ secrets.PRIVATE_KEY }}
script: cd /home/ubuntu/2024_2_SaraFun/ && git pull
- name: Build containers
uses: appleboy/ssh-action@master
with:
timeout: 10m
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.PRIVATE_KEY }}
script: cd /home/ubuntu/2024_2_SaraFun/ && make sparkit-run
- name: Restart service
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.PRIVATE_KEY }}
script: cd /home/ubuntu/2024_2_SaraFun/ && make sparkit-down && make sparkit-run

8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
.idea/
.idea/
server.crt
server.key
coverage.out
coverprofile.tmp
.env
docker/.env
15 changes: 15 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
linters-settings:
gocognit:
min-complexity: 60

linters:
disable-all: true
enable:
- govet
- gosimple
- bodyclose
- noctx
- errcheck
- gocognit
- goconst
- gofmt
35 changes: 33 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ COMMUNICATIONS_BINARY=communications
DOCKER_DIR=docker
MESSAGE_BINARY=message
SURVEY_BINARY=survey
PAYMENTS_BINARY=payments

build-sparkit:
go build -o ${SERVER_BINARY} ./cmd/main
Expand All @@ -13,6 +14,12 @@ build-sparkit:
service-sparkit-image:
docker build -t sparkit-service -f ${DOCKER_DIR}/sparkit.Dockerfile .

echo:
echo "123"

echo2: echo
echo "321"

.PHONY: builder-image
builder-image:
docker build -t sparkit-builder -f ${DOCKER_DIR}/builder.Dockerfile .
Expand All @@ -31,6 +38,7 @@ sparkit-run:
make service-message-image
#make survey-builder-image
make service-survey-image
make service-payments-image
docker-compose -f $(DOCKER_DIR)/docker-compose.yml up -d

.PHONY: sparkit-down
Expand All @@ -39,7 +47,11 @@ sparkit-down:

.PHONY: sparkit-test
sparkit-test:
go test -coverprofile=coverage.out -coverpkg=$(go list ./... | grep -v "/mocks" | paste -sd ',') ./...
go test -json ./... -coverprofile coverprofile_.tmp -coverpkg=./... ; \
grep -v -e '/mocks' -e 'mock_repository.go' -e 'mock.go' -e 'docs.go' -e '_easyjson.go' -e '.pb.go' -e 'gen.go' -e 'main.go' coverprofile_.tmp > coverprofile.tmp ; \
rm coverprofile_.tmp ; \
go tool cover -html coverprofile.tmp -o ../heatmap.html; \
go tool cover -func coverprofile.tmp

.PHONY: sparkit-test-cover
sparkit-test-cover:
Expand Down Expand Up @@ -143,4 +155,23 @@ survey-builder-image:
sparkit-survey-run:
make survey-builder-image
make service-survey-image
docker run sparkit-survey-service
docker run sparkit-survey-service

# docker build for payments microservice

build-payments-microservice:
go build -o ${PAYMENTS_BINARY} ./cmd/payments

.PHONY: service-payments-image
service-payments-image:
docker build -t sparkit-payments-service -f ${DOCKER_DIR}/payments.Dockerfile .

.PHONY: payments-builder-image
payments-builder-image:
docker build -t sparkit-payments-builder -f ${DOCKER_DIR}/paymentsBuilder.Dockerfile .

.PHONY: sparkit-payments-run
sparkit-payments-run:
make payments-builder-image
make service-payments-image
docker run sparkit-payments-service
55 changes: 0 additions & 55 deletions build/sql/create_tables.sql

This file was deleted.

22 changes: 22 additions & 0 deletions build/sql/db/configuration/custom.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
listen_addresses = 'sparkit-postgres'
max_connections = 100
statement_timeout = '30s'
lock_timeout = '5s'
log_destination = 'csvlog'
logging_collector = on
log_directory = 'pg_log'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_min_duration_statement = 1000
log_statement = 'none'
log_line_prefix = '%m [%p]: [%l-1] user=%u,db=%d,client=%h '
log_error_verbosity = default
log_min_error_statement = error
shared_preload_libraries = 'pg_stat_statements, auto_explain'
pg_stat_statements.max = 10000
pg_stat_statements.track = all
pg_stat_statements.track_utility = on
auto_explain.log_min_duration = '1000ms'
auto_explain.log_analyze = on
auto_explain.log_buffers = on
auto_explain.log_timing = on
auto_explain.log_triggers = on
Loading

0 comments on commit 0e57d44

Please sign in to comment.