forked from Nfactor26/pixel-identity
-
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.
Run identity provider on docker with a reverse proxy
Added support for docker. Identity provider will run over http behind a reverse proxy ( traefik by default) with tls termination
- Loading branch information
Showing
19 changed files
with
457 additions
and
30 deletions.
There are no files selected for viewing
Empty file.
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,25 @@ | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/azds.yaml | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
LICENSE | ||
README.md |
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,20 @@ | ||
#Traefik router https://doc.traefik.io/traefik/routing/routers/ | ||
http: | ||
routers: | ||
traefik: | ||
rule: "Host(`traefik.docker.localhost`)" | ||
service: "api@internal" | ||
tls: | ||
domains: | ||
- main: "docker.localhost" | ||
sans: | ||
- "*.docker.localhost" | ||
- main: "domain.local" | ||
sans: | ||
- "*.domain.local" | ||
|
||
#Traefik TLS https://doc.traefik.io/traefik/https/tls/ | ||
tls: | ||
certificates: | ||
- certFile: "/etc/certs/pixel-cert.pem" | ||
keyFile: "/etc/certs/pixel-key.pem" |
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,41 @@ | ||
global: | ||
sendAnonymousUsage: false | ||
|
||
api: | ||
dashboard: true | ||
insecure: true | ||
|
||
# we define docker based and file based provider. | ||
providers: | ||
docker: | ||
endpoint: "unix:///var/run/docker.sock" | ||
watch: true | ||
exposedByDefault: false | ||
useBindPortIP: false | ||
httpClientTimeout: 30 | ||
network: pixel-network | ||
|
||
file: | ||
filename: /etc/traefik/config.yml | ||
watch: true | ||
|
||
log: | ||
level: INFO | ||
format: common | ||
|
||
accessLog: {} | ||
|
||
tracing: | ||
jaeger: {} | ||
|
||
entryPoints: | ||
http: | ||
address: ":80" | ||
http: | ||
# redirect any request on http to https | ||
redirections: | ||
entryPoint: | ||
to: https | ||
scheme: https | ||
https: | ||
address: ":443" |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk"> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectVersion>2.1</ProjectVersion> | ||
<DockerTargetOS>Linux</DockerTargetOS> | ||
<ProjectGuid>8f59da83-60f4-485a-b8c7-b17936ec00a2</ProjectGuid> | ||
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction> | ||
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}</DockerServiceUrl> | ||
<DockerServiceName>pixel.identity.provider</DockerServiceName> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<None Include="docker-compose.override.yml"> | ||
<DependentUpon>docker-compose.yml</DependentUpon> | ||
</None> | ||
<None Include="docker-compose.yml" /> | ||
<None Include=".dockerignore" /> | ||
</ItemGroup> | ||
</Project> |
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,120 @@ | ||
version: '3.4' | ||
|
||
services: | ||
|
||
reverse-proxy: | ||
# The official v2 Traefik docker image | ||
image: traefik:v2.5.4 | ||
container_name: pixel_identity_traefik | ||
restart: unless-stopped | ||
security_opt: | ||
- no-new-privileges:true | ||
# Enables the web UI and tells Traefik to listen to docker | ||
# command: --api.insecure=true --providers.docker --log.level=DEBUG | ||
labels: | ||
- "traefik.enable=true" | ||
# Use "traefik" router configuration defined into the dynamic config file: ./traefik/config.yml | ||
- "traefik.http.routers.traefik=true" | ||
#- "traefik.http.routers.reverse-proxy.middlewares=header-middleware@docker" | ||
#- "traefik.http.middlewares.header-middleware.headers.accesscontrolallowmethods=*" | ||
#- "traefik.http.middlewares.header-middleware.headers.accessControlAllowHeaders=*" | ||
#- "traefik.http.middlewares.header-middleware.headers.accessControlAllowCredentials=true" | ||
#- "traefik.http.middlewares.header-middleware.headers.accesscontrolalloworiginlist=https://identity.docker.localhost" | ||
ports: | ||
# The HTTP port | ||
- "80:80" | ||
# The Https port | ||
- "443:443" | ||
# The Web UI (enabled by --api.insecure=true) | ||
- "8080:8080" | ||
volumes: | ||
# So that Traefik can listen to the Docker events | ||
- /var/run/docker.sock:/var/run/docker.sock:ro | ||
# Map the static conf into the container | ||
- ./.traefik/traefik.yml:/etc/traefik/traefik.yml:ro | ||
# Map the dynamic conf into the container | ||
- ./.traefik/config.yml:/etc/traefik/config.yml:ro | ||
# Map the certificats into the container | ||
- ./.certificates:/etc/certs:ro | ||
networks: | ||
- pixel-network | ||
profiles: | ||
- proxy | ||
|
||
mongo: | ||
image: mongo:latest | ||
container_name: pixel_identity_mongo | ||
command: --auth | ||
restart: always | ||
volumes: | ||
- mongo-pixel-identiy-store:/data/db | ||
networks: | ||
- pixel-network | ||
environment: | ||
MONGO_INITDB_ROOT_USERNAME: mongoadmin | ||
MONGO_INITDB_ROOT_PASSWORD: mongopass | ||
#ports: | ||
# - 27017:27017 | ||
#labels: | ||
# - "traefik.enable=true" | ||
# - "traefik.http.routers.pixel-identity.rule=Host(`mongo.docker.localhost`)" | ||
profiles: | ||
- mongo | ||
|
||
mongo-express: | ||
image: mongo-express:latest | ||
container_name: pixel_identity_mongo_dashboard | ||
restart: always | ||
environment: | ||
ME_CONFIG_MONGODB_ADMINUSERNAME: mongoadmin | ||
ME_CONFIG_MONGODB_ADMINPASSWORD: mongopass | ||
ME_CONFIG_MONGODB_URL: mongodb://mongoadmin:mongopass@mongo:27017/ | ||
depends_on: | ||
- mongo | ||
labels: | ||
- "traefik.enable=true" | ||
- "traefik.http.routers.mongo-express.rule=Host(`mongo.docker.localhost`)" | ||
- "traefik.http.routers.mongo-express.tls=true" | ||
profiles: | ||
- mongo | ||
networks: | ||
- pixel-network | ||
|
||
pixel-identity: | ||
container_name: pixel_identity_provider | ||
environment: | ||
- ASPNETCORE_ENVIRONMENT=Development | ||
- ASPNETCORE_URLS=http://+ | ||
- MongoDbSettings:ConnectionString=mongodb://mongoadmin:mongopass@mongo:27017/ | ||
- IdentityHost=identity.docker.localhost | ||
- AllowedOrigins=https://identity.docker.localhost;http://identity.docker.localhost | ||
# Certificate settings when using https | ||
#- Kestrel:Certificates:Default:Path=/etc/certs/pixel-identity-cert.pem | ||
#- Kestrel:Certificates:Default:KeyPath=/etc/certs/pixel-identity-key.pem | ||
#depends_on: | ||
# - mongo | ||
#ports: | ||
# - "5050:80" | ||
# - "5051:443" | ||
volumes: | ||
#- ./.certificates:/etc/certs:ro | ||
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro | ||
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro | ||
labels: | ||
- "traefik.enable=true" | ||
- "traefik.http.routers.pixel-identity.rule=Host(`identity.docker.localhost`)" | ||
- "traefik.http.routers.pixel-identity.tls=true" | ||
#- "traefik.http.middlewares.header-middleware.headers.accesscontrolmaxage=100" | ||
#- "traefik.http.middlewares.header-middleware.headers.addvaryheader=true" | ||
#- "traefik.http.routers.pixel-identity.middlewares=test-redirectscheme" | ||
#- "traefik.http.middlewares.test-redirectscheme.redirectscheme.scheme=https" | ||
#- "traefik.http.middlewares.test-redirectscheme.redirectscheme.permanent=true" | ||
networks: | ||
- pixel-network | ||
|
||
volumes: | ||
mongo-pixel-identiy-store: | ||
|
||
networks: | ||
pixel-network: | ||
external: true |
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,9 @@ | ||
version: '3.4' | ||
|
||
services: | ||
|
||
pixel-identity: | ||
image: ${DOCKER_REGISTRY-}pixelidentityprovider | ||
build: | ||
context: . | ||
dockerfile: src/Server/Dockerfile |
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,16 @@ | ||
{ | ||
"profiles": { | ||
"Docker Compose": { | ||
"commandName": "DockerCompose", | ||
"composeLaunchAction": "LaunchBrowser", | ||
"composeLaunchServiceName": "pixel-identity", | ||
"composeLaunchUrl": "{Scheme}://identity.dashboard.local", | ||
"commandVersion": "1.0", | ||
"serviceActions": { | ||
"mongo": "StartWithoutDebugging", | ||
"pixel-identity": "StartDebugging", | ||
"reverse-proxy": "StartWithoutDebugging" | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,14 +1,15 @@ | ||
{ | ||
"PixelIdentityUI": { | ||
"Authority": "https://localhost:5001", | ||
"ClientId": "Pixel.Identity.UI", | ||
"Authority": "http://localhost:44382", | ||
"ClientId": "pixel-identity-ui", | ||
"DefaultScopes": [ | ||
"openid", | ||
"profile", | ||
"email" | ||
"email" | ||
], | ||
"RedirectUri": "https://localhost:5001/authentication/login-callback", | ||
"PostLogoutRedirectUri": "https://localhost:5001/authentication/logout-callback", | ||
"ResponseType": "code" | ||
"RedirectUri": "http://localhost:44382/authentication/login-callback", | ||
"PostLogoutRedirectUri": "http://localhost:44382/authentication/logout-callback", | ||
"ResponseType": "code", | ||
"ResponseMode": "query" | ||
} | ||
} |
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,24 @@ | ||
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. | ||
|
||
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base | ||
WORKDIR /app | ||
EXPOSE 80 | ||
#EXPOSE 443 | ||
|
||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build | ||
WORKDIR /src | ||
COPY ["src/Server/Pixel.Identity.Provider.csproj", "src/Server/"] | ||
COPY ["src/Client/Pixel.Identity.UI.Client.csproj", "src/Client/"] | ||
COPY ["src/Shared/Pixel.Identity.Shared.csproj", "src/Shared/"] | ||
RUN dotnet restore "src/Server/Pixel.Identity.Provider.csproj" | ||
COPY . . | ||
WORKDIR "/src/src/Server" | ||
RUN dotnet build "Pixel.Identity.Provider.csproj" -c Release -o /app/build | ||
|
||
FROM build AS publish | ||
RUN dotnet publish "Pixel.Identity.Provider.csproj" -c Release -o /app/publish | ||
|
||
FROM base AS final | ||
WORKDIR /app | ||
COPY --from=publish /app/publish . | ||
ENTRYPOINT ["dotnet", "Pixel.Identity.Provider.dll"] |
Oops, something went wrong.