Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker support #121

Closed
NTurakulov opened this issue Nov 23, 2018 · 11 comments
Closed

Docker support #121

NTurakulov opened this issue Nov 23, 2018 · 11 comments
Assignees
Labels
help wanted Extra attention is needed priority: high task Task

Comments

@NTurakulov
Copy link

Hey guys!
I tried to pack the project into docker to make it easy to deploy and faced some problems, maybe some one could help here. Changes published to docker branch

Requirement
Make it easy to deploy Identity Server Admin to use it in different apps as a part of micro service architecture. I saw somewhere in the feed that @skoruba planned to pack the project into NuGet but I think docker another way to make it portable

Solution
Pack the project (Admin and STS) into docker images and run them at any time with required port inside your cluster

Implementation
I added two Dockerfiles in target project folders, docker-compose.yml in root plus several powershell scripts in the folder with same name. It works but made dummy. To start run containers - run 'run-docker.ps1' script or execute commands from it one by one (for non-Windows platforms).

SQL server is also packed into an image and run as a part of compose with persistent external volume (skoruba-identityserver-sql). All three containers (SQL, STS, Admin) work within same docker network (skoruba-identityserver-network) and can interact with each other

Note

  • Admin project port 80 is mapped to host's port 5001 instead of 9000
  • MS SQL container's port 1433 is mapped to host's 14333! This made for compatibility with MS SQL instance on the host

Problems

  • Dependency projects are not packed as NuGet and cannot be restored with 'dotnet restore'. Because of that instead of using single multi step Dockerfile I build it on host then just copy to aspnetcore-runtime image. This can be solved with modified Dockerfile which copies 'bin' folder with dependencies but prebuild on host is required anyway. Also projects use 'npm install' which is not preinstalled into default aspnetcore-sdk build image.
    • As dotnet CLI calls required before 'docker build' they're packed into build-docker-*.ps1 scripts
  • I've added DockerRelease config file with overriden parameters but they don't apply so duplicated in docker-compose.yml and passed with 'environment'
  • While STS and Admin containers can use short docker-compose.yml service names when reference to sql container successfully I can't access to sts/.well-known/openid-configuration from within Admin project
  • Don't know how to apply EF migrations from within container. Before building docker image DbContext reference to host DB, after running a container not sure how to do that. Maybe something like 'EXEC dotnet ef database update'? Need to try this way
  • Both projects are configured to run in 'Development' environment because certificate for HTTPS is not set up
@NTurakulov
Copy link
Author

Accidentally I pushed changes into branch in my fork. I guess there should be a way to cherry pick them here?

@skoruba skoruba self-assigned this Nov 27, 2018
@skoruba
Copy link
Owner

skoruba commented Nov 27, 2018

Hi @NTurakulov
Thank you for your effort to run this admin in docker. I don't have any experience with docker yet.
How can I help you with better preparing this project to running in docker?
Thanks!

@skoruba skoruba added help wanted Extra attention is needed task Task labels Nov 27, 2018
@NielsOldenburg
Copy link

Hey Guys,
we are on the verge of trying something similar. Unfortunately i'm just starting to work with docker, so right now i might not be the best judge for this, but our software architect told me that splitting your solution in two different repos would make it easier to put the id4 server and the administration service in two different docker containers.

So far i have forked your repo and split it up, but that increases the complexity. Maybe a first step could be to split your solution up @skoruba . @NTurakulov since you are obviously more experienced with docker, would that help or is there a way to run both, the id4 server and the admin service from the same container?

I'll get back to you once i get my basic docker experiments runnning.

@skoruba
Copy link
Owner

skoruba commented Dec 27, 2018

@Seaear - add support for docker - #132 - please take a look.
Thanks!

@brinehart
Copy link

So it looks like this functionality was merged. Should the main readme be updated to check off the Docker Support box and add instructions to run the project with Docker?

@skoruba
Copy link
Owner

skoruba commented Jan 9, 2020

For sure, I am working on it.

@brinehart
Copy link

Please let me know if you would like any help on that.

@skoruba
Copy link
Owner

skoruba commented Jan 24, 2020

I am closing this issue, it was released in master branch.

@skoruba skoruba closed this as completed Jan 24, 2020
@skoruba skoruba unpinned this issue Jan 25, 2020
@thylux
Copy link

thylux commented Feb 15, 2020

Hi, I'm trying to run a demo from source using docker compose on Visual Studio but I can't login because login on database failed.
Isn't this supposed to work without changing configuration?

If not maybe I can help to complement the documentation for that.

image

@thylux
Copy link

thylux commented Feb 15, 2020

So far I can see that there is connectivity between the 3 docker instances and that the login settings all match up.

image

image

image

image

@thylux
Copy link

thylux commented Feb 17, 2020

Well, I tried again today and without any change all is working!

Off and On again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed priority: high task Task
Projects
None yet
Development

No branches or pull requests

5 participants