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

Failed to build the image #12

Open
sorcererstone opened this issue May 20, 2020 · 14 comments
Open

Failed to build the image #12

sorcererstone opened this issue May 20, 2020 · 14 comments

Comments

@sorcererstone
Copy link

sorcererstone commented May 20, 2020

There are environment variables defined in docker-compose.yml file. I used the example in the dotenv file in docs/example. I got the following errors and failed to build the docker image.

==> default: The Compose file '/vagrant/docker-compose.yml' is invalid because:
==> default: services.c19-backend.ports contains an invalid type, it should be an array
==> default: services.ehrbase.ports contains an invalid type, it should be an array
==> default: services.testprovider.ports contains an invalid type, it should be an array
The following SSH command responded with a non-zero exit status.

What should the above proper array values be?
Attached is my docker-compose.yml and the error screenshot
BuildError
docker-compose.env.txt
docker-compose.yml.txt

@paulb-smartit
Copy link

paulb-smartit commented May 21, 2020

You can't comment out the ports and leave the ports: directive live. Comment out the whole section or remove it, eg.

    # ports:
    #  - ${C19_BACKEND_PORT}:8000

The ports should be replaced with the ports you want exposed to the outside world. Add the missing $VARIABLES into the docker-compose.env and set them to ports that don't clash with ones you may already be using. These are then used by you frontend proxy to direct traffic to the app.

@sorcererstone
Copy link
Author

sorcererstone commented May 21, 2020

Thank. My mistake. I've commented out the "port" statements and rerun the compose file. But now I have authorization problem. Please refer to screenshots. Can you please suggested how I can overcome this authorization problem?
Also, in the "../docs/examples/" directory, there is a file named "fixtures.json". What is the use case for this file?
Thanks in advance.

UnauthorizedAccess

@paulb-smartit
Copy link

paulb-smartit commented May 22, 2020

Ok, I went through your reworked docker-compose and can't really understand why you're changing it at all just to put things into a docker-compose.env file.

Personally I'd just leave the docker-compose.yml alone and create a .env file that contains the variables that you need/want to change. It will get read in automatically and then you can be sure it contains the vital stuff needed for the container set to run.

You will need it to expose ports and the ports are specified in the original compose file and shouldn't need changing.

The authentication error is because you are trying to pull directly from the quay.io repository and that doesn't actually contain the required image. I don't know why and it seems a strange thing to do, but you must build the image locally and it just so happens to be called quay.io/opusvl/c19 - so I understand the confusion - it got me when I looked at it :D

So you must follow the steps in the readme to build the image by

cd c19-backend
docker build -t quay.io/opusvl/c19:dev .

This will then build the docker image in your local cache, again with the misleading name, but it will work. Then it wont try to pull the image from quay.io.

HTH

@sorcererstone
Copy link
Author

Sorry for the delay.
I did not use .env file route because the build failed to register any of the environment variables listed in the .env file. I rebuilt the compose file to generate a screenshot for your reference. But this is a minor issue. The problem went away if I renamed the file to something else (in my case, docker-compose.env) and call this env file from the docker-compose.yml explicitly as shown in my previously attached docker-compose.yml.
It is my bad that I didn't read the "Read-Me" file. I followed the instruction and built the ehrbase module. Then, the next step (for the Screening application) is to clone the repo from AppertaFoundation: git clone [email protected]:AppertaFoundation/COVID-19-screening-interface.git
But I got an access error. Screenshot attached.
Can you suggest how I can overcome this access issue: "[email protected]: Permission denied (publickey)"
Thanks in advance.
Covid-19ScreeningPage_EnvVariablesErrors
Failure2ReadRemoteDir

@paulb-smartit
Copy link

I don't know what the issue would be for the git clone as the repo is open.

Try cloning it using the https version as there could be something on the way causing authentication issues.

git clone https://github.com/AppertaFoundation/COVID-19-screening-interface.git

As you're also doing this inside vagrant I'm not sure of any special handling for .env, but I'd certainly consider not using an external environment file for test and use the docker-compose as downloaded. This way you can be sure not to have missed a variable. You could add the defaults to all the ${} variables though, using the :- syntax, eg:

environment:
      DJANGO_POSTGRES_USER: ${DJANGO_POSTGRES_USER:-postgres}
      DJANGO_POSTGRES_PASSWORD: ${DJANGO_POSTGRES_PASSWORD:-postgres}
      DJANGO_POSTGRES_DB: ${DJANGO_POSTGRES_DB:-postgres}
   ...

At least that way it won't matter about a missing .env file, until you're happy it works and revisit it later.

That said I'm only a visitor this repo myself. The development on the c19-backend sits within our organisation and I thought I could at least help with getting that going in docker.

@sorcererstone
Copy link
Author

I am using Vagrant because I use Windows OS and one of the Github projects I am toying with have problems running in Windows environment (even when I used Docker for Windows.) So, I switched everything using Vagrant's route.
Affirmative. For the cloning the Screen Interface, I have to use the https route you suggested. It worked. Thank you.
I was able to build the frontend, backend, baseopenEHR. But when I build the frontend (the yarn install part), I saw some warnings. I am not sure they are critical or not. Attached (YarnBuildProblems06.jpg)

Wrt to environment variables. I looked at what you said and I decided the problem most likely originate from Vagrant side (although I have no issues running docker project using docker compose with .env and vagrantfile). So, following what you suggested, I used the original compose script and .env file the way it is intended to use and run the docker compose up command inside the Ubuntu VM (in the respective directory).
But the build cycles repeatedly over and over. I took a random screen capture. The build seems to choke on opening a certain file. Screen capture attached (C19ScreeningBuildError.jpg)

Any idea what this is about? And how to resolve this issue?
Also, even if I can compile successfully with the above docker compose file, what is the URL that I should use in order to access this app? Is it something that looks like: openEHR CKM : https://ckm.openehr.org/ckm/incubators/1013.30.80 as referenced on the home page for this app.

Thank you for your help.

C19ScreeningBuildError
YarnBuildProblems06

@paulb-smartit
Copy link

Sorry, but this is where my knowledge of EHR ends. I can build containers and get it running, but the internal machinations are out of my field and as far as usage, well that's even further from my comfort zone.

Ahh, wait a moment. The pg_wal issue - I can't be certain but we couldn't get this built on Azure because the underlying OS is windows and windows doesn't have the same permissions capability as Linux. This cause others with more knowledge of Azure than I to give up and go for a separate instance of postgres. I'm hoping that isn't something you're struggling with here.

I do know that using virtualisation like virtual box or vmware with an install of Debian will allow this to run as expected though.

@sorcererstone
Copy link
Author

Paul. Thank you for the response.
Yes, as seen from the screen capture, my current problem is with file accessing problem as shown in the error “pg_wal”. I googled and am zeroing in on this issue now.

Just curiously so that I won’t get down the same rabbit hole in the future, did your group move from Azure to AWS or Google Cloud to solve/circumvent the above “pg_wal” access issue?

About the Readme file:
In the session for On Screening application, “Clone this repo”, the instruction is incomplete:

cd COVID-19-screening-interface/frontend/

What do user do once inside this frontend folder? Readme file didn’t say!
Do you know the missing procedures?
I see a package.json file plus 2 others and a bunch of sub-folders within this directory.

Also, the important question is even if I solve all the issues I am experiencing with this project on my laptop,

How & where do I access the UI page to see how this screening page looks like and how it works?

The Readme page and the main page did not say anything about it. On the main page, instruction ends at "yarn start"
What URL did you use to access the screening page for this app?

I am using this app to understand openEHR protocol & see how it is being used in a use case. Hence this project.

Thanks in advance.

@StuartJMackintosh
Copy link
Member

As an update - we are in the process of securing further funding to continue with this project and expect to develop to completion over the next couple of months. We will announce as soon as everything is in place.

@paulb-smartit
Copy link

paulb-smartit commented Jun 2, 2020

Just by way of clarity, this is where the Azure issue was highlighted for us, thanks to John Meredith of NWIS - https://www.archetextur.es/setting-up-openehr-in-azure-ii-this-time-its-painful/

@sorcererstone
Copy link
Author

Paul, thanks for the link.
That's a definitive rap sheet on MS.
I am moving away from Windows soon.
But at the mean time, can you please inform me when you got the app build, how did you access the UI? Any specific URL?
Also, I mentioned in my early response today a possibility of missing steps (or possible incomplete section) in the instructions for the frontend section. Any idea what the instruction wants us to do once inside the frontend directory?

@sorcererstone
Copy link
Author

Hey Stuart, can you give me info on how to access the UI of this app at its current state?

@paulb-smartit
Copy link

paulb-smartit commented Jun 3, 2020

Paul, thanks for the link.
That's a definitive rap sheet on MS.
I am moving away from Windows soon.
But at the mean time, can you please inform me when you got the app build, how did you access the UI? Any specific URL?
Also, I mentioned in my early response today a possibility of missing steps (or possible incomplete section) in the instructions for the frontend section. Any idea what the instruction wants us to do once inside the frontend directory?

Sorry, I can't really be of much use once the app is running. I'm an infrastructure guy and get things working, and rarely step into a running app.

As Stuart said there is now impetus to continue with this project. In it's current state here we had to build the docker image ourselves - this isn't how we would normally release this type of code, so it's still very much development and at the point the project is now.

Let me see if I can find your answers though.

@adabedi
Copy link
Contributor

adabedi commented Jun 3, 2020

UI is connecting with middelware right now only to auth users.
If you wanna play with that (but is more just about how auth process happen between Django middelware and React user interface, not UI - OpenEHR).

BACK END:

  1. Working (python) middelware version with auth is on branch 'demo'.
  2. You will need make migration
sudo docker-compose run --rm c19-backend python3 /app/manage.py migrate
  1. You will need create super user to create any account.
sudo docker-compose run --rm c19-backend python3 /app/manage.py createsuperuser

  1. Now you can use your superuser password and username to log in

Troubleshooting:
-> make sure that in your .env file is: C19_BACKEND_CORS_ORIGIN_WHITELIST=http://localhost:3000

FRONTEND:

  1. You need the frontend on branch 'develop'
  2. Add to directory:
frontend/src/

file called 'config.js'
with content:

export const TOKEN_OBTAIN = '/token/obtain/';
export const API = 'http://127.0.0.1:8000/api/';
export const TOKEN_REFRESH = '/token/refresh/';
  1. Install all dependencies by command
yarn
  1. Run UI
yarn start

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

No branches or pull requests

4 participants