feat:add dev container
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
# Note: You can use any Debian/Ubuntu based image you want.
|
||||||
|
FROM mcr.microsoft.com/devcontainers/base:bullseye
|
||||||
|
|
||||||
|
# [Optional] Uncomment this section to install additional OS packages.
|
||||||
|
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||||
|
&& apt-get -y install --no-install-recommends \
|
||||||
|
bash \
|
||||||
|
curl \
|
||||||
|
jq
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
log_level = "INFO"
|
||||||
|
datacenter = "default_dc"
|
||||||
|
server = true
|
||||||
|
bootstrap_expect = 1
|
||||||
|
ui_config {
|
||||||
|
enabled = true
|
||||||
|
}
|
||||||
|
# we need this line to listen on 0.0.0.0
|
||||||
|
client_addr = "0.0.0.0"
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
// 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-outside-of-docker-compose
|
||||||
|
{
|
||||||
|
"name": "Docker from Docker Compose",
|
||||||
|
"dockerComposeFile": "docker-compose.yml",
|
||||||
|
"service": "app",
|
||||||
|
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
|
||||||
|
|
||||||
|
// Use this environment variable if you need to bind mount your local source code into a new container.
|
||||||
|
"remoteEnv": {
|
||||||
|
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}",
|
||||||
|
"WORKSPACE_FOLDER": "/workspaces/${localWorkspaceFolderBasename}"
|
||||||
|
},
|
||||||
|
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
|
||||||
|
"version": "latest",
|
||||||
|
"enableNonRootDocker": "true",
|
||||||
|
"moby": "false"
|
||||||
|
},
|
||||||
|
"ghcr.io/devcontainers/features/java:1": {
|
||||||
|
"version": "21"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
"forwardPorts": [
|
||||||
|
8080,
|
||||||
|
"rabbitmq:5672",
|
||||||
|
"rabbitmq:15672",
|
||||||
|
"consul:8500",
|
||||||
|
"keycloak:8000",
|
||||||
|
],
|
||||||
|
"postCreateCommand": "/bin/bash /workspaces/${localWorkspaceFolderBasename}/.devcontainer/setup.sh",
|
||||||
|
|
||||||
|
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||||
|
// "remoteUser": "root"
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
# Forwards the local Docker socket to the container.
|
||||||
|
- /var/run/docker.sock:/var/run/docker-host.sock
|
||||||
|
# Update this to wherever you want VS Code to mount the folder of your project
|
||||||
|
- ../..:/workspaces:cached
|
||||||
|
|
||||||
|
# Overrides default command so things don't shut down after the process ends.
|
||||||
|
entrypoint: /usr/local/share/docker-init.sh
|
||||||
|
command: sleep infinity
|
||||||
|
|
||||||
|
# Uncomment the next four lines if you will use a ptrace-based debuggers like C++, Go, and Rust.
|
||||||
|
# cap_add:
|
||||||
|
# - SYS_PTRACE
|
||||||
|
# security_opt:
|
||||||
|
# - seccomp:unconfined
|
||||||
|
|
||||||
|
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
|
||||||
|
# (Adding the "ports" property to this file will not forward from a Codespace.)
|
||||||
|
depends_on:
|
||||||
|
- rabbitmq
|
||||||
|
- consul
|
||||||
|
- keycloak
|
||||||
|
|
||||||
|
rabbitmq:
|
||||||
|
image: rabbitmq:4-management
|
||||||
|
hostname: "my-rabbit"
|
||||||
|
environment:
|
||||||
|
RABBITMQ_DEFAULT_USER: springuser
|
||||||
|
RABBITMQ_DEFAULT_PASS: TheCleverWho
|
||||||
|
volumes:
|
||||||
|
- "rabbitmq-data:/var/lib/rabbitmq"
|
||||||
|
|
||||||
|
consul:
|
||||||
|
image: hashicorp/consul:1.20
|
||||||
|
command:
|
||||||
|
- "agent"
|
||||||
|
- "-data-dir=/consul/data"
|
||||||
|
- "-config-file=/config/config.hcl"
|
||||||
|
environment:
|
||||||
|
- CONSUL_BIND_INTERFACE=eth0
|
||||||
|
volumes:
|
||||||
|
- "consul-data:/consul/data"
|
||||||
|
- "./consul-main-config.hcl:/config/config.hcl"
|
||||||
|
|
||||||
|
keycloak:
|
||||||
|
image: "quay.io/keycloak/keycloak:26.2.5"
|
||||||
|
networks:
|
||||||
|
default:
|
||||||
|
aliases:
|
||||||
|
- "keycloak.dev.localhost"
|
||||||
|
environment:
|
||||||
|
- KC_BOOTSTRAP_ADMIN_USERNAME=admin
|
||||||
|
- KC_BOOTSTRAP_ADMIN_PASSWORD=admin
|
||||||
|
- KC_HOSTNAME=http://keycloak.dev.localhost:8000
|
||||||
|
- KC_HOSTNAME_ADMIN=http://keycloak.dev.localhost:8000
|
||||||
|
- KC_HTTP_PORT=8000
|
||||||
|
command:
|
||||||
|
- start
|
||||||
|
# enable http, let reverse proxy handles the TLS
|
||||||
|
- --http-enabled=true
|
||||||
|
# take X-Forwarded-* headers from reverse proxy
|
||||||
|
- --proxy-headers=xforwarded
|
||||||
|
# hide node name in cookie for sticky session, we're using reverse proxy for that
|
||||||
|
# ref: https://www.keycloak.org/server/reverseproxy#_enable_sticky_sessions
|
||||||
|
- --spi-sticky-session-encoder-infinispan-should-attach-route=false
|
||||||
|
# read hostname from reverse proxy headers
|
||||||
|
- --hostname-strict=false
|
||||||
|
# Limit the request queue to prevent OOM
|
||||||
|
- --http-max-queued-requests=200
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
rabbitmq-data:
|
||||||
|
consul-data:
|
||||||
Submodule
+1
Submodule .devcontainer/identity-management added at 12d8e11f3b
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd ${WORKSPACE_FOLDER}/.devcontainer/identity-management/
|
||||||
|
|
||||||
|
./tools/setup-cli/setup-admin-cli.sh
|
||||||
|
sleep 10 # wait keycloak
|
||||||
|
./tools/login-admin/login-admin.sh -s=http://keycloak.dev.localhost:8000 -u=admin -p=admin
|
||||||
|
./tools/create-realm/create-realm.sh -n=clevermicro-dev
|
||||||
|
./tools/create-client/create-client.sh -r=clevermicro-dev -n=document-service
|
||||||
|
./tools/dev-realm/set-up.sh -r=clevermicro-dev
|
||||||
|
./tools/create-user/create-user.sh -r=clevermicro-dev -u=test -p=password -f=Jhon -l=Doe -e=jhon.doe@example.com
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule ".devcontainer/identity-management"]
|
||||||
|
path = .devcontainer/identity-management
|
||||||
|
url = ../identity-management.git
|
||||||
Reference in New Issue
Block a user