-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: migrate to devcontainer for development environment
Signed-off-by: Husen <[email protected]>
- Loading branch information
Showing
17 changed files
with
285 additions
and
296 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,8 @@ | ||
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04 | ||
|
||
ENV HOME=/home/vscode | ||
|
||
# Install dependencies | ||
RUN sudo apt-get update | ||
RUN curl -sS https://starship.rs/install.sh | sh -s -- --yes | ||
RUN echo 'eval "$(starship init bash)"' >> $HOME/.bashrc |
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,21 @@ | ||
{ | ||
"name": "Playground", | ||
"dockerComposeFile": "./docker-compose.yml", | ||
"service": "app", | ||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", | ||
"overrideCommand": true, | ||
"shutdownAction": "stopCompose", | ||
"features": { | ||
"ghcr.io/devcontainers/features/go:1": { | ||
"version": "1.22" | ||
}, | ||
"ghcr.io/devcontainers/features/node:1": { | ||
"version": "20" | ||
} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": ["EditorConfig.EditorConfig", "dbaeumer.vscode-eslint", "esbenp.prettier-vscode", "svelte.svelte-vscode", "golang.go", "Grafana.vscode-jsonnet", "redhat.vscode-yaml", "ionutvmi.path-autocomplete", "GitHub.vscode-github-actions"] | ||
} | ||
} | ||
} |
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,210 @@ | ||
version: '3.8' | ||
|
||
services: | ||
app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
volumes: | ||
- ../:/workspaces:cached | ||
command: sleep infinity | ||
networks: | ||
- playground | ||
|
||
postgres: | ||
image: docker.io/library/postgres:16-alpine | ||
ports: | ||
- '${DB_PORT:-5432}:5432' | ||
volumes: | ||
- 'postgres-data:/var/lib/postgresql/data' | ||
environment: | ||
POSTGRES_USER: ${DB_USERNAME:-postgres} | ||
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres} | ||
POSTGRES_DB: ${DB_DATABASE:-postgres} | ||
healthcheck: | ||
test: | ||
[ | ||
'CMD', | ||
'pg_isready', | ||
'-q', | ||
'-d', | ||
'${DB_USERNAME:-postgres}', | ||
'-U', | ||
'${DB_PASSWORD:-postgres}', | ||
] | ||
retries: 3 | ||
timeout: 5s | ||
networks: | ||
- playground | ||
|
||
redis: | ||
image: docker.io/library/redis:7-alpine | ||
ports: | ||
- '${REDIS_PORT:-6379}:6379' | ||
volumes: | ||
- 'redis-data:/data' | ||
healthcheck: | ||
test: ['CMD', 'redis-cli', 'ping'] | ||
retries: 3 | ||
timeout: 5s | ||
networks: | ||
- playground | ||
|
||
minio: | ||
image: docker.io/minio/minio | ||
ports: | ||
- '${S3_PORT:-9000}:9000' | ||
- '${S3_CONSOLE_PORT:-8900}:8900' | ||
volumes: | ||
- 'minio-data:/data/minio' | ||
environment: | ||
MINIO_ROOT_USER: ${S3_ACCESS_KEY_ID:-miniosudo} | ||
MINIO_ROOT_PASSWORD: ${S3_SECRET_ACCESS_KEY:-miniosudo} | ||
command: minio server /data/minio --console-address ":8900" | ||
healthcheck: | ||
test: ['CMD', 'curl', '-f', 'http://127.0.0.1:9000/minio/health/live'] | ||
retries: 3 | ||
timeout: 5s | ||
networks: | ||
- playground | ||
|
||
minio-client: | ||
image: docker.io/minio/mc | ||
depends_on: | ||
- minio | ||
entrypoint: > | ||
/bin/sh -c " | ||
/usr/bin/mc config host add myminio http://minio:9000 ${S3_ACCESS_KEY_ID:-miniosudo} ${S3_SECRET_ACCESS_KEY:-miniosudo}; | ||
/usr/bin/mc rm -r --force myminio/local; | ||
/usr/bin/mc mb myminio/local; | ||
/usr/bin/mc policy set download myminio/local; | ||
exit 0; | ||
" | ||
networks: | ||
- playground | ||
|
||
# mailhog: | ||
# image: docker.io/mailhog/mailhog:v1.0.0 | ||
# ports: | ||
# - '${MAILHOG_PORT:-1025}:1025' | ||
# - '${MAILHOG_DASHBOARD_PORT:-8025}:8025' | ||
# volumes: | ||
# - ../config:/.config | ||
# environment: | ||
# - MH_AUTH_FILE="/.config/mailhog/auth" | ||
# networks: | ||
# - playground | ||
|
||
mailslurper: | ||
image: docker.io/oryd/mailslurper:latest-smtps | ||
ports: | ||
- '4436:4436' | ||
- '4437:4437' | ||
networks: | ||
- playground | ||
|
||
postgres-kratos: | ||
image: docker.io/library/postgres:16-alpine | ||
ports: | ||
- '${DB_PORT:-5431}:5432' | ||
volumes: | ||
- 'kratos-postgres:/var/lib/postgresql/data' | ||
environment: | ||
POSTGRES_USER: ${DB_USERNAME:-postgres} | ||
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres} | ||
POSTGRES_DB: ${DB_DATABASE:-postgres} | ||
healthcheck: | ||
test: | ||
[ | ||
'CMD', | ||
'pg_isready', | ||
'-q', | ||
'-d', | ||
'${DB_USERNAME:-postgres}', | ||
'-U', | ||
'${DB_PASSWORD:-postgres}', | ||
] | ||
retries: 3 | ||
timeout: 5s | ||
networks: | ||
- playground | ||
|
||
kratos-migrate: | ||
image: docker.io/oryd/kratos:v1.0.0 | ||
depends_on: | ||
- postgres-kratos | ||
environment: | ||
- DSN=postgres://postgres:postgres@postgres-kratos:5432/postgres?sslmode=disable&max_conns=20&max_idle_conns=4 | ||
volumes: | ||
- type: bind | ||
source: ../config/kratos/email-password | ||
target: /etc/config/kratos | ||
command: -c /etc/config/kratos/kratos.yml migrate sql -e --yes | ||
restart: on-failure | ||
networks: | ||
- playground | ||
|
||
kratos: | ||
image: docker.io/oryd/kratos:v1.0.0 | ||
depends_on: | ||
- kratos-migrate | ||
ports: | ||
- '4433:4433' # public | ||
- '4434:4434' # admin | ||
restart: unless-stopped | ||
environment: | ||
- DSN=postgres://postgres:postgres@postgres-kratos:5432/postgres?sslmode=disable&max_conns=20&max_idle_conns=4 | ||
- LOG_LEVEL=trace | ||
- SERVE_PUBLIC_BASE_URL=http://127.0.0.1:4455/.ory/kratos/public/ | ||
command: serve -c /etc/config/kratos/kratos.yml --dev --watch-courier | ||
volumes: | ||
- type: bind | ||
source: ../config/kratos/email-password | ||
target: /etc/config/kratos | ||
networks: | ||
- playground | ||
|
||
kratos-selfservice-ui-node: | ||
image: docker.io/oryd/kratos-selfservice-ui-node:v0.13.0-20 | ||
depends_on: | ||
- kratos | ||
restart: on-failure | ||
ports: | ||
- 4435:4435 | ||
environment: | ||
- PORT=4435 | ||
- KRATOS_BROWSER_URL=http://127.0.0.1:4455/.ory/kratos/public | ||
- JWKS_URL=http://oathkeeper:4456/.well-known/jwks.json | ||
- SECURITY_MODE=jwks | ||
- COOKIE_SECRET=playground12345 | ||
- CSRF_COOKIE_NAME=__locahost-example.com-x-csrf-token | ||
- CSRF_COOKIE_SECRET=playground12345 | ||
- KRATOS_PUBLIC_URL=http://kratos:4433/ | ||
networks: | ||
- playground | ||
|
||
oathkeeper: | ||
image: docker.io/oryd/oathkeeper:v0.40.6 | ||
depends_on: | ||
- kratos | ||
ports: | ||
- 4455:4455 | ||
- 4456:4456 | ||
command: | ||
serve proxy -c "/etc/config/oathkeeper/oathkeeper.yml" | ||
environment: | ||
- LOG_LEVEL=debug | ||
restart: on-failure | ||
networks: | ||
- playground | ||
volumes: | ||
- ../config/oathkeeper:/etc/config/oathkeeper | ||
|
||
volumes: | ||
postgres-data: | ||
redis-data: | ||
minio-data: | ||
kratos-postgres: | ||
kratos-sqlite: | ||
networks: | ||
playground: |
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
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 |
---|---|---|
|
@@ -6,3 +6,5 @@ | |
|
||
# Dependency directories | ||
node_modules | ||
|
||
*.pnpm-store |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# templates | ||
|
||
- JWT authentification (with refresh token) | ||
- JWT authentification (with refresh token). |
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
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
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
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
10 changes: 10 additions & 0 deletions
10
config/kratos/email-password/hooks/after-profile-setting.jsonnet
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 @@ | ||
function(ctx) { | ||
data: { | ||
type: "users", | ||
attributes: { | ||
first_name: ctx.identity.traits.name.first, | ||
last_name: ctx.identity.traits.name.last, | ||
email: ctx.identity.traits.email, | ||
} | ||
} | ||
} |
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
Oops, something went wrong.