From c98dcec9786f394f8c869653efc6c0961988955c 2021-05-02 03:06:53 From: Juan C. Espinoza Date: 2021-05-02 03:06:53 Subject: [PATCH] Fix docker commands --- diff --git a/.gitignore b/.gitignore index bd825ec..caadf3d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,22 @@ +# general .env +.DS_store +*.pyc +*.sqlite +# config madrigal.cfg +# metadata siteTab.txt -madrigal.sqlite +expTab.txt +expTabAll.txt +fileTab.txt +fileTabAll.txt +instData.txt +instDataPriv.txt +instParmLastUpdate.txt +instTab.txt +instType.txt +siteTab.txt +typeTab.txt +# experiments experiments/ diff --git a/Dockerfile b/Dockerfile index a06eacc..a889388 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,13 +4,13 @@ RUN mkdir /madrigal WORKDIR /madrigal -COPY . ./ +ADD required_modules.txt ./required_modules.txt -RUN apt-get clean && apt-get update && apt-get install -y --no-install-recommends \ - gcc autotools h5utils\ - && apt-get purge -y --auto-remove gcc g++\ +RUN apt clean && apt update && apt install -y --no-install-recommends \ + gcc gfortran build-essential automake autotools-dev autoconf m4 libtool hdf5-tools\ && rm -rf /var/lib/apt/lists/*\ - && ln -s /usr/bin/python /madrigal/bin/python + && pip install -r required_modules.txt && pip install django-bootstrap3 -RUN bash installMadrigal +COPY . ./ +RUN ln -s /usr/local/bin/python3.7 /madrigal/bin/python && bash installMadrigal diff --git a/docker-compose.yml b/docker-compose.yml index bb30cd2..c3532b9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,19 +6,24 @@ services: build: . restart: always image: madrigal - command: python manage.py runserver 0.0.0.0:8000 + working_dir: /madrigal/source/madpy/djangoMad + command: gunicorn djangoMad.wsgi --bind 0.0.0.0:8000 + # command: python manage.py runserver 0.0.0.0:8000 env_file: .env - ports: - - "8000:8000" - links: - - redis - - mongo + # ports: + # - 8080:8080 + volumes: + - './:/madrigal' + + nginx: + container_name: 'madrigal-nginx' + image: nginx:1.15-alpine volumes: - - './:${APP_DIR}' + - ./source/madpy/djangoMad/madweb/static:/static + - ./nginx:/etc/nginx/conf.d + ports: + - "8080:8080" depends_on: - - redis - - mongo - - - - + - web + command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'" + \ No newline at end of file diff --git a/installMadrigal b/installMadrigal index 9c38fd5..d941520 100644 --- a/installMadrigal +++ b/installMadrigal @@ -240,6 +240,7 @@ fi # Install Experiments # ------------------- echo "********** configureExperiments **********" +chmod +x configureExperiments ./configureExperiments if [ $? -ne 0 ] then @@ -249,6 +250,7 @@ fi # Update metadata # ------------------- echo "********** Updating metadata tables **********" +chmod +x -R bin/ bin/updateMaster if [ $? -ne 0 ] then diff --git a/nginx/app.conf b/nginx/app.conf new file mode 100644 index 0000000..a3a283c --- /dev/null +++ b/nginx/app.conf @@ -0,0 +1,21 @@ +# configuration + +upstream djangomad { + server web:8000; +} + +server { + listen 80; + + location / { + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_redirect off; + proxy_pass http://djangomad; + } + + location /static/ { + alias /static/; + } +} \ No newline at end of file diff --git a/required_modules.txt b/required_modules.txt index 333df15..bb38b70 100644 --- a/required_modules.txt +++ b/required_modules.txt @@ -8,6 +8,9 @@ netCDF4 scipy setuptools django -bootstrap3 +# bootstrap3 aacgmv2 sqlparse +filelock +gunicorn +plotly \ No newline at end of file