diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2771d6a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +FROM condaforge/miniforge3 + +SHELL ["/bin/bash", "-c"] + +# Clone SpiceQL repo instead of copying? +#git clone git@github.com:DOI-USGS/SpiceQL.git /repo + +RUN mkdir /repo +COPY . /repo +RUN echo $(ls /repo) +RUN chmod -R 755 /repo + +# Set repo root env +ENV SPICEQL_REPO_ROOT /repo + +# Need to mount ISIS data area +ENV SSPICE_DEBUG=TRUE +ENV SPICEROOT=/mnt/isis_data +ENV SPICEQL_LOG_LEVEL=TRACE + +# CMD ["/bin/bash"] +# RUN /bin/bash -c "source activate spiceql" +RUN mamba env create -f ${SPICEQL_REPO_ROOT}/environment.yml -n spiceql && \ + source /opt/conda/etc/profile.d/conda.sh && \ + conda init && \ + conda activate spiceql && \ + conda install -c conda-forge spiceql && \ + echo "source activate spiceql" > ~/.bashrc && \ + cd ${SPICEQL_REPO_ROOT}/fastapi + +ENV PATH /opt/conda/envs/spiceql/bin:$PATH + +WORKDIR ${SPICEQL_REPO_ROOT}/fastapi + +EXPOSE 8080 + +ENTRYPOINT [ "uvicorn", "app.main:app", "--reload", "--port" , "8080" ] diff --git a/fastapi/config/nginx.conf b/fastapi/config/nginx.conf new file mode 100644 index 0000000..6b56864 --- /dev/null +++ b/fastapi/config/nginx.conf @@ -0,0 +1,97 @@ +# For more information on configuration, see: +# * Official English Documentation: http://nginx.org/en/docs/ +# * Official Russian Documentation: http://nginx.org/ru/docs/ + +# [NOTE!] This file should be located at /etc/nginx/ + +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log notice; +pid /run/nginx.pid; + +# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. +include /usr/share/nginx/modules/*.conf; + +events { + worker_connections 1024; +} + +http { + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + tcp_nopush on; + keepalive_timeout 65; + types_hash_max_size 4096; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + # Load modular configuration files from the /etc/nginx/conf.d directory. + # See http://nginx.org/en/docs/ngx_core_module.html#include + # for more information. + include /etc/nginx/conf.d/*.conf; + + server { + listen 80; + listen [::]:80; + server_name 10.12.69.192; #IP Address of EC2 instance + root /usr/share/nginx/html; + + # Load configuration files for the default server block. + include /etc/nginx/default.d/*.conf; + + location / { + proxy_pass http://127.0.0.1:8080; #FastAPI port 8080 + } + + error_page 404 /404.html; + location = /404.html { + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + } + } + + # Allow large query URLs + fastcgi_buffers 8 16k; + fastcgi_buffer_size 32k; + client_max_body_size 24M; + client_body_buffer_size 128k; + client_header_buffer_size 5120k; + large_client_header_buffers 16 5120k; + +# Settings for a TLS enabled server. +# +# server { +# listen 443 ssl http2; +# listen [::]:443 ssl http2; +# server_name _; +# root /usr/share/nginx/html; +# +# ssl_certificate "/etc/pki/nginx/server.crt"; +# ssl_certificate_key "/etc/pki/nginx/private/server.key"; +# ssl_session_cache shared:SSL:1m; +# ssl_session_timeout 10m; +# ssl_ciphers PROFILE=SYSTEM; +# ssl_prefer_server_ciphers on; +# +# # Load configuration files for the default server block. +# include /etc/nginx/default.d/*.conf; +# +# error_page 404 /404.html; +# location = /404.html { +# } +# +# error_page 500 502 503 504 /50x.html; +# location = /50x.html { +# } +# } + +} +