Skip to content

Instantly share code, notes, and snippets.

@rv602
Created August 11, 2023 13:57
Show Gist options
  • Save rv602/c0da74448871a950d94cf38a046e95ec to your computer and use it in GitHub Desktop.
Save rv602/c0da74448871a950d94cf38a046e95ec to your computer and use it in GitHub Desktop.
  1. Clone this repository

    git clone https://github.com/rv602/open-source-sustainability/

    cd open-source-sustainability

  2. Install all the necessary dependencies npm i (for the node modules)

    Create a virtual environment (for the Mesa models) virtualenv venv

    Activate the environment source venv/bin/activate

    Install the python dependencies pip install -r requirements.txt

  3. Deploy the Mesa Models on Cloudflare tunnel

    The Mesa models can be easily visualised on a web interface by running this command, and can be accessed on localhost on any port configured.

    mesa runserver

    This method is just restricted to get your model up and running in localhost. To have them deployed globally, we will be using Cloudflare Tunnels.

You need to install Cloudflare tunnels CLI via the following command.

  • Mac brew install cloudflare/cloudflare/cloudflared

  • Linux wget -q https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && sudo dpkg -i cloudflared-linux-amd64.deb

  • Windows PS C:\Users\Administrator\Downloads\cloudflared-stable-windows-amd64> .\cloudflared.exe --version

    Once you are done installing the Cloudflare CLI, you can use this command to deploy your models.

    cloudflared tunnel --url http://localhost:{portNumber}

    This will result in a URL, which you have to update in the iframe.

    Now that you have all things set up, you can have the project up and running by

    npm run dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment