Unable to start server

Hi everyone,
after dowloading the docker from github, ee have some problems starting the server
Starting from here ( https://www.notion.so/Developers-7e06a70a07ee43bd9b70862367a2f2b9#be4bfd32194344e38a752c2f78192bca ) we arrive at the git page related to the server ( GitHub - BIDMCDigitalPsychiatry/LAMP-server: The mindLAMP server. ) .
If we try to build we get this:

/usr/src/app/node_modules/nano/lib/nano.js:62
assert.ok(/^https?:/.test(cfg.url), ‘url is not valid’)
^
AssertionError [ERR_ASSERTION]: url is not valid
at Object.dbScope (/usr/src/app/node_modules/nano/lib/nano.js:62:10)
at Object. (/usr/src/app/src/app.ts:22:29)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47

Any suggestion ?
Bye
Andrea

Does the system need an .env file for configurations and in case where can I find a template?

Discussed with Aditya: https://www.notion.so/Cloud-Deployment-Infrastructure-ebf62b0a24614d0c9b22a5817fe3e803#b987a61cc9db4cc9881dc7b925f8f04a should help. We use docker compose so the environment variables (config) is encoded into the system startup

Hi @Andrea_Colajacomo,

Welcome to the LAMP Community! To answer your question, we do need to specify environment variables here, but we don’t use a .env file, and instead use the docker-compose.yml file in the link provided above by John.

Hope this helps!

Hello everyone,

If I may say, I also have the same problem. I am trying to deploy the LAMP in my local development (macOS) and got the same error. So I ran docker stack deploy --compose-file lamp.yml lamp and it seemed fine. I have two questions:

  1. How can I know if I successfully deploy the server? The document says:

Once you’ve deployed the LAMP-server and LAMP-database , you’ll be able to use the mindLAMP app (either on your mobile device or [in a desktop browser (https://dashboard.lamp.digital/)) to connect to your instance.

But in case of my computer, I really don’t know which IP (and port) to go.

  1. When I run this command docker stack ps lamp, it says:

I am not sure “No such image:…” is an error as the status of them are “Rejected”?

Dear @jtorous and @avaidyam, may you please help?

Hi, everybody,
we tried all your suggestions in the thread, we tried both a local build and using AWS following your guide.
Unfortunately in both cases we were unable to get to a working server.
We always have the same error locally (see next image).

Also on AWS we have the same error:
/usr/src/app/node_modules/nano/lib/nano.js:62
assert.ok(/^https?:/.test(cfg.url), ‘url is not valid’)
We followed the guide step by step with only one difference: in the configuration of the pìlamp server via docker the link that is inserted in the config is not correct, so we had to build a new image.

Thank you for your help

Bye
Andrea

Hi @mintra and @Andrea_Colajacomo,

I’ve tried to reproduce the issues and have discovered the problems:

  1. Because we are in the middle of migrating databases there are some inconsistencies in our current codebase. This means you must check out the code at a specific commit (this one linked here). Once you build this version of the code, you will be set, as this version only uses MSSQL and not CouchDB.
  2. It seems that @mintra, you may need to log into GitHub and save the Docker credentials to be able to access the repository’s images. Instead, you could check out the code and manually build it to avoid this issue. We’ll figure out with GitHub if there’s a way to avoid this authentication requirement.

I hope this helps.

Hello everyone,
we have checkedout the project to the indicated commit, excluding the connection with crouchdb, now at the start of the lamp-server container wehave the following error

"node:1) UnhandledPromiseRejectionWarning: ConnectionError: Failed to connect to database:1433 - Could not connect (sequence)
at Connection.tedious.once.err (/usr/src/app/node_modules/mssql/lib/tedious/connection-pool.js:68:17)".

It seems that the db docker can not connect, the configuration followed is the one contained in the guide linked by Prof. Torus ( https://www.notion.so/Cloud-Deployment-Infrastructure-ebf62b0a24614d0c9b22a5817fe3e803#b987a61cc9db4cc9881dc7b925f8f04a )
The legacy_db container is correctly initialized.

Following the previous guide, is there any different configuration to set up for the two containers to communicate correctly with each other?

Thank you
Andrea

@Andrea_Colajacomo Here’s a possible solution:

  1. Build this Dockerfile into an image directly.
    1. The main command responsible for bringing up the database is reproduced below as well.
  2. Confirm that the database is operational using sqlcmd or a third-party tool.
    1. Make sure to bind-mount a new directory and then copy the data directory from this image into that new directory.
  3. Move the new directory to the correct data directory for the existing docker stack.
  4. Restart the stack to allow the LAMP-server to re-discover the database correctly. (Make sure you’ve bind-mounted the database data files correctly!)
ENV PATH="/opt/mssql/bin/:/opt/mssql-tools/bin/:${PATH}"
RUN sqlservr --accept-eula & sleep 10 \
    && sqlcmd -S localhost -U SA -P $SA_PASSWORD -q "ALTER LOGIN [sa] WITH NAME = [$SA_USERNAME]" \
    && sqlcmd -S localhost -U $SA_USERNAME -P $SA_PASSWORD -i /db_setup.sql \
    && pkill sqlservr 

@avaidyam We tried to follow your solution, but we still have problems.
In the attached file you can see the loading of the dockers fo server and db
As recommended in your guide we have used portanier for image management.

BuildImage.pdf (576.4 KB)

@Andrea_Colajacomo, the issue is that you have volume-mounted the SQL data, and thus the databases configured during build-time are not visible to SQL Server.

Instead, bind-mount (do not use volume-mounts for databases) a different directory from your local system. Then, copy the SQL data over, and restart the database having bind-mounted the new directory as the SQL data itself.

Here’s an example:

  1. docker run -d -v ${PWD}/sql_data:/sql_data --name copy-data lamp-database
  2. docker exec -it copy-data /bin/bash
  3. cp -R /var/opt/mssql/ /sql_data/
  4. docker kill copy-data
  5. docker run -d -v ${PWD}/sql_data:/data --name verify-data lamp-database
  6. docker logs -f verify-data

Let me know if these steps make sense.

Thanks @avaidyam
We will try today you suggestion.

I’ll let you know

Hello @avaidyam
unfortunately we receive failure also after last try.

Could it be that in then stack configuration we need t ochange something in these lines?

legacydb:
    image: lamp-legacydb:latest
    volumes:
      - legacydb:/var/opt/mssql

to use correctly the new container ( verify-data ) created ?

If you want, we can give you also an access to portainer.
Let me know

Bye
Andrea

@Andrea_Colajacomo - yes that’s correct, you have to change legacydb:/var/opt/mssql to match your existing bind-mount folder (that you just prepared), so: /data/sql:/var/opt/mssql for example. Please private message me if you would like me to help you through Portainer. :slight_smile:

Hello @avaidyam
actually we have this config and the db service start

legacydb:
    image: lamp-legacydb:latest
    volumes:
      - /home/ec2-user/sql_data/:/var/opt/mssql

Maybe ther is something not so clear to us about paths because the lamp server doesn’t found db server, but both server is in running state.
Could you explain us exactly wich is the right paths to use in this part?

volumes:
      - /home/ec2-user/sql_data/:/var/opt/mssql

Thanks again

Hi @Andrea_Colajacomo, the issue is now resolved as I mentioned to you privately!

Thank again @avaidyam.
Now everything is working.
How to access to dashboard now? wich user and password we need to use for first access?

Andrea

Does anyone know how to access the dashboard the first time it is run?
We don’t know what credentials to enter.
We didn’t find anything in the documentation.

The screen is this, but it is connected to our server.
image

Thank you
Andrew

@Andrea_Colajacomo apologies for the late response, but you would need to put your server address in, and then use admin for the username and the password you specified in your docker-compose file.

Hello @avaidyam we don’t have AWS and we executed the https://github.com/BIDMCDigitalPsychiatry/LAMP-server/blob/master/src/utils/db/db_setup.sql script in our SQL Server Database. In which environment file on LAMP Server Typescript API should we put these credentials to make the swagger up and running from our VS Code in localhost?