Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #6

Merged
merged 158 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
8726bac
git ignore update
CodeMaster482 Oct 5, 2023
a93ce73
Merge branch 'develop' of github.com:go-park-mail-ru/2023_2_Hamster i…
CodeMaster482 Oct 5, 2023
81c5d93
CORS
CodeMaster482 Oct 5, 2023
c2dcdae
delete .vscode
DmitriyKomarovCoder Oct 5, 2023
e0fa02d
delete .vscode
DmitriyKomarovCoder Oct 5, 2023
4bd8d46
CORS active && new_route
CodeMaster482 Oct 5, 2023
51898dc
middleware finnale fix && logout add
CodeMaster482 Oct 5, 2023
ad66cda
merge
CodeMaster482 Oct 5, 2023
5072e75
auth done
CodeMaster482 Oct 5, 2023
f5454be
cors update
CodeMaster482 Oct 5, 2023
ec3a9dc
deploy test
CodeMaster482 Oct 5, 2023
3f998c0
deploy
CodeMaster482 Oct 5, 2023
4dc39b6
ahhaha
CodeMaster482 Oct 5, 2023
8b68793
ahahahh
CodeMaster482 Oct 5, 2023
cd04e11
ahahahah
CodeMaster482 Oct 5, 2023
e8136a3
plz
CodeMaster482 Oct 5, 2023
5e4aa3d
lold
CodeMaster482 Oct 5, 2023
56a0de6
ahahah
CodeMaster482 Oct 5, 2023
c31c0a3
auth update
CodeMaster482 Oct 6, 2023
09ca9b2
lol
CodeMaster482 Oct 6, 2023
179b8f0
git ignore
CodeMaster482 Oct 9, 2023
a0e4069
secret hide
CodeMaster482 Oct 9, 2023
eccefc6
add user handler test
DmitriyKomarovCoder Oct 11, 2023
91b4f02
Merge branch 'develop' of github.com:go-park-mail-ru/2023_2_Hamster i…
DmitriyKomarovCoder Oct 11, 2023
3401899
add work user usecase test
DmitriyKomarovCoder Oct 11, 2023
08a672c
add test in user usecase
DmitriyKomarovCoder Oct 11, 2023
477c2a9
add feed router
DmitriyKomarovCoder Oct 12, 2023
1bb640c
edit json transfer, feed, swagger. add user transfer models
DmitriyKomarovCoder Oct 13, 2023
5fc34ae
edit ErrorResponse, add new error response
DmitriyKomarovCoder Oct 14, 2023
dec62b0
edit user error
DmitriyKomarovCoder Oct 14, 2023
83f2bab
add docker app
DmitriyKomarovCoder Oct 14, 2023
5008990
add makefile condb
DmitriyKomarovCoder Oct 14, 2023
94ef943
edit docker, feed
DmitriyKomarovCoder Oct 15, 2023
b9a7643
add new make command && edit issue in get user
DmitriyKomarovCoder Oct 15, 2023
fc38f35
add full test delivery user && add script coverage_test && edit .giti…
DmitriyKomarovCoder Oct 15, 2023
39b6ab5
delete coverage.html with repository
DmitriyKomarovCoder Oct 15, 2023
df40959
upsates
CodeMaster482 Oct 16, 2023
fe20dc5
Merge branch 'develop' of github.com:go-park-mail-ru/2023_2_Hamster i…
CodeMaster482 Oct 16, 2023
ae747cd
resp
CodeMaster482 Oct 16, 2023
6458fce
add test GetUser, GetFeed
DmitriyKomarovCoder Oct 18, 2023
1471d8d
add swagger getUser, rn Error in ResponseError
DmitriyKomarovCoder Oct 18, 2023
ede60bf
add user update && add func GetUserFromREquest
DmitriyKomarovCoder Oct 18, 2023
96e4b76
add context function
DmitriyKomarovCoder Oct 19, 2023
51d6ede
add context function
DmitriyKomarovCoder Oct 19, 2023
b222042
merge?
CodeMaster482 Oct 20, 2023
a267feb
merging
CodeMaster482 Oct 20, 2023
2ad03e9
fixed errors
DmitriyKomarovCoder Oct 20, 2023
f38830c
swagger update
DmitriyKomarovCoder Oct 20, 2023
3a6105a
merge
CodeMaster482 Oct 20, 2023
ac681a3
Merge branch 'develop' of github.com:go-park-mail-ru/2023_2_Hamster i…
CodeMaster482 Oct 20, 2023
004ab13
add method IsLoginUnique
DmitriyKomarovCoder Oct 20, 2023
40ae280
add method updatePhoto
DmitriyKomarovCoder Oct 21, 2023
1968aff
init router transaction, category
DmitriyKomarovCoder Oct 22, 2023
c87dc44
fixed docker connection
DmitriyKomarovCoder Oct 22, 2023
7c4f66a
file struct update
CodeMaster482 Oct 22, 2023
b990271
work update user photo
DmitriyKomarovCoder Oct 22, 2023
40a7d1a
edit successResponse updatePhoto
DmitriyKomarovCoder Oct 22, 2023
5ad8bb6
edit swagger
DmitriyKomarovCoder Oct 22, 2023
111fb5d
add status 204 GetAccounts method
DmitriyKomarovCoder Oct 22, 2023
6727138
new swager
DmitriyKomarovCoder Oct 22, 2023
fa7a615
sqlx -> pgx/v5
DmitriyKomarovCoder Oct 23, 2023
3b6645a
update postgres
DmitriyKomarovCoder Oct 23, 2023
17bbfe3
get changes
CodeMaster482 Oct 24, 2023
d863883
merge
CodeMaster482 Oct 24, 2023
37774c6
handlers user test done
DmitriyKomarovCoder Oct 24, 2023
5d2a412
an-pull
CodeMaster482 Oct 25, 2023
19301bc
Merge branch 'develop' of github.com:go-park-mail-ru/2023_2_Hamster i…
CodeMaster482 Oct 25, 2023
5d9d184
add test pgx -> pgxpoo;
DmitriyKomarovCoder Oct 25, 2023
8a82bf7
add transaction get, edit getAccounts
DmitriyKomarovCoder Oct 26, 2023
b4454eb
session++
CodeMaster482 Oct 27, 2023
a182864
merge
CodeMaster482 Oct 27, 2023
b96e3d2
add some edit
DmitriyKomarovCoder Oct 27, 2023
797a7f0
init update
CodeMaster482 Oct 28, 2023
6e333d2
merge
CodeMaster482 Oct 28, 2023
efb25fc
cmd/ fixes
CodeMaster482 Oct 28, 2023
33ce044
router init update
CodeMaster482 Oct 28, 2023
cf10e39
hihi
CodeMaster482 Oct 28, 2023
d47f422
lolz
CodeMaster482 Oct 28, 2023
c36a1bb
super
CodeMaster482 Oct 28, 2023
6222ca2
redis conn fix
CodeMaster482 Oct 28, 2023
7450e96
redis conn try fix
CodeMaster482 Oct 28, 2023
d99578a
session fix
CodeMaster482 Oct 28, 2023
71653e0
create transaction method
DmitriyKomarovCoder Oct 29, 2023
e533c73
some
DmitriyKomarovCoder Oct 29, 2023
68853aa
some
DmitriyKomarovCoder Oct 29, 2023
645f40f
micrservices folder && lint warn fix
CodeMaster482 Oct 29, 2023
7f91361
merge last commit
CodeMaster482 Oct 29, 2023
49f8372
go mod tidy
CodeMaster482 Oct 29, 2023
3956b83
i love pgx library
DmitriyKomarovCoder Oct 29, 2023
efeaf47
Ci/Cd && makefile add lint
CodeMaster482 Oct 29, 2023
58c06a2
Merge branch 'develop' of github.com:go-park-mail-ru/2023_2_Hamster i…
CodeMaster482 Oct 29, 2023
94ce27a
I LOVE PGX TYPE
DmitriyKomarovCoder Oct 29, 2023
169f81b
Merge branch 'develop' of github.com:go-park-mail-ru/2023_2_Hamster i…
CodeMaster482 Oct 29, 2023
3c3e1a2
create local-docker, server init update
DmitriyKomarovCoder Oct 29, 2023
a5b4aab
lol
CodeMaster482 Oct 29, 2023
101a94b
merge
CodeMaster482 Oct 29, 2023
16a6625
add create transaction && update user api
DmitriyKomarovCoder Oct 30, 2023
3a398a3
update json text
DmitriyKomarovCoder Oct 30, 2023
eb58f66
update json text
DmitriyKomarovCoder Oct 30, 2023
1aac1f7
move check login unique in auth rep && swagger update
DmitriyKomarovCoder Oct 30, 2023
d156cf4
log midleware
CodeMaster482 Oct 30, 2023
269fa40
merge
CodeMaster482 Oct 30, 2023
62321db
add middleware panic
DmitriyKomarovCoder Oct 30, 2023
7bb0efc
work transaction Delete
DmitriyKomarovCoder Oct 30, 2023
4745d75
done transaction
DmitriyKomarovCoder Oct 30, 2023
8df5f95
edit transaction
DmitriyKomarovCoder Oct 31, 2023
8b367cb
fix transaction issues
DmitriyKomarovCoder Oct 31, 2023
04d1d18
midlware upgrade
CodeMaster482 Oct 31, 2023
b18c45c
merge
CodeMaster482 Oct 31, 2023
aaa7df4
fix issues swagger
DmitriyKomarovCoder Oct 31, 2023
227940a
add test transaction handlers.go && edit user test handlers
DmitriyKomarovCoder Nov 1, 2023
7e38849
stage
CodeMaster482 Nov 1, 2023
39df702
merge
CodeMaster482 Nov 1, 2023
f586fb0
pgxtype->pgx/v4
DmitriyKomarovCoder Nov 1, 2023
290117d
step changes
CodeMaster482 Nov 2, 2023
b2a73e5
merge
CodeMaster482 Nov 2, 2023
9e5a8c1
edit pgInterface && db_port
DmitriyKomarovCoder Nov 2, 2023
56e7acb
stage
CodeMaster482 Nov 2, 2023
827ef98
merge
CodeMaster482 Nov 2, 2023
5233861
stage
CodeMaster482 Nov 2, 2023
b17a7f2
pgx -> pgxPool
DmitriyKomarovCoder Nov 2, 2023
1ffe04b
merge
DmitriyKomarovCoder Nov 2, 2023
73e12c4
start work test user postres
DmitriyKomarovCoder Nov 3, 2023
9bfe00b
add test postgres user
DmitriyKomarovCoder Nov 4, 2023
8dae851
\+_+/
DmitriyKomarovCoder Nov 5, 2023
2fa0528
add test user postgres && start test transaction postres
DmitriyKomarovCoder Nov 5, 2023
da037e5
add transaction test postgres
DmitriyKomarovCoder Nov 5, 2023
ce37cf8
add test
DmitriyKomarovCoder Nov 6, 2023
86017d4
add csrf-token
DmitriyKomarovCoder Nov 7, 2023
305a121
tags + logger + middleware + test session + test hash = done
CodeMaster482 Nov 7, 2023
05e039b
mega merge
CodeMaster482 Nov 7, 2023
f95a1b5
ci defeat
CodeMaster482 Nov 7, 2023
0e36de5
ci test
CodeMaster482 Nov 7, 2023
f42d5fb
test_id
CodeMaster482 Nov 7, 2023
aa2f194
create test folder
CodeMaster482 Nov 7, 2023
60a200f
ci win
CodeMaster482 Nov 7, 2023
2b3e3a0
Merge pull request #5 from go-park-mail-ru/featchure/ci_cd
CodeMaster482 Nov 7, 2023
620b9f8
ok err
CodeMaster482 Nov 7, 2023
4d26903
err ok hotfix rollback
CodeMaster482 Nov 7, 2023
d8e7139
prod debug start
CodeMaster482 Nov 7, 2023
5bb214a
hotfix logout && swagger update
CodeMaster482 Nov 7, 2023
53aaa3f
init hotfix
CodeMaster482 Nov 7, 2023
a960c61
swagger hotfix
CodeMaster482 Nov 7, 2023
6c6b19b
swagger hotfix 2
CodeMaster482 Nov 7, 2023
99225d4
testing begin
CodeMaster482 Nov 8, 2023
baf5784
add test
DmitriyKomarovCoder Nov 8, 2023
4aacc8c
Merge branch 'develop' of github.com:go-park-mail-ru/2023_2_Hamster i…
DmitriyKomarovCoder Nov 8, 2023
6f783c3
add more test
DmitriyKomarovCoder Nov 8, 2023
86d2ef6
testing progess go up up up
CodeMaster482 Nov 8, 2023
ab72b27
Merge branch 'develop' of github.com:go-park-mail-ru/2023_2_Hamster i…
CodeMaster482 Nov 8, 2023
42ce075
testing
CodeMaster482 Nov 8, 2023
599f87a
d
DmitriyKomarovCoder Nov 8, 2023
a6cbfc6
Merge branch 'develop' of github.com:go-park-mail-ru/2023_2_Hamster i…
DmitriyKomarovCoder Nov 8, 2023
06947b7
testing 75.2
CodeMaster482 Nov 8, 2023
368d441
mini update
DmitriyKomarovCoder Nov 8, 2023
9e136c3
some
DmitriyKomarovCoder Nov 8, 2023
9423429
default tags hotfix
CodeMaster482 Nov 8, 2023
8d3b5d4
Merge branch 'develop' of github.com:go-park-mail-ru/2023_2_Hamster i…
CodeMaster482 Nov 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/Dockerfile*
**/.dockerignore
21 changes: 17 additions & 4 deletions .env
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
SECRET = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCDjuCEWb5ciNQS2RCkAWN5YkR5og31NcKoaGhfH6hZo+X0JVaXkiEyHQ3Cj7LxBYIjYF3k86r3gghVKLkc0aZX4gINHVGJABnAime3uQqzC09wZQedbhFVTW1vi/mFED01bprmapfsKA49LkJAuGpiQlfZw+EXyLYBTF04bxiCrw2Ampg9X1ub9c1MHvhIwdqZMbQQdHpimtoXoDZ8HMEyCClpd1OLudomBuav6fSZUz/RMBM5xMfHRnuCmsCciB86hxDOBVhw75qbwKN0cHlnvrrndZ9hMlRp9oZFXYTDwFO2hCOlW8Gx7l60WyNYW5ino6HaA2hmxrTOqOJPya+/AgMBAAECggEANF3gIu6yJpVUjXgX9qCS3xNtnFkUY0IWDQEaYprwYVYrR6bBNC43xoHoI0Ud/nCp37kRRvxzVnhNJtDB9qXBKARPurar6PPATHMLXAdtKd3briqZAGJ6xdC/OgKmvP+8zZMMV6GgfaFoIZRTTP3bYudznrwo0lXTlOq3xKn8QLAm7diFMwRpRkNZTaHWCbFc6y61ChU6b9BhZOk6OSN/z5rMwWFPN2mocEcXFOU09h2RKdSI9dkXp/Wi7IcqOmtDyyUqgAkiLbCi/GNkrub7fBQGY1r8WnZS04nNrNvA4LQ/nN0hGXKwYkaCA1JagVt4vwVfeBREzvgxxVJL/o78CQKBgQDdSvf9geM5hRkvONSintiD6EydX0kmVdp0z50ghaZmJUMEK4cWk9LCgf4NOleixu/cWmTA/jsGYcWpaRCaN35toLO8aoIC+whDtUWaF15PVIrciHLJO6WTMYUr508E2VR1FljOxvqL5TCKDtctvsypq8Ys8elH3MXwUbQhvUAAjQKBgQCYMQI5lcaxHyDYCvUed+sjZrg9VsayjTgvS54EYi0PfH+f2QcHVN2QqMJn61khBt/eIuw6Miz5tG3ItPFFTQeXdEU09GaCkHXXgOs7RWyUmRSoX+F74R/um8HW+Gz8INC6ULafQfyqII7hg3MpIeUc8dCnwTvs3p+KLB0A3GIcewKBgGyppG56Ok6DWeODP35/C4hyKDTaljvZyoSzcc+HcTcVMvw4N4RRoBtc45gxPtkyYJPOW00dSXSPzBSs/7cKau2ADOIHVsIJ7Hv65iuNMAU6WVmDMwI3ZM2Lcn4lffq+kSdRitg2gs7xAs24DddrqmnibFSjkU51TUj9hbtPh779AoGAcS2ZCvvwO837Xc6gRN1HFxePkcYTk7rjeoCQbZAZFHgwbM43pOMetjJaCHAD40S6fPaZmBmySqw8LFMrTa8gIyiLQvsxtIz7pZyw0m4pdkR1EVXkWHytg4N/Xn92hPVeZAAcH0kyPc5ikyBvJrqXKLRHyEkyaE+Sc22kz/wUVjsCgYB/Z1Jln6kLqdAoF9H7x7dB07BeMzpgawGGTxvS36+tD1x1zvE0x3rOMqhjbR2XH+ciVaVc6Z36wEz6cIn/FRABUuF3/89kts5/1b1JcQ2GjO5bXidALBUFyJlolA6pNaP1JNYpdULwu/vBGUeq0a4uGNRYUwuZp+qvoW3Nt22Mug=="
DB_NAME=Hamster
DB_USER=kosmatoff
SECRET="vzqqEH6o5so_VGJZoLhrfdrH7Y7kvFe-7N2i3I3w314=п"

DB_CONTAINER_NAME=HammyWallet_DB
DB_NAME=HammyWallets
DB_USER=hamster
DB_PASSWORD=2003
DB_HOST=0.0.0.0
DB_SSLMODE=disable
DB_PORT=5432

SERVER_NAME=HammyWallet_API
SERVER_HOST=127.0.0.1
SERVER_PORT=8080
DB_SSLMODE=disable

FRONTEND_IP=84.23.52.156
FRONTEND_PORT=8000

REDIS_CONTAINER_NAME=HammyWallet_redis
REDIS_HOST=0.0.0.0
REDIS_PORT=6379

13 changes: 13 additions & 0 deletions .github/workflows/CD.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: CD

on:
push:
branches:
- main
- deploy
pull_request:
branches:
- main
- deploy

jobs:
55 changes: 55 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CI

on: [push, pull_request]

jobs:
linter:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21'

- name: Cache Go modules
uses: actions/cache@v3
id: go-cache
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-

- if: steps.go-cache.outputs.cache-hit != 'true'
run: go mod download

- name: Create test folder
run: |
sudo mkdir /images
sudo chmod -R 777 /images

- name: Run Unit tests
run: |
go test ./...

- name: Verify dependencies
run: go mod verify

test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21'

- name: Install dependencies
run: go mod tidy

- name: Run tests
run: go test -race -vet=off -run '!(ws|server)' ./...
136 changes: 136 additions & 0 deletions .github/workflows/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
#name: ci
#
#on:
# push:
# branches:
# - develop
# - main
# pull_request:
#
#env:
# REGISTRY: "mrdjeb"
# IMAGE_NAME: "zuzu-main-web"
# CONTAINER_NAME: "zuzu-main"
# FOLDER_COMPOSE: "zuzu-main-deploy"
# GITHUB_SHA_SHORT:
#
#
jobs:
lint_and_test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.21.x'
cache: false

- name: golangci-lint
uses: golangci/golangci-lint-action@v3

- name: Test with the Go CLI
run: go test ./...

# build_and_push:
# runs-on: ubuntu-latest
# needs: lint_and_test
#
# steps:
# - name: Checkout
# uses: actions/checkout@v4
#
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
#
# - name: Login to DockerHub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
#
# - name: Set env
# run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | head -c 8)" >> $GITHUB_ENV
#
# - name: Build and push
# uses: docker/build-push-action@v4
# with:
# context: .
# push: true
# tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_SHA_SHORT }}, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
# file: ./build/Dockerfile.multistage.main
# build-args: |
# IMAGE_NAME=${{ env.IMAGE_NAME }}
# REGISTRY=${{ env.REGISTRY }}
# GITHUB_SHA_SHORT=${{ env.GITHUB_SHA_SHORT }}
#
# deploy:
# runs-on: ubuntu-latest
# needs: build_and_push
#
# steps:
# - name: Checkout
# uses: actions/checkout@v3
#
# - name: Deploy docker-compose.yml via SSH action
# uses: appleboy/[email protected]
# with:
# host: ${{ secrets.HOST }}
# port: ${{ secrets.PORT }}
# username: ${{ secrets.USERNAME }}
# key: ${{ secrets.SSHKEY }}
# rm: true
# source: docker-compose.yaml, build/sql/create.sql
# target: ~/${{ env.FOLDER_COMPOSE }}
#
#
# - name: Deploy to DockerHub via SSH action
# uses: appleboy/[email protected]
# with:
# host: ${{ secrets.HOST }}
# port: ${{ secrets.PORT }}
# username: ${{ secrets.USERNAME }}
# key: ${{ secrets.SSHKEY }}
# envs: REGISTRY, IMAGE_NAME, CONTAINER_NAME, GITHUB_SHA, FOLDER_COMPOSE
# script: |
# sudo bash
# cd $(echo $FOLDER_COMPOSE)
#
# # Make .env variables file
# cat <<EOF>.env
#
# POSTGRES_DB=${{ secrets.POSTGRES_DB }}
# POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}
# DB_HOST=${{ secrets.DB_HOST }}
# DB_PORT=${{ secrets.DB_PORT }}
# POSTGRES_USER=${{ secrets.POSTGRES_USER }}
# PGADMIN_DEFAULT_EMAIL=${{ secrets.PGADMIN_DEFAULT_EMAIL }}
# PGADMIN_DEFAULT_PASSWORD=${{ secrets.PGADMIN_DEFAULT_PASSWORD }}
# JWT_SECRET_KEY=${{ secrets.JWT_SECRET_KEY }}
#
# IMAGE_NAME=${{ env.IMAGE_NAME }}
# REGISTRY=${{ env.REGISTRY }}
# CONTAINER_NAME=${{ env.CONTAINER_NAME }}
# EOF
# echo "GITHUB_SHA_SHORT=`echo $GITHUB_SHA | head -c8`" >> .env
#
# # Make init script1 for postgres container, install the extension "uuid-ossp" for postgres
# echo "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" > init_uuid.sql
#
# # <==========!==========>
# # Log in to DockerHub
# echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
#
# # Pull image DockerHub
# docker pull $REGISTRY/$IMAGE_NAME:latest
#
# # Restart docker-compose
# docker system prune -f
# docker compose down
# docker compose up -d
# # <==========!==========>
13 changes: 9 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,23 @@
# Dependency directories (remove the comment below to include it)
# vendor/

# IDE dirictories

.vscode

# Go workspace file
go.work

app

# *.env
*.out.tmp
*.html

*.env
*.idea
*.bin
*.tmp

# Environment
# .env
.env

# Logs
*.log
Expand Down
40 changes: 40 additions & 0 deletions .golandcli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
linters:
enable-all: true
disable:
- varnamelen
- depguard
- godox
- testpackage
- exhaustivestruct
- wsl
- revive
- ireturn
- exhaustruct
- misspell
- gomnd
- paralleltest
- goerr113
- rowserrcheck
- tagalign
- forbidigo
- gci
- gofumpt
- godot
- goimports
- gochecknoglobals
- errname
- funlen #Del
- staticcheck #Del
- sqlclosecheck #Del
- inamedparam #Errors
- testifylint #Errors
- gofmt #Errors
- deadcode #Warnings
- golint #Warnings
- scopelint #Warnings
- interfacer #Warnings
- nosnakecase #Warnings
- maligned #Warnings
- structcheck #Warnings
- ifshort #Warnings
- varcheck #Warnings
15 changes: 0 additions & 15 deletions .vscode/launch.json

This file was deleted.

49 changes: 43 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,49 @@
include .env
export

.PHONY: dc run test lint down
.PHONY: run run-in build clean db app down doc test lint

dc:
run: ## Start the application in detached mode
docker-compose up -d

run:
go build -o app ./cmd/api/main.go && ./app
run-debug:
docker-compose -f local-docker-compose.yaml up

down:
docker-compose down
run-in: ## Start the application in interactive mode
docker-compose up

build: ## Build Docker images
docker-compose build

clean: ## Remove unused Docker images
docker system prune -af
docker volume prune -af
docker system df
docker rmi -f $$(docker images -q) || true

db: ## Connect to the database
docker exec -it 2023_2_hamster-db-1 psql -U $(DB_USER) -d $(DB_NAME)

app: ## Connect to the application container
docker exec -it 2023_2_hamster-server-1 ./app

down: ## Stop and remove containers, networks, images, and volumes
docker-compose down

doc: ## Generate API documentation using swag
swag init -g cmd/api/main.go

test: ## Run tests
go test ./...;
find . -type d -name "logs" -exec rm -r {} \;

lint: ## Run linters
golangci-lint run

# New make

# b:
# go build -o app ./cmd/api/main.go

# r: lint b
# ./app
6 changes: 6 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM golang:latest
COPY . /app
WORKDIR /app
RUN go mod download
RUN go build -o app ./cmd/api/main.go
ENTRYPOINT ["./app"]
Loading