Skip to content

Docker-compose definition#3

Open
ElevnLi wants to merge 19 commits into
usydfrom
usyd-docker-compose
Open

Docker-compose definition#3
ElevnLi wants to merge 19 commits into
usydfrom
usyd-docker-compose

Conversation

@ElevnLi
Copy link
Copy Markdown
Owner

@ElevnLi ElevnLi commented Dec 10, 2021

db and ui are working in this dev version, despite that the very long time ui container takes to start.

@ElevnLi
Copy link
Copy Markdown
Owner Author

ElevnLi commented Dec 10, 2021

Api server can be started but will stop after sometime and shows the following error:

leaf_api_demo | /usr/share/dotnet/sdk/3.1.415/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.DefaultItems.targets(151,5): warning NETSDK1080: A PackageReference to Microsoft.AspNetCore.App is not necessary when targeting .NET Core 3.0 or higher. If Microsoft.NET.Sdk.Web is used, the shared framework will be referenced automatically. Otherwise, the PackageReference should be replaced with a FrameworkReference. [/app/API/API.csproj]
leaf_api_demo | {"Timestamp":"2021-12-10T06:08:48.4204198+00:00","Level":"Information","MessageTemplate":"Starting Leaf's API v{Version}","Properties":{"Version":"3.9.1.0"}}
leaf_api_demo | {"Timestamp":"2021-12-10T06:08:49.4050657+00:00","Level":"Fatal","MessageTemplate":"UNSECURED authentication detected, Leaf is not secured by authentication!","Properties":{"SourceContext":"API.Startup"}}
leaf_api_demo | {"Timestamp":"2021-12-10T06:08:49.4313824+00:00","Level":"Fatal","MessageTemplate":"UNSECURED authorization detected, Leaf is not secured by authorization!","Properties":{"SourceContext":"API.Startup"}}
leaf_api_demo | {"Timestamp":"2021-12-10T06:08:49.5036543+00:00","Level":"Fatal","MessageTemplate":"API terminated unexpectedly","Exception":"Model.Options.LeafConfigurationException: LEAF_JWT_KEY_PW environment variable is missing\n   at API.Options.StartupExtensions.GetByProxy(IConfiguration configuration, String key) in /app/API/Options/StartupExtensions.Options.cs:line 92\n   at API.Options.StartupExtensions.ConfigureJwtOptions(IServiceCollection services, IConfiguration config) in /app/API/Options/StartupExtensions.Options.cs:line 135\n   at API.Options.StartupExtensions.ConfigureLeafOptions(IServiceCollection services, IConfiguration configuration, IHostingEnvironment environment) in /app/API/Options/StartupExtensions.Options.cs:line 69\n   at API.Startup.ConfigureServices(IServiceCollection services) in /app/API/Startup.cs:line 34\n   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)\n   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\n   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)\n   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)\n   at Microsoft.AspNetCore.Hosting.StartupLoader.ConfigureServicesDelegateBuilder`1.<>c__DisplayClass15_0.<BuildStartupServicesFilterPipeline>g__RunPipeline|0(IServiceCollection services)\n   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)\n   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)\n   at Microsoft.AspNetCore.Hosting.StartupLoader.ConfigureServicesDelegateBuilder`1.<>c__DisplayClass14_0.<ConfigureServices>g__ConfigureServicesWithContainerConfiguration|0(IServiceCollection services)\n   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)\n   at Microsoft.AspNetCore.Hosting.WebHost.EnsureApplicationServices()\n   at Microsoft.AspNetCore.Hosting.WebHost.Initialize()\n   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()\n   at API.Program.Main(String[] args) in /app/API/Program.cs:line 47"}
leaf_api_demo exited with code 1

@ablachair Can you have a look? It is more like a JWT key missing error, but I did add volumes and copied the keys into the container.

@ElevnLi
Copy link
Copy Markdown
Owner Author

ElevnLi commented Dec 10, 2021

This should be more readable
Screen Shot 2021-12-10 at 5 19 57 pm

@ElevnLi
Copy link
Copy Markdown
Owner Author

ElevnLi commented Dec 10, 2021

Screen Shot 2021-12-10 at 6 26 36 pm

Comment thread src/docker-compose.yml Outdated
- ./server:/app
- server-log:/logs
environment:
- LEAF_APP_DB=db,1433;Database=LeafDB;uid=sa;Password=Th3PA55--8zz
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like something in parsing this env var is splitting on =... You might want to run the container with bash to confirm the env vars.

@ElevnLi
Copy link
Copy Markdown
Owner Author

ElevnLi commented Dec 13, 2021

temporary readme:
put your keys directory under root
and run docker-compose -f docker-compose-dev.yml up

Comment thread src/db/build/Dockerfile
Comment thread src/docker-compose.yml Outdated
Comment thread src/docker-compose.yml Outdated
Comment thread src/docker-compose-dev.yml Outdated
Comment thread src/docker-compose.yml Outdated
Comment thread src/docker-compose-dev.yml Outdated
Comment on lines +16 to +33
server:
build: ./server
image: leaf_api
container_name: leaf_api_demo
ports:
- 5001:5001
volumes:
- ./server/keys:/.keys
- ./server:/app
- server-log:/logs
environment:
LEAF_APP_DB: "Server=db,1433;Database=LeafDB;uid=sa;Password=Th3PA55--8zz"
LEAF_CLIN_DB: "Server=db,1433;Database=TestDB;uid=sa;Password=Th3PA55--8zz"
LEAF_JWT_KEY_PW: "password"
networks:
- leaf
depends_on:
- db
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
server:
build: ./server
image: leaf_api
container_name: leaf_api_demo
ports:
- 5001:5001
volumes:
- ./server/keys:/.keys
- ./server:/app
- server-log:/logs
environment:
LEAF_APP_DB: "Server=db,1433;Database=LeafDB;uid=sa;Password=Th3PA55--8zz"
LEAF_CLIN_DB: "Server=db,1433;Database=TestDB;uid=sa;Password=Th3PA55--8zz"
LEAF_JWT_KEY_PW: "password"
networks:
- leaf
depends_on:
- db
db:
extends:
file: docker-compose.yml
service: server
volumes:
- ./server/keys:/.keys
- ./server:/app

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

services with 'depends_on' cannot be extended

Comment thread src/docker-compose-dev.yml Outdated
Comment on lines +35 to +49
ui-client:
build:
context: ./ui-client
dockerfile: Dockerfile-dev
container_name: leaf_ui
ports:
- 3000:3000
volumes:
- ./ui-client:/app
networks:
- leaf
stdin_open: true
depends_on:
- db
- server
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one we might define without extends? Or we could use extends if we serve both dev and prod versions on port 3000

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

services with 'depends_on' cannot be extended

@jnothman jnothman changed the title dev version Docker-compose definition Dec 17, 2021
Copy link
Copy Markdown
Collaborator

@jnothman jnothman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good!

Comment thread src/docker-compose-dev.yml Outdated
Comment on lines +19 to +27
environment:
- LEAF_APP_DB=${LEAF_APP_DB}
- LEAF_CLIN_DB=${LEAF_CLIN_DB}
- LEAF_JWT_KEY_PW=${LEAF_JWT_KEY_PW}
- UnsecuredIsAdmin=${UnsecuredIsAdminDev}
networks:
- leaf
depends_on:
- db
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this all with extends?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"services with 'depends_on' cannot be extended"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they will need to be in a separate "common services" file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants