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

391 add company picture attribut to jobs #423

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1f3f3c5
feat: add minio image to docker compose
DipandaAser Jun 6, 2023
c3330ef
feat: add minio image to docker compose
DipandaAser Jun 6, 2023
daecae6
feat: create file storage client by embedding S3 client
DipandaAser Jun 6, 2023
0b93e82
feat: upload and download picture for job offers
DipandaAser Jun 6, 2023
b0317e7
create bucket when setting up minio
DipandaAser Jun 6, 2023
3d471fd
fix: minio not starting on rootless env
DipandaAser Jun 9, 2023
cbc9581
fix: delete attached volume when stoping minio container
DipandaAser Jun 9, 2023
ff5dab0
fix: add missing return statement
DipandaAser Jun 9, 2023
ce1dde7
feat: get image of job offers
DipandaAser Jun 11, 2023
28400f5
fix: minio docker issues
DipandaAser Jun 25, 2023
63428d1
feat: update swagger docs
DipandaAser Jul 2, 2023
23aa4cd
fix: script of e2etest
DipandaAser Jul 2, 2023
4489f45
feat: render error occur on json decode
DipandaAser Jul 2, 2023
b93e991
add more test with all supported image file
DipandaAser Jul 2, 2023
f92ab3c
feat: update swagger docs
DipandaAser Jul 2, 2023
7631b98
Change server port from 7000 to 7001
elhmn Jul 30, 2023
c69382a
Tidy go modules
elhmn Jul 30, 2023
4670fb2
Update go version workflows
elhmn Jul 30, 2023
07e3997
uncomment staticcheck
elhmn Jul 30, 2023
5b85c50
order jobs by createdat and id when listing
DipandaAser Jul 30, 2023
3b968e1
change date type to datetime type for fields updatedat and createdat…
DipandaAser Jul 30, 2023
ee1e067
add request limiter middleware to avoid upload of file greater than 5MB
DipandaAser Aug 2, 2023
b883066
feat: create job offer image table & add test case for image size limit
DipandaAser Aug 27, 2023
a85b995
feat: rename backend/internal/file-storage/file-storage.go to backend…
DipandaAser Aug 27, 2023
da95da5
feat: fix linting issues
DipandaAser Aug 27, 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
6 changes: 3 additions & 3 deletions .github/workflows/backend-e2etest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
e2etest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.16
go-version: 1.18
- name: Run Backend Tests
working-directory: ./backend
run: make docker-e2etest
11 changes: 4 additions & 7 deletions .github/workflows/backend-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Setup
uses:
actions/setup-go@v2
- uses: actions/checkout@v3
- uses:
actions/setup-go@v4
with:
go-version: 1.16
go-version: 1.18
id: go

- name: Checkout
uses: actions/checkout@v2

- name: Run lint
run: make lint
working-directory: ./backend
6 changes: 3 additions & 3 deletions .github/workflows/backend-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.16
go-version: 1.18
- name: Run Backend Tests
working-directory: ./backend
run: make test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#application
jobsika
postgres-data
minio-data
.env
.opencollective-env

Expand Down
6 changes: 6 additions & 0 deletions backend/.docker-env
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ POSTGRES_PASSWORD=storage
POSTGRES_USER=storage
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
MINIO_ROOT_USER=minioadmin
MINIO_ROOT_PASSWORD=minioadmin
S3_ACCESS_KEY=minioadminaccesskey
S3_SECRET_KEY=minioadminsecretkey
S3_ENDPOINT=http://minio:9000
S3_BUCKET=jobsika
2 changes: 1 addition & 1 deletion backend/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ linters:
- gosimple
- unused
- structcheck
- staticcheck
# - staticcheck
- typecheck
- varcheck
4 changes: 4 additions & 0 deletions backend/.s3-env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
S3_ACCESS_KEY=minioadminaccesskey
S3_SECRET_KEY=minioadminsecretkey
S3_ENDPOINT=http://minio:9000
S3_BUCKET=jobsika
2 changes: 1 addition & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=base /dist/api /

# expose api port
EXPOSE 7000
EXPOSE 7001

ENTRYPOINT ["/api"]
20 changes: 14 additions & 6 deletions backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ run4test:
## : run the api using `ENVIRONMENT=development TEST=true make run` or `make run4test` to avoid timeouts
.PHONY: e2etest
e2etest: $(E2ETEST_DEPS)
-cd ./e2etests/ && API_HOST="http://localhost:7000/" npm test
-cd ./e2etests/ && API_HOST="http://localhost:7001/" npm test
@make reset-postgres > /dev/null

## e2etest-compose: run end to end tests in the docker-compose.test.yaml
Expand All @@ -54,6 +54,7 @@ $(E2ETEST_DEPS):
## docker-e2etest: run e2etests in a docker compose
docker-e2etest: $(E2ETEST_DEPS)
-rm -rf postgres-data
docker-compose -f docker-compose.test.yml down -v
docker-compose -f docker-compose.test.yml up --abort-on-container-exit --exit-code-from e2etests

## docker-build: build the api docker image
Expand All @@ -64,7 +65,7 @@ docker-build:
## docker-run: run the api docker container
.PHONY: docker-run
docker-run:
docker run -p 7000:7000 --env-file .docker-env jobsika
docker run -p 7001:7001 --env-file .docker-env jobsika

.PHONY: install_goose
install_goose:
Expand Down Expand Up @@ -100,7 +101,7 @@ start-api:

## stop-api: stops the api and its dependencies in a docker container
stop-api:
docker-compose down && \
docker-compose down -v && \
rm -rf postgres-data

## start-postgres: starts postgres sql, setup and populate yotas database
Expand Down Expand Up @@ -145,12 +146,19 @@ swagger.yaml: check-swagger
## serve-swagger: open the api documentation
.PHONY:serve-swagger
serve-swagger: swagger.yaml check-swagger
swagger serve -F=swagger swagger.yaml
swagger serve -F=swagger swagger.yaml --no-open

start-minio:
docker compose up start-minio
docker compose logs -f

stop-minio:
docker compose down -v

## install-deps: install main dependencies
install-deps:
@echo "installing golangci-lint..."
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.23.8
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.53.3
@echo "golangci installed!"
@echo "installing errcheck..."
go install github.com/kisielk/errcheck@latest
Expand All @@ -165,7 +173,7 @@ install-deps:

check-lint:
ifeq (, $(shell which golangci-lint))
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.23.8
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.53.3
endif
ifeq (, $(shell which errcheck))
go install github.com/kisielk/errcheck@latest
Expand Down
23 changes: 19 additions & 4 deletions backend/docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ services:
api:
depends_on:
- postgres
- minio
restart: always
image: golang:buster
command: /api/scripts/wait-for-it/wait-for-it.sh postgres:5432 -t 120 -- /api/scripts/setup-postgres/setup-postgres-and-run-api.sh
command: /api/scripts/wait-for-it/wait-for-it.sh postgres:5432 -t 120 -- /api/scripts/setup-postgres/setup-minio-postgres-and-run-api.sh
env_file:
- ./.docker-env
environment:
Expand All @@ -24,16 +25,30 @@ services:
volumes:
- .:/api
ports:
- 7000:7000
- 7001:7001
extra_hosts:
- host.docker.internal:host-gateway

minio:
image: quay.io/minio/minio
command: server /data --console-address ":9090"
env_file:
- ./.docker-env
volumes:
- minio-storage:/data
ports:
- 9000:9000
- 9090:9090

e2etests:
depends_on:
- api
image: node:14-stretch
command: /api/scripts/wait-for-it/wait-for-it.sh api:7000 -t 300 -- make -C /api e2etest-compose
command: /api/scripts/wait-for-it/wait-for-it.sh api:7001 -t 300 -- make -C /api e2etest-compose
environment:
API_HOST: "http://api:7000/"
API_HOST: "http://api:7001/"
volumes:
- .:/api

volumes:
minio-storage: {}
31 changes: 29 additions & 2 deletions backend/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,43 @@ services:
volumes:
- .:/api

minio:
image: quay.io/minio/minio
command: server /data --console-address ":9090"
env_file:
- ./.docker-env
volumes:
- minio-storage:/data
ports:
- 9000:9000
- 9090:9090

start-minio:
extra_hosts:
- host.docker.internal:host-gateway
depends_on:
- minio
image: golang:buster
command: /api/scripts/wait-for-it/wait-for-it.sh minio:9000 -t 120 -- /api/scripts/setup-minio.sh
env_file:
- ./.docker-env
volumes:
- .:/api

api:
depends_on:
- start-postgres
- start-minio
image: golang:buster
command: ["/bin/bash", "-c", "cd /api/ && make run"]
command: [ "/bin/bash", "-c", "cd /api/ && make run" ]
env_file:
- ./.docker-env
- ./.api-env
- ./.opencollective-env
volumes:
- .:/api
ports:
- 7000:7000
- 7001:7001

volumes:
minio-storage: {}
2 changes: 1 addition & 1 deletion backend/e2etests/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1 @@
API_HOST=http://localhost:7000/
API_HOST=http://localhost:7001/
Binary file added backend/e2etests/image.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backend/e2etests/image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backend/e2etests/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions backend/e2etests/image.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backend/e2etests/image.webp
Binary file not shown.
Loading
Loading