Skip to content
Snippets Groups Projects
Commit db738265 authored by Riccardo Boero's avatar Riccardo Boero :innocent:
Browse files

create Julia server

parent d7b48725
No related branches found
No related tags found
No related merge requests found
FROM python:3.12.6-slim-bullseye
# update system and install required software
RUN apt update && /usr/local/bin/python -m pip install --upgrade pip && apt install git -y
#&& pip install poetry
FROM julia:1.11.2-bullseye
# copy data
COPY data/aster30m/*.tif /app/data/aster30m/
# copy required software & data
WORKDIR /app
COPY other /app/other
#WORKDIR /app
COPY run.sh /app/other/run.sh
COPY start_server.jl /app/other/start_server.jl
COPY *.toml /app/other/
# Ensure the script is executable
RUN chmod +x /app/other/load_server_package.sh
# setup the python environment
RUN /app/other/load_server_package.sh
RUN chmod +x /app/other/run.sh
# start server & expose port
CMD ["sh", "/app/other/run.sh"]
......
This diff is collapsed.
[deps]
PolygonQueryOnRaster = "87e1e4ff-bd71-4e87-8a62-f5cdf45a2f68"
#!/usr/bin/env bash
pip install polygonqueryonraster --index-url https://git.nilu.no/api/v4/projects/1217/packages/pypi/simple
#!/usr/bin/env bash
python /app/other/start.py
from polygonqueryonraster.app import GeoTIFFService
if __name__ == "__main__":
"""
Main execution point for running the GeoTIFFService as a standalone application.
This script initializes and starts the GeoTIFFService with a predefined data directory and port number.
It's designed to be run directly from the command line and is useful for quick setups or testing.
The GeoTIFFService is configured to analyze the GeoTIFF files located in the specified directory.
It sets up a Flask-based web server to listen for incoming requests for geospatial analysis.
Configuration:
- Data Directory: The directory where GeoTIFF files are stored. This should be an absolute path.
- Port Number: The port number on which the Flask web server will run.
- Categorical Analysis: Indicates whether the analysis should be categorical. It's set to 'false' by default.
Example:
When this script is run, it starts the GeoTIFFService on the specified port and ready to process
requests on GeoTIFF files located in the specified data directory.
Usage:
python scriptname.py
Note:
To use this script, ensure that the 'polygonqueryonraster' package is installed and accessible in your
Python environment. Modify the 'data_directory' and 'port_number' variables as needed for your setup.
"""
data_directory = '/app/data/aster30m' # Specify your local data directory
port_number = 5000 # Specify the custom port number
categorical = False # Specify whether the analysis is categorical
service = GeoTIFFService(directory=data_directory, port=port_number, categorical=categorical)
service.run()
run.sh 0 → 100644
#!/bin/bash
julia --project=@. start_server.jl > server.log 2>&1 &
using PolygonQueryOnRaster
# Configuration
data_directory = "./data" # Replace with the path to your GeoTIFF files
port_number = 5000 # Replace with the desired port
categorical = false # Set to true if analysis is categorical
concurrent_processes = 4 # Number of concurrent processes
# Create and run the service
service = GeoTIFFService(data_directory, port_number, categorical, concurrent_processes)
run(service)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment