You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+91-40Lines changed: 91 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,72 +3,123 @@
3
3
4
4
# AcidWatch
5
5
6
-
Welcome to the **AcidWatch** repository.
6
+
AcidWatch is a portal for tools that calculate and predict chemical reactions in
7
+
CO<sub>2</sub> streams. It is essential for advancing and scaling carbon capture
8
+
and storage (CCS) technologies. The goal of AcidWatch is to democratize and open
9
+
up the discussion around CO<sub>2</sub> impurities and provide a reliable
10
+
resource for researchers, chemists, and industry professionals in the CCS
11
+
domain.
7
12
8
-
This repository focuses on developing a portal for tools that calculate and predict chemical reactions in CO<sub>2</sub> streams, which are essential for advancing and scaling carbon capture and storage (CCS) technologies. Our goal is to democratize and open up the discussion around CO<sub>2</sub> impurities and provide a reliable resource for researchers, chemists, and industry professionals in the CCS domain.
13
+
## Using
9
14
10
-
## Links to Access AcidWatch in the Browser
15
+
The production version of AcidWatch is found at https://acidwatch.radix.equinor.com/ . Some features require an Equinor account with appropriate accesses.
11
16
12
-
AcidWatch is accessible at https://acidwatch.radix.equinor.com/, which is the official link to the latest stable version of the platform. Additionally, mainly for development purposes, we maintain three environments:
17
+
The development version, which represents the `main` branch of this repository, is found at https://frontend-acidwatch-dev.radix.equinor.com/
13
18
14
-
-**Development**: The latest features in active development (may be unstable). Access the dev version [here](https://frontend-acidwatch-dev.radix.equinor.com/).
15
-
-**Testing**: For testing new features (more stable than dev). Access the test version [here](https://frontend-acidwatch-test.radix.equinor.com/).
16
-
-**Production**: The official live platform with all tested and stable features. Access the production version [here](https://frontend-acidwatch-prod.radix.equinor.com/). The main URL (https://acidwatch.radix.equinor.com/) also directs to the production environment.
19
+
## Developing
17
20
18
-
Please note: You might need appropriate permissions to access the environments.
21
+
AcidWatch uses Python in the backend and Javascript in the frontend.
22
+
Additionally, some features require a reasonably up-to-data Java version. Ensure that you have Python 3.11 or later, [Poetry](https://python-poetry.org/), NodeJS and Java (eg. OpenJDK 21).
19
23
20
-
##How to build AcidWatch locally
24
+
### Backend
21
25
22
-
Before you begin, ensure you have the following installed on your machine:
26
+
The backend is written using FastAPI and SQLAlchemy.
23
27
24
-
-[Node.js](https://nodejs.org/) (version 14.x or later)
25
-
-[npm](https://www.npmjs.com/) (version 6.x or later)
26
-
-[Python](https://www.python.org/) (version 3.11 or later)
Using Poetry, install AcidWatch's backend using the following command:
28
29
29
-
### Getting Started
30
+
```sh
31
+
poetry -C backend install
32
+
```
30
33
31
-
#### 1. Clone the Repository
34
+
> [!NOTE]
35
+
> Here, `-C backend` instructs `poetry` to enter the `backend/` directory before
36
+
> doing anything. If you enter the `backend` directory (eg. via `cd backend`), you
37
+
> can drop writing `-C backend` for each command.
32
38
33
-
Clone the repository to your local machine:
39
+
Then, run the backend in development mode using the following command:
34
40
35
-
```sh
36
-
git clone git@github.com:equinor/acidwatch.git
37
-
cd acidwatch
41
+
```sh
42
+
poetry -C backend run acidwatch-api
38
43
```
39
44
40
-
#### 2. Start backend
45
+
To change the settings, first copy `backend/.env.example` to `backend/.env` and
46
+
then modify it to suit your needs.
41
47
42
-
Navigate to the backend directory, create a .env file based on .env.example to configure environment variables (secrets can be found in azure portal). As of now, the app relies on you being able to connect to the Azure database and this functionality is not accessible to the users outside Equinor.
48
+
To install and run a production build of the backend, refer to [the backend
49
+
Dockerfile](./backend/Dockerfile).
43
50
44
-
Install the dependencies using poetry, activate the Python virtual environment (we refer to [Python documentation](https://docs.python.org/3/library/venv.html) for the details) and start server:
51
+
Explore the auto-generated REST API at http://localhost:8001/docs
45
52
46
-
```sh
47
-
cd backend
48
-
poetry install
49
-
cd src/acidwatch_api/
50
-
python3 __main__.py
53
+
#### SQLite
54
+
By default, AcidWatch uses an in-memory SQLite database. It requires no
55
+
additional installation or setup, but will reset whenever the backend is
56
+
restarted.
57
+
58
+
To enable a persistent SQLite database, set `ACIDWATCH_DATABASE` in
59
+
`backend/.env` file. For example, adding the following will create a `test.db`
60
+
file in the directory from which `acidwatch-api` is ran:
61
+
62
+
```sh
63
+
ACIDWATCH_DATABASE=sqlite:///test.db
51
64
```
52
65
53
-
#### 3. Start frontend
66
+
> [!TIP]
67
+
> Database migration aren't applied to SQLite. If mysterious database errors
68
+
> occur, delete your database file and restart.
54
69
55
-
Navigate to the frontend directory, create a .env file based on .env.example to configure environment variables. The variables begin with the prefix VITE\_, but in the code they are referenced without the prefix. Then
70
+
#### PostgreSQL
71
+
AcidWatch uses a PostgreSQL database in production. Once you have access
56
72
57
-
```sh
58
-
cd ../frontend
59
-
npm install
60
-
npm run dev
73
+
First, ensure that the backend is installed with the `pg` (PostgreSQL) optional
74
+
dependency group. This installs the recommended SQLAlchemy driver:
75
+
76
+
```sh
77
+
poetry -C backend install -E pg
78
+
```
79
+
80
+
Then, set the `ACIDWATCH_DATABASE` as described in the [SQLite section](#SQLite) to the following:
This is optional, you can still do quite a lot frontend development without having any models running. Check the relevant models repos for guidance how to run locally:
66
105
67
-
-https://github.com/equinor/arcs
106
+
```sh
107
+
# Copy the .env file
108
+
cp frontend/.env.example frontend/.env
109
+
110
+
# then install
111
+
npm -C frontend install
112
+
```
113
+
114
+
To run, ensure that the backend is running on port 8001 and then:
115
+
116
+
```sh
117
+
npm -C run dev
118
+
```
68
119
69
-
#### 5. Access the application
120
+
The application is now available at http://localhost:5173
70
121
71
-
Open your browser and navigate to http://localhost:5173 to access the frontend application. The backend API will be running at http://localhost:8001. Swagger at http://localhost:8001/docs
122
+
## Considerations
72
123
73
124
### Debugging in Visual Studio Code
74
125
@@ -82,7 +133,7 @@ Tests are run on every push, and deployment to dev environment are done on merge
82
133
83
134
Deployment to test en prod environment are for now done manually in Radix console
84
135
85
-
### Code spaces
136
+
### GitHub Codespaces
86
137
87
138
If someone fancies using codespaces and wants to break out of the tedious local setup then following steps can be followed.
0 commit comments