Skip to content

Commit a68e6c1

Browse files
pinkwahharalde
authored andcommitted
Update README
1 parent 87ff9e7 commit a68e6c1

1 file changed

Lines changed: 91 additions & 40 deletions

File tree

README.md

Lines changed: 91 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,72 +3,123 @@
33

44
# AcidWatch
55

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.
712

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
914

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.
1116

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/
1318

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
1720

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).
1923

20-
## How to build AcidWatch locally
24+
### Backend
2125

22-
Before you begin, ensure you have the following installed on your machine:
26+
The backend is written using FastAPI and SQLAlchemy.
2327

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)
27-
- [Poetry](https://python-poetry.org/) (for managing Python dependencies)
28+
Using Poetry, install AcidWatch's backend using the following command:
2829

29-
### Getting Started
30+
``` sh
31+
poetry -C backend install
32+
```
3033

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.
3238
33-
Clone the repository to your local machine:
39+
Then, run the backend in development mode using the following command:
3440

35-
```sh
36-
git clone git@github.com:equinor/acidwatch.git
37-
cd acidwatch
41+
``` sh
42+
poetry -C backend run acidwatch-api
3843
```
3944

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.
4147

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).
4350

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
4552

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
5164
```
5265

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.
5469
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
5672

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:
81+
82+
``` sh
83+
# Over TCP/IP
84+
ACIDWATCH_DATABASE=postgres://[username]:[password]@[hostname]:[port]/[database]
85+
86+
# Over UNIX sockets
87+
ACIDWATCH_DATABASE=postgres:///[database]?host=[path]
88+
89+
# For example:
90+
ACIDWATCH_DATABASE=postgres://postgres:password@localhost:5432/acidwatch
6191
```
6292

63-
#### 4. Start models
93+
AcidWatch uses SQLAlchemy's Alembic to handle migrations. Run `poetry -C backend
94+
run alembic migrate head` to migrate the database to the current schema.
95+
96+
#### Other databases & related material
97+
98+
For other databases, refer to SQLAlchemy documentation on how to create
99+
100+
### Frontend
101+
102+
The frontend uses Vite and React. Components are provided by the official
103+
[Equinor Design System](https://eds.equinor.com) React library.
64104

65-
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:
66105

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+
```
68119

69-
#### 5. Access the application
120+
The application is now available at http://localhost:5173
70121

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
72123

73124
### Debugging in Visual Studio Code
74125

@@ -82,7 +133,7 @@ Tests are run on every push, and deployment to dev environment are done on merge
82133

83134
Deployment to test en prod environment are for now done manually in Radix console
84135

85-
### Code spaces
136+
### GitHub Codespaces
86137

87138
If someone fancies using codespaces and wants to break out of the tedious local setup then following steps can be followed.
88139

0 commit comments

Comments
 (0)