-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c2fd17e
Showing
32 changed files
with
3,656 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# POSTGRES | ||
DB_NAME=test_tenants | ||
DB_USER=postgres | ||
DB_PASSWORD=postgres | ||
DB_PORT=5432 | ||
DB_HOST=tenants_db | ||
|
||
# PGADMIN | ||
PGADMIN_DEFAULT_EMAIL=admin@email.com | ||
PGADMIN_DEFAULT_PASSWORD=admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose | ||
{ | ||
"name": "Gorm Multi-Tenancy", | ||
"dockerComposeFile": [ | ||
"docker-compose.yml" | ||
], | ||
"service": "app", | ||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"GitHub.copilot", | ||
"GitHub.copilot-chat", | ||
"golang.go", | ||
"cweijan.vscode-postgresql-client2", | ||
"github.vscode-github-actions" | ||
] | ||
} | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/common-utils:2": { | ||
"installZsh": true, | ||
"configureZshAsDefaultShell": true, | ||
"installOhMyZsh": true, | ||
"installOhMyZshConfig": true, | ||
"upgradePackages": true | ||
}, | ||
"ghcr.io/devcontainers-contrib/features/zsh-plugins:0": { | ||
"plugins": "zsh-autosuggestions zsh-syntax-highlighting zsh-history-substring-search", | ||
"omzPlugins": "https://github.com/zsh-users/zsh-autosuggestions.git https://github.com/zsh-users/zsh-syntax-highlighting.git https://github.com/zsh-users/zsh-history-substring-search.git" | ||
}, | ||
"ghcr.io/devcontainers/features/aws-cli:1": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
version: '3.9' | ||
|
||
services: | ||
app: | ||
image: mcr.microsoft.com/devcontainers/go:1.21-bullseye | ||
ports: | ||
- 8080:8080 | ||
volumes: | ||
- ../..:/workspaces:cached | ||
# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust. | ||
cap_add: | ||
- SYS_PTRACE | ||
security_opt: | ||
- seccomp:unconfined | ||
depends_on: | ||
- db | ||
networks: | ||
- backend | ||
command: sleep infinity | ||
environment: | ||
- DB_HOST=${DB_HOST} | ||
- DB_PORT=${DB_PORT} | ||
- DB_NAME=${DB_NAME} | ||
- DB_USER=${DB_USER} | ||
- DB_PASSWORD=${DB_PASSWORD} | ||
|
||
db: | ||
image: postgres:15.4-alpine | ||
restart: always | ||
hostname: ${DB_HOST} | ||
environment: | ||
- POSTGRES_DB=${DB_NAME} | ||
- POSTGRES_USER=${DB_USER} | ||
- POSTGRES_PASSWORD=${DB_PASSWORD} | ||
ports: | ||
- 5432:${DB_PORT} | ||
volumes: | ||
- db-data:/var/lib/postgresql/data | ||
networks: | ||
- backend | ||
|
||
pgadmin: | ||
image: dpage/pgadmin4:latest | ||
restart: always | ||
environment: | ||
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL} | ||
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD} | ||
ports: | ||
- 5050:80 | ||
volumes: | ||
- pgadmin-data:/var/lib/pgadmin | ||
networks: | ||
- backend | ||
depends_on: | ||
- db | ||
|
||
|
||
volumes: | ||
db-data: | ||
pgadmin-data: | ||
|
||
networks: | ||
backend: | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Go | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
env: | ||
DB_NAME: test_tenants | ||
DB_USER: postgres | ||
DB_PASSWORD: postgres | ||
DB_PORT: 5432 | ||
DB_HOST: localhost | ||
services: | ||
db: | ||
image: postgres:latest | ||
env: | ||
POSTGRES_DB: ${{ env.DB_NAME }} | ||
POSTGRES_USER: ${{ env.DB_USER }} | ||
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }} | ||
ports: | ||
- 5432:5432 | ||
volumes: | ||
- db-data:/var/lib/postgresql/data | ||
steps: | ||
|
||
- name: Set up Go 1.21 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.21 | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get dependencies | ||
run: | | ||
go get -v -t -d ./... | ||
if [ -f Gopkg.toml ]; then | ||
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | ||
dep ensure | ||
fi | ||
- name: Test | ||
run: go test -v -coverprofile=./profile.cov ./... | ||
|
||
- uses: shogo82148/actions-goveralls@v1 | ||
with: | ||
path-to-profile: ./profile.cov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Temp folder | ||
/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
language: go | ||
|
||
sudo: false | ||
|
||
go: | ||
- tip | ||
|
||
before_install: | ||
- go get github.com/mattn/goveralls | ||
|
||
script: | ||
- $HOME/gopath/bin/goveralls -service=travis-ci | ||
|
||
services: | ||
- db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch echo server", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "debug", | ||
"program": "${workspaceFolder}/internal/examples/echo/main.go", | ||
"env": {}, | ||
"args": [] | ||
}, | ||
{ | ||
"name": "Launch net/http server", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "debug", | ||
"program": "${workspaceFolder}/internal/examples/nethttp/main.go", | ||
"env": {}, | ||
"args": [] | ||
}, | ||
] | ||
} |
Oops, something went wrong.