decider icon indicating copy to clipboard operation
decider copied to clipboard

Deployment with docker

Open gso-trifork-security opened this issue 1 year ago • 21 comments

💡 Summary

The project is nice, but I think a Docker Image/deployment method is missing.

Motivation and context

The current deployment is inconvenient and is not fitting well in a production environment.

gso-trifork-security avatar Mar 03 '23 12:03 gso-trifork-security

Hello @gso-trifork-security!

Agreed.

Deployment is currently unwieldly and Dockerization is underway internally. Tentatively shooting for next week to have it ready.

damionmounts avatar Mar 03 '23 17:03 damionmounts

What is the error when I try to log in

500 Internal Server Error

You should probably login... logged-out users can only access the login page anyway

sergeymeleschenko avatar Mar 06 '23 09:03 sergeymeleschenko

Feel free to post error details in the issue thread - I can look at them later (I'll be on later, looking at Docker).

The Admin Guide is the ground truth of install instructions and following the steps from there (versus the readme) might help you out.

Admin Guide Link: https://github.com/cisagov/decider/blob/develop/Decider_Admin_Guide_v1.0.0.pdf

It is also in the root of the repo

damionmounts avatar Mar 07 '23 19:03 damionmounts

Totally agree, the docker deployment would be super beneficial.

RaulSokolova avatar Mar 08 '23 14:03 RaulSokolova

Where is the decider.tar.gz anyway. I can see the develop.zip but not the file referenced in the Admin Guide. What am I missing.

MHMDhub avatar Mar 09 '23 16:03 MHMDhub

@MHMDhub While decider.tar.gz is not present - it is the same as develop.zip or cloning the repo via Git.

damionmounts avatar Mar 09 '23 19:03 damionmounts

Still working on finishing up macOS M1 deployment - but Docker is working just fine on Linux and Windows!

damionmounts avatar Mar 10 '23 13:03 damionmounts

@damionmounts outstanding work! Ill give it a try and provide a feedback

RaulSokolova avatar Mar 10 '23 13:03 RaulSokolova

@damionmounts outstanding work! Ill give it a try and provide a feedback

It's good news. When I can try deployment with docker on Linux?

sergeymeleschenko avatar Mar 10 '23 14:03 sergeymeleschenko

@damionmounts outstanding work! Ill give it a try and provide a feedback

It's good news. When I can try deployment with docker on Linux?

I tried the docker on MacOS Ventura (Intel arch) and I get:

 => => transferring context: 2B                                                                                                0.0s
 => [decider-db internal] load .dockerignore                                                                                   0.0s
 => => transferring context: 2B                                                                                                0.0s
 => ERROR [decider-web internal] load metadata for docker.io/library/python:3.8-bullseye                                       0.4s
 => ERROR [decider-db internal] load metadata for docker.io/library/postgres:14-alpine                                         0.4s
------
 > [decider-web internal] load metadata for docker.io/library/python:3.8-bullseye:
------
------
 > [decider-db internal] load metadata for docker.io/library/postgres:14-alpine:
------
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: rpc error: code = Unknown desc = error getting credentials - err: exit status 1, out: ```

Hope that helps people knowing more about docker than me.

Cyoux avatar Mar 10 '23 14:03 Cyoux

The docker-compose for the deployment, its already published in the branch.

https://github.com/cisagov/decider/blob/develop/docker-compose.yaml

RaulSokolova avatar Mar 10 '23 14:03 RaulSokolova

I tried the docker on MacOS Ventura (Intel arch) and I get:

(...)

failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: rpc error: code = Unknown desc = error getting credentials - err: exit status 1, out: ```

Solution was to edit ~/.docker/config.json and rename "credsStore": "desktop" to "credStore": "desktop"

Cyoux avatar Mar 10 '23 15:03 Cyoux

You might have missed the previous comment from [damionmounts], they are still working on the Mac deployment.

RaulSokolova avatar Mar 10 '23 15:03 RaulSokolova

@damionmounts getting this error "2023-03-10 18:03:24.035 UTC [43] FATAL: database "decider" does not exist"

RaulSokolova avatar Mar 10 '23 18:03 RaulSokolova

For All: Docker instructions and current testing progress are in the README, but this is the start point:

git clone https://github.com/cisagov/decider.git
cd decider
cp .env.example .env
[sudo] docker compose up

sudo only on Linux


  • macOS is still in progress (took a nap earlier but want to sort this before the weekend 🤔)
  • @RaulSokolova Have any more of the surrounding log lines?
    • I wonder why it isn't creating the DB.
    • The database name gets passed to the Postgres container via env (so it seems to be an init issue)

damionmounts avatar Mar 10 '23 19:03 damionmounts

@Cyoux Have any further success after this solution?

Solution was to edit ~/.docker/config.json and rename "credsStore": "desktop" to "credStore": "desktop"

  • I was running into the same error output at the start.
  • I still need to take a look at the config file to see if mine is wrong as well.
  • I may have just chown'd some files to get compose itself working.
    • The actual issue is just a Postgres Connection Auth config issue (pg_hba.conf)
      • Defaults to scram-sha-256, but the app doesn't support that.
      • Will change to md5 perhaps.

damionmounts avatar Mar 10 '23 19:03 damionmounts

@damionmounts it worked fine in Linux, but in WSL is where I'm facing the issue.

RaulSokolova avatar Mar 10 '23 19:03 RaulSokolova

@RaulSokolova WSL 1 or 2? I always used a VM so I barely touched WSL before. Docker Desktop on Windows (when you don't have HyperV), will prompt for WSL 2 install and then uses that transparently.

damionmounts avatar Mar 10 '23 19:03 damionmounts

WSL2

RaulSokolova avatar Mar 10 '23 19:03 RaulSokolova

🚀 macOS should be a go 🚀 would love to hear any issues people run into

  • Auth will now always use md5 - (which is supported without issue versus scram-sha-256).
  • 8001 is the new port as mac's ControlCenter was bound to 5000 & 7000.
  • Changed Postgres's data local folder mount back to a Docker volume for compatibility.

damionmounts avatar Mar 10 '23 21:03 damionmounts

@Cyoux Have any further success after this solution?

Solution was to edit ~/.docker/config.json and rename "credsStore": "desktop" to "credStore": "desktop" * I was running into the same error output at the start.

I can confirm that - with the current config you pushed - MacOS is a 🚀 GO 🚀

For more details: I have Docker Desktop installed, MacOS Ventura 13.2.1 with Intel core.

Cyoux avatar Mar 12 '23 09:03 Cyoux

Closing as Docker deployment is now supported.

Will of course tend to any newly-created deployment issues. There could always be edge-cases of OS/Arch that don't work

damionmounts avatar Mar 14 '23 05:03 damionmounts