Skip to content

Commit

Permalink
Working2 Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmytro-Hladkykh committed Jul 17, 2024
1 parent 0bbdc3a commit f3901bc
Show file tree
Hide file tree
Showing 15 changed files with 166 additions and 54 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FROM golang:1.22.5-alpine as buildbase
WORKDIR /go/src/github.com/Dmytro-Hladkykh/link-shortener-svc

COPY go.mod go.sum ./

RUN go mod download

COPY . .
Expand All @@ -16,4 +15,4 @@ RUN apk add --no-cache ca-certificates

COPY --from=buildbase /usr/local/bin/link-shortener-svc /usr/local/bin/link-shortener-svc

ENTRYPOINT ["/usr/local/bin/link-shortener-svc"]
ENTRYPOINT ["/usr/local/bin/link-shortener-svc"]
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ listener:
addr: :8000

db:
url: postgres://user:password@db/linkshortener?sslmode=disable
url: postgres://postgres:password@db/linkshortener?sslmode=disable
33 changes: 21 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
version: "3.8"

services:
db:
image: postgres:15
ports:
- "5432:5432"
environment:
POSTGRES_DB: linkshortener
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5

api:
build: .
ports:
- "8000:8000"
depends_on:
- db
db:
condition: service_healthy
environment:
- KV_VIPER_FILE=/config.yaml
volumes:
- ./config.yaml:/config.yaml

db:
image: postgres:13
environment:
POSTGRES_DB: linkshortener
POSTGRES_USER: user
POSTGRES_PASSWORD: password
volumes:
- pgdata:/var/lib/postgresql/data

nginx:
image: nginx:latest
restart: always
ports:
- "80:80"
- "8080:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- /var/www/html:/usr/share/nginx/html
depends_on:
- api

Expand Down
18 changes: 16 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/Dmytro-Hladkykh/link-shortener-svc
go 1.22.5

require (
github.com/Masterminds/squirrel v1.5.4
github.com/alecthomas/kingpin v2.2.6+incompatible
github.com/go-chi/chi v4.1.2+incompatible
github.com/jmoiron/sqlx v1.4.0
Expand All @@ -14,7 +15,6 @@ require (
)

require (
github.com/Masterminds/squirrel v1.5.4 // indirect
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
Expand All @@ -30,23 +30,33 @@ require (
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-ozzo/ozzo-validation/v4 v4.2.1 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/gobuffalo/logger v1.0.7 // indirect
github.com/gobuffalo/packd v1.0.2 // indirect
github.com/gobuffalo/packr/v2 v2.8.3 // indirect
github.com/google/jsonapi v0.0.0-20200226002910-c8283f632fb7 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/karrick/godirwalk v1.17.0 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/markbates/errx v1.1.0 // indirect
github.com/markbates/oncer v1.0.0 // indirect
github.com/markbates/safe v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.18.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
Expand All @@ -60,8 +70,12 @@ require (
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.23.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit f3901bc

Please sign in to comment.