Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
35 changes: 2 additions & 33 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,33 +1,2 @@
Procfile
.env
dist/
build/
venv/
venv
API/__pycache__
API/Classes/__pycache__
API/Classes/Base/__pycache__
API/Classes/Case/__pycache__
API/Routes/__pycache__

API/Routes/Upload/__pycache__
API/Routes/DataFile/__pycache__
API/Routes/Case/__pycache__

WebAPP/SOLVERs/GLPK
WebAPP/SOLVERs/COIN-OR
WebAPP/SOLVERs/_GLPK
WebAPP/SOLVERs/_COIN-OR

WebAPP/DataStorage/*
!WebAPP/DataStorage/Parameters.json
!WebAPP/DataStorage/Variables.json

WebAPP/References/jqwidgets_licenced
WebAPP/References/jqwidgets_free
WebAPP/References/jqwidgets/jqx-all-unlisenced.js
WebAPP/References/wijmoFULL/
WebAPP/References/wijmoOLD/
WebAPP/References/wijmo/DistributionKey.txt
WebAPP/References/wijmo/licence.js
app.spec
.idea
WebAPP/DataStorage/*
13 changes: 0 additions & 13 deletions .readthedocs.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .vscode/launch.json

This file was deleted.

4 changes: 0 additions & 4 deletions .vscode/settings.json

This file was deleted.

4 changes: 2 additions & 2 deletions API/Classes/Case/OsemosysClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def __init__(self, case):
#self.cbcFolder = Path(Config.SOLVERs_FOLDER,'COIN-OR', 'Cbc-master-win64-msvc16-md', 'bin')

else:
self.glpkFolder = Path(Config.SOLVERs_FOLDER, 'GLPK','glpk-4.65', 'w64')
self.cbcFolder = Path(Config.SOLVERs_FOLDER,'COIN-OR', 'Cbc-2.10-osx10.15-x86_64-gcc9', 'bin')
self.glpkFolder = Path(Config.SOLVERs_FOLDER, 'GLPK','glpk', 'w64')
self.cbcFolder = Path(Config.SOLVERs_FOLDER,'COIN-OR', 'Cbc', 'bin')

self.resultsPath = Path(Config.DATA_STORAGE,case,'res')
self.viewFolderPath = Path(Config.DATA_STORAGE,case,'view')
Expand Down
21 changes: 9 additions & 12 deletions API/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,13 @@ def setSession():
import mimetypes
mimetypes.add_type('application/javascript', '.js')
port = int(os.environ.get("PORT", 5002))
print("PORTTTTTTTTTTT")
if Config.HEROKU_DEPLOY == 0:
#localhost
#app.run(host='127.0.0.1', port=port, debug=True)
#waitress server
#prod server
from waitress import serve
serve(app, host='127.0.0.1', port=port)
else:
#HEROKU
app.run(host='0.0.0.0', port=port, debug=True)
#app.run(host='127.0.0.1', port=port, debug=True)

print(f"--- Starting App on Port {port} ---")

# For Podman/Docker, we MUST listen on 0.0.0.0, not 127.0.0.1
# We can detect if we are in a container, or just default to 0.0.0.0
from waitress import serve

print("Serving on 0.0.0.0 (Container Friendly)")
serve(app, host='0.0.0.0', port=port)

32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Use a lightweight Python base image
FROM python:3.10-slim

# Prevent Python from writing pyc files to disc
ENV PYTHONDONTWRITEBYTECODE=1
# Prevent Python from buffering stdout and stderr
ENV PYTHONUNBUFFERED=1

# Set the working directory inside the container
WORKDIR /app

# Install system-level solvers (GLPK and CBC)
RUN apt-get update && apt-get install -y \
glpk-utils \
coinor-cbc \
&& rm -rf /var/lib/apt/lists/*

# Copy the requirements file first (to leverage caching)
COPY requirements.txt .

# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code
# This assumes 'WebAPP', 'Classes', and 'Routes' are in the same folder as Dockerfile
COPY . .
RUN chmod -R +x /app/WebAPP/SOLVERs
# Expose the port the app runs on
EXPOSE 5002

# Define the command to run the application
CMD ["python", "API/app.py"]
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,38 @@ This repository contains the user interface for the Open Source Energy Modelling
4. The App will open automatically once the installation is complete. If not, search on the Windows Taskbar for ‘’MUIO’’ and open the App.
5. You will see the MUIO in a new window.

## Installation Guide for MacOS and Linux
1. Clone the repository.
```
git clone https://github.com/junohBede/MUIO.git
```
2. Create conda environment with using the command below. If you do not have conda installed in your machine, refer to this [link.](www.anaconda.com/docs/getting-started/miniconda/install)
3. Activate conda environment with the command below.
```
conda activate muio
```
4. Replace folder “MUIO/WebAPP/SOLVERs/COIN-OR/Cbc” contents from [here.](https://github.com/coin-or/Cbc/releases/tag/releases%2F2.10.12)
5. Run `python API/app.py` in terminal. (Make sure that your current working directory is not MUIO, before running the command.)
6. Open web browser to open web app [http://127.0.0.1:5002/#/](http://127.0.0.1:5002/#/)

## Installation Guide using Docker
**Docker** is an open platform that allows developers to automate the deployment of application inside containers. You can find more information within this [link.](https://docs.docker.com/get-started/docker-overview/)
1. Clone the repository.
```
git clone https://github.com/junohBede/MUIO.git
```
2. Build Docker image using Dockerfile of the repository.
```
docker build -t muio .
```
3. Run Docker container, with opening ports for web app.
```
docker run -dt -p 5002:5002 --name muio muio
```
4. Open web browser to open web app [http://127.0.0.1:5002/#/](http://127.0.0.1:5002/#/)

## Questions and Issues

For troubleshooting model-related issues and discussions, please visit the [Energy Modelling Community Discussion Forum](https://forum.u4ria.org/).

If you encounter bugs or have new feature ideas, please submit them to the repository's issue tracker. We encourage contributions and discussions to further develop MUIO.
If you encounter bugs or have new feature ideas, please submit them to the repository's issue tracker. We encourage contributions and discussions to further develop MUIO.
Loading