|
1 | 1 | # Pyronear Platform
|
2 | 2 | [](LICENSE) [](https://www.codacy.com/gh/pyronear/pyro-platform/dashboard?utm_source=github.com&utm_medium=referral&utm_content=pyronear/pyro-platform&utm_campaign=Badge_Grade) 
|
3 | 3 |
|
4 |
| -The building blocks of our wildfire detection & monitoring API. |
| 4 | +The open-source platform for managing early wildfire detection |
5 | 5 |
|
6 | 6 |
|
7 |
| -## Quick Tour |
| 7 | +# Installation |
8 | 8 |
|
9 |
| -### Running/stopping the service |
| 9 | +## Prerequisites |
10 | 10 |
|
11 |
| -You can run the app container using this command for dev purposes: |
| 11 | +- [Docker](https://docs.docker.com/engine/install/) |
| 12 | +- [Docker compose](https://docs.docker.com/compose/) |
| 13 | +- [Poetry](https://python-poetry.org/) |
| 14 | +- [Make](https://www.gnu.org/software/make/) (optional) |
| 15 | + |
| 16 | +The project was designed so that everything runs with Docker orchestration (standalone virtual environment), so you won't need to install any additional libraries. |
| 17 | + |
| 18 | +## Configuration |
| 19 | + |
| 20 | +In order to run the project, you will need to specific some information, which can be done using a `.env` file. |
12 | 21 |
|
| 22 | +This file will have to hold the following information: |
| 23 | +- `API_URL`: URL to the endpoint of [Pyronear Alert API](https://github.com/pyronear/pyro-api) |
| 24 | +- `API_LOGIN`: your login for the API |
| 25 | +- `API_PWD`: your password for the API |
| 26 | + |
| 27 | +Optionally, the following information can be added: |
| 28 | +- `SENTRY_DSN`: the URL of the [Sentry](https://sentry.io/) project, which monitors back-end errors and report them back. |
| 29 | +- `SENTRY_SERVER_NAME`: the server tag to apply to events. |
| 30 | +- `DEBUG`: whether the app is in debug or production mode |
| 31 | + |
| 32 | +The file should be placed at the root folder of your local copy of the project. |
| 33 | + |
| 34 | + |
| 35 | +## Running you service locally |
| 36 | + |
| 37 | +### Clone the repository |
13 | 38 | ```shell
|
14 |
| -make run_dev |
| 39 | +git clone https://github.com/pyronear/pyro-platform.git && cd pyro-platform |
15 | 40 | ```
|
16 | 41 |
|
17 |
| -or for production: |
| 42 | +Here, there are several ways to start the service |
| 43 | +- Either you have access to a pyronear alert api online through a specific API_URL |
| 44 | +- Otherwise, you'll need to create a development environment. Don't panic, here's a tutorial on how to do it smoothly |
| 45 | + |
| 46 | +### Run the service directly with the URL of a pyronear alert api |
18 | 47 |
|
| 48 | +#### 1 - Set your environment variables |
| 49 | +First copy the example environment setup |
19 | 50 | ```shell
|
20 |
| -make run |
| 51 | +cp .env.example .env |
21 | 52 | ```
|
| 53 | +Fill it with your API_URL and credentials |
22 | 54 |
|
23 |
| -You can now navigate to `http://localhost:8050/` to interact with the app. |
| 55 | +#### 2 - You can run the app container using this command for dev purposes: |
| 56 | +```shell |
| 57 | +make run_dev |
| 58 | +``` |
| 59 | + |
| 60 | +### Run the service via a development environment |
| 61 | + |
| 62 | +#### 1 - clone pyro-envdev repository |
| 63 | +Move to a directoty where to clone the [pyro-envdev repo](https://github.com/pyronear/pyro-envdev), then |
24 | 64 |
|
25 |
| -In order to stop the service, run: |
26 | 65 | ```shell
|
27 |
| -make stop |
| 66 | +git clone https://github.com/pyronear/pyro-envdev.git && cd pyro-envdev |
28 | 67 | ```
|
29 | 68 |
|
30 |
| -If you need to launch the pyro-api in your development environment you can use the pyro-devops project. |
31 |
| -You can use it in two different ways : |
32 |
| -=> by building the pyro-platform image and launch the full development environment with the command : |
| 69 | +#### 2 - build & launch required pyro-envdev services |
33 | 70 | ```shell
|
34 |
| -make run |
| 71 | +make build |
35 | 72 | ```
|
36 |
| -=> by launching the development environment without the platform : |
| 73 | +Then, with the following command, you will run the API locally and services that simulate 2 cameras generating alerts |
| 74 | + |
37 | 75 | ```shell
|
38 | 76 | make run-engine
|
39 | 77 | ```
|
40 |
| -adding this line in your /etc/hosts : |
| 78 | +### 3 - Let your webbrowser access images from development environment |
| 79 | +by adding this line in your /etc/hosts |
| 80 | + |
41 | 81 | ```
|
42 | 82 | 127.0.0.1 www.localstack.com localstack
|
43 | 83 | ```
|
44 |
| -and launching your project locally : |
| 84 | + |
| 85 | +#### 4 - Go back to pyro-platform & setup credentials |
| 86 | +```shell |
| 87 | +cd PATH_TO_PYRO-PLATFORM |
45 | 88 | ```
|
46 |
| -python3 app/index.py |
| 89 | + |
| 90 | +Fill credentials to access your local API, the example below shall work properly as the API_URL give access to your local pyronear api and (API_LOGIN, API_PWD) are taken from [default credentials in the development environment](https://github.com/pyronear/pyro-envdev/blob/main/data/csv/API_DATA_DEV%20-%20users.csv) |
| 91 | + |
| 92 | +``` |
| 93 | +API_URL='http://host.docker.internal:5050/' |
| 94 | +API_LOGIN='github-engine' |
| 95 | +API_PWD='passwrd6' |
47 | 96 | ```
|
48 | 97 |
|
49 |
| -## Installation |
| 98 | +### 4 - Start your local pyro-plateform |
50 | 99 |
|
51 |
| -### Prerequisites |
| 100 | +Now, you can run the app container using this command for dev purposes: |
52 | 101 |
|
53 |
| -- [Docker](https://docs.docker.com/engine/install/) |
54 |
| -- [Docker compose](https://docs.docker.com/compose/) |
55 |
| -- [Poetry](https://python-poetry.org/) |
56 |
| -- [Make](https://www.gnu.org/software/make/) (optional) |
| 102 | +```shell |
| 103 | +make run_dev |
| 104 | +``` |
57 | 105 |
|
58 |
| -The project was designed so that everything runs with Docker orchestration (standalone virtual environment), so you won't need to install any additional libraries. |
| 106 | +or launch your project locally directly with python: |
59 | 107 |
|
60 |
| -## Configuration |
| 108 | +```shell |
| 109 | +python3 app/index.py |
| 110 | +``` |
61 | 111 |
|
62 |
| -In order to run the project, you will need to specific some information, which can be done using a `.env` file. |
63 |
| -This file will have to hold the following information: |
64 |
| -- `API_URL`: URL to the endpoint of [Pyronear Alert API](https://github.com/pyronear/pyro-api) |
65 |
| -- `API_LOGIN`: your login for the API |
66 |
| -- `API_PWD`: your password for the API |
| 112 | +### Check how what you've deployed |
67 | 113 |
|
68 |
| -Optionally, the following information can be added: |
69 |
| -- `SENTRY_DSN`: the URL of the [Sentry](https://sentry.io/) project, which monitors back-end errors and report them back. |
70 |
| -- `SENTRY_SERVER_NAME`: the server tag to apply to events. |
71 |
| -- `DEBUG`: whether the app is in debug or production mode |
| 114 | +You can now navigate to `http://localhost:8050/` to interact with the app. |
72 | 115 |
|
73 |
| -So your `.env` file should look like something similar to: |
74 |
| -``` |
75 |
| -API_URL='https://alert.mydomain.com/api' |
76 |
| -API_LOGIN='forest_saver' |
77 |
| -API_PWD='ILoveForest!' |
78 |
| -SENTRY_DSN='https://replace.with.you.sentry.dsn/' |
79 |
| -SENTRY_SERVER_NAME=my_storage_bucket_name |
| 116 | +In order to stop the service, run: |
| 117 | +```shell |
| 118 | +make stop |
80 | 119 | ```
|
81 | 120 |
|
82 |
| -The file should be placed at the root folder of your local copy of the project. |
83 | 121 |
|
84 |
| -Also please note that you should use docker-compose-dev.yml file for dev as we do not need reverse proxy: |
| 122 | +## Running your service in production |
85 | 123 |
|
86 | 124 | ```shell
|
87 |
| -docker-compose -f docker-compose-dev.yml up |
| 125 | +make run |
88 | 126 | ```
|
89 | 127 |
|
90 | 128 | For production we use docker-compose.yml in which there is the [Traefik Reverse Proxy](https://traefik.io/traefik/).
|
|
0 commit comments