sashuk / watsonc

WatsonC Vidi extension
0 stars 2 forks source link

Custom docker file for Calypso #51

Closed mapcentia closed 5 years ago

mapcentia commented 5 years ago

I've trouble getting the profile tool to work on the test server. I get: message: "Traceback (most recent call last):↵ File "/root/vidi/extensions/watsonc/scripts/intersection/intersectiontool.py", line 217, in <module>↵ raise Exception("Provided folder " + localDataFolder + " does not exist")↵Exception: Provided folder /root/vidi/extensions/watsonc/scripts/intersection/../profil does not exist↵" I think we need a custom Docker file with all the dependencies for Calypso, which I can deploy in our production setup. like the one below.

I've a private repo for these, which I'll invite you to. In there, there is a folder called watsonc, which is a copy of one of the others.

FROM mapcentia/vidi:base
MAINTAINER Martin Høgh<mh@mapcentia.com>

RUN export DEBIAN_FRONTEND=noninteractive
ENV DEBIAN_FRONTEND noninteractive

# Clone Vidi from GitHub
RUN cd  ~ &&\
    git  clone http://github.com/mapcentia/vidi.git

# Install grunt
RUN cd ~/vidi &&\
    npm install grunt-cli -g --save-dev

# Install packages
RUN cd ~/vidi &&\
    npm install

RUN cd ~/vidi/public/js/lib/bootstrap-material-design &&\
    npm install

#Add custom config files from Git repo
COPY config.js /root/vidi/config/config.js # CUSTOM CONFIG FOR CALYPSO
COPY _variables.less /root/vidi/config/_variables.less

RUN cd ~/vidi/extensions &&\
    git clone https://github.com/ashuk/watsonc.git

####### DO THE REST HERE ########

#Run Grunt
RUN cd ~/vidi &&\
    grunt production

EXPOSE 3000

# Share the source dir
VOLUME  ["/root/vidi"]
sashuk commented 5 years ago

@mapcentia Could you please specify if there should be only vidi container which relies on the https://watsonc.mapcentia.com host?

For now, the https://github.com/mapcentia/dockerfiles_custom/blob/watsonc-installation/watsonc/vidi/Dockerfile is not able to checkout scripts, all the other configurations are ready.

sashuk commented 5 years ago

@JacobBirk @WatsonC-hub Could you please create a no-password SSH key for cloning the scripts repo (https://help.github.com/en/enterprise/2.15/user/articles/adding-a-new-ssh-key-to-your-github-account)?

JacobBirk commented 5 years ago

@sashuk @mapcentia Ole is on vacation and I have no idea what to do. Do you need this to continue?

sashuk commented 5 years ago

@mapcentia @JacobBirk Actually it is not critical for now, but it still should be added at some point (now profile script is just duplicated, which is bad practice, as it should be always pulled straight from the repo).

sashuk commented 5 years ago

@mapcentia The Dockerfile that deploys the production-ready Calypso was committed

mapcentia commented 5 years ago

@sashuk I've deployed the custom image here: https://watsonc.vidi.gc2.io/app/jupiter/chemicals,sensor/ But the profile tool doesn't work. Could test the image?

sashuk commented 5 years ago

@mapcentia The Dockerfile now it installs the Python 3 and some additional modules via pip, the image was tested (added in https://github.com/mapcentia/dockerfiles_custom/commit/6d74bcd7f7e0b8fd98b94cf094fcabdc4009c347).

mapcentia commented 5 years ago

@sashuk For me the profile API requests hangs and results in a 502. Test site: https://map.calypso.watsonc.dk

sashuk commented 5 years ago

@mapcentia Following was performed:

profile

Could you please check if the Calypso has the latest version? Seems like the https://map.calypso.watsonc.dk is outdated (tried with the https://map.calypso.watsonc.dk/app/jupiter/chemicals,sensor/?tmpl=watsonc.tmpl#geodk.bright/15/9.7957/57.0289/v:chemicals.boreholes_time_series_with_chemicals,sensor.sensordata_without_correction,chemicals.boreholes_time_series_without_chemicals,v:sensor.sensordata_with_correction):

mapwatsonc

mapcentia commented 5 years ago

@sashuk I got it to work - sort of. It's was about the db connection from within the Docker Swarm. But I sometimes gets: message: "Traceback (most recent call last):↵ File "/root/vidi/extensions/watsonc/scripts/profil/profiletool_kemi_v5.py", line 653, in <module>↵ profiletool_v5(json_str)↵ File "/root/vidi/extensions/watsonc/scripts/profil/profiletool_kemi_v5.py", line 376, in profiletool_v5↵ range=[-100,y_max+10]), ↵UnboundLocalError: local variable 'y_max' referenced before assignment↵"

Exceptions from the Python needs to be handled, so Vidi is not just hanging.

The test site is: https://watsonc.vidi.gc2.io/app/jupiter/chemicals,sensor/#geodk.bright/7/9.4482/56.069/

sashuk commented 5 years ago

@mapcentia Seems like this should be fixed in profil first. There is a latest commit in https://github.com/WatsonC-hub/profil/commit/3a753fc44c605ff64a98d35115721848aec19b9d, which actually partially fixes the issue (the y_max is assigned now before it is used), but does not fix it in https://github.com/mapcentia/dockerfiles_custom/blob/master/watsonc/vidi/profil/profiletool_kemi_v5.py#L376.

@olemunch @mapcentia The fix for y_max variable was applied (https://github.com/WatsonC-hub/profil/commit/a01731db6d35d4da27b2b9b7198a4d12392a93ec), so please rebuild the image with fixed profil script.

sashuk commented 5 years ago

@mapcentia Vidi is now not crashing when Python scrips error, please see the https://github.com/sashuk/watsonc/commit/f0c5a3befe4dd6acd51bad44d2315f69cadfec4a. Could you please try to build the image and if everything is good we could close the issue?

sashuk commented 5 years ago

@mapcentia Just rebuilt and run the image again, working as expected.