CarnegieLearningWeb / UpGrade

Framework for adding A/B testing to education applications
https://www.upgradeplatform.org/
BSD 3-Clause "New" or "Revised" License
26 stars 13 forks source link

Local Docker Setup commands not working after new changes to it #295

Closed ppratikcr7 closed 2 years ago

ppratikcr7 commented 2 years ago

We tried setting up local docker setup at our end in multiple systems. We are facing the below issues:

  1. The commands make setup-local and even new command stated by @danoswaltCL which is make setup doesn't seem to work to install the npm modules. When I checked through the Makefile in dev branch, there is no command for setup, instead we still have setup-local which we had before nix changes and that time it was working for me. Can @kawcl or @danoswaltCL verify at their ends and let us know. (For now we are running npm ci commands manually in all folder locations to install packages )

image

  1. We see 2 errors (frontend and backend error) while running the make command to generate all the docker images and start them. Though, I don't know if they are affecting some functionality or not.

image (1)

  1. This is my system specific, I am not able to view logs on right clicking container and selecting View Logs with the error: docker command not found. Though it works for yashil. Any help on this may be a plus for me.

Screenshot 2022-03-03 at 11 53 37 AM

kawcl commented 2 years ago

hey @ppratikcr7,

Issue 1

Issue 2

Issue 3

jerith666 commented 2 years ago

I'm contemplating using docker again for this step to run nix in a container for this step so people wouldn't need to explicitly install it, but I need to work on that.

Interesting idea. I'd rather require only nix (and use nix to get docker), but that might not be possible since docker requires a daemon to be running.

ppratikcr7 commented 2 years ago

@kawcl Thanks for the clarifications, let us try as per your comments. We will get back in case we still face any issue.

danoswaltCL commented 2 years ago

on point 3, it is probably issue with it finding docker in PATH, which docker can show where it's installed, could echo $PATH to see if that PATH seems reachable.

Other thing to try would be to open up the docker desktop app, all same things are going to be found there, that's where I tend to look at the logs anyway, and some things I see googling tdocker command not found seem to suggest that after opening the docker app the first time, in background it fixed the PATH issue and docker commands worked as expected.

kawcl commented 2 years ago

I'm contemplating using docker again for this step to run nix in a container for this step so people wouldn't need to explicitly install it, but I need to work on that.

Interesting idea. I'd rather require only nix (and use nix to get docker), but that might not be possible since docker requires a daemon to be running.

Yea I'm not sure which direction would be best.. Have nix maintain the dependencies and run the docker containers or have docker run and manage nix which manages the dependencies. There is a docker image for nix but a quick search for how to use it properly hasn't proven that fruitful. I have, however, found a source for running docker containers with nix

I'd like to make it so you only need to install either-or on your machine instead of both.

I have to take a break from this though to focus on some other work right now, I'll try and revisit it soon.

ppratikcr7 commented 2 years ago

@kawcl Thanks, installing Nix did work for me, I am able to run make setup-local now.

Let me know if this issue should be closed if we don't want anything else to be discussed here on this ticket, else it's fine if we continue to discuss further on Nix.

ppratikcr7 commented 2 years ago

@danoswaltCL I will check with your resolution and let you know. Thanks :)

ppratikcr7 commented 2 years ago

@kawcl We also observed a weird behaviour of docker script where it creates the containers with a different name. For e.g.: Instead of upgrade-postgres-1 the container name is upgrade_postgres_1. So, we have to change the environment variable in the local docker env file: TYPEORM_HOST=upgrade-postgres-1. Any idea about this inconsistency?

danoswaltCL commented 2 years ago

@ppratikcr7

Yes we noticed before and we should document it, this is likely the issue where in docker setting Use Docker Compose V2 needs to be toggled on:

image

That will make it consistent with using hyphens and not underscores.

kawcl commented 2 years ago

@ppratikcr7 Dan would be correct on this, depending on which version of compose you are using it append names differently with "_" or "-"

ppratikcr7 commented 2 years ago

Okay, thanks. Yeah, we should document all this thing in our Upgrade documentation.

ppratikcr7 commented 2 years ago

@kawcl @danoswaltCL Should we close this issue?