Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddasol committed Jan 31, 2025
1 parent 0f02d15 commit c668286
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 55 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/0b37a44f66044dbc81fff906344b476e)](https://www.codacy.com/gh/equinor/flotilla/dashboard?utm_source=github.com&utm_medium=referral&utm_content=equinor/flotilla&utm_campaign=Badge_Grade)

Flotilla is the main point of access for operators to interact with multiple robots in multiple facilities.
The application consists of a [frontend](frontend) in React, a [backend](backend) in ASP.NET and a Mosquitto MQTT [Broker](broker).
The application consists of a [frontend](frontend) in React, a [backend](backend) in ASP.NET, and a Mosquitto MQTT [Broker](broker).

## Deployments

We currently have 3 environment (Development, Staging and Production) deployed to Aurora.
We currently have 3 environments (Development, Staging, and Production) deployed to Aurora.

| Environment | Deployment | Status |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand All @@ -32,17 +32,17 @@ Please see separate installation guides for the [frontend](frontend), [backend](
Run the [setup.sh](./setup.sh) to automatically set up your dev environment for the components.
This script will ask you for the `Client Secret` for the backend and the `MQTT broker server key` for the MQTT broker.

## Run with docker
## Run with Docker

Install [docker](https://docs.docker.com/engine/install/ubuntu/) and [docker compose](https://docs.docker.com/compose/install/).
Install [Docker](https://docs.docker.com/engine/install/ubuntu/) and [Docker Compose](https://docs.docker.com/compose/install/).

Build the docker container:
Build the Docker container:

```
docker compose build
```

Setup a .env file in the backend directory with the following environment variables:
Set up a .env file in the backend directory with the following environment variables:

```
AZURE_CLIENT_ID
Expand All @@ -66,4 +66,4 @@ docker compose up --build

Equinor welcomes all kinds of contributions, including code, bug reports, issues, feature requests, and documentation.
Please initiate your contribution by creating an [issue](https://github.com/equinor/isar/issues) or by forking the
project and making a pull requests. Commit messages shall be written according to [this guide](https://cbea.ms/git-commit/).
project and making a pull request. Commit messages shall be written according to [this guide](https://cbea.ms/git-commit/).
33 changes: 16 additions & 17 deletions broker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

The broker expects a private key for its server x509 certificate used for TLS.
This must be provided through an environment variable called `FLOTILLA_BROKER_SERVER_KEY`.
This is a secret, and should be treated as such. It can be found in our keyvault.
This is a secret and should be treated as such. It can be found in our key vault.

### Automatic environment setup

See [Flotilla readme](../README.md#automatic-environment-setup)

### Manual environment setup

The best way to pass this is to store it in a `.env` file in the root of flotilla, and docker compose loads this by default on startup.
The best way to pass this is to store it in a `.env` file in the root of flotilla, and Docker Compose loads this by default on startup.
See [Using the “--env-file” option](https://docs.docker.com/compose/environment-variables/#using-the---env-file--option) for more information.

## Running the broker
Expand All @@ -23,11 +23,11 @@ From the flotilla root directory, run the following command:
docker compose up --build broker
```

If address is already in use, you might have to kill the mosquitto process `sudo pkill mosquitto`
If the address is already in use, you might have to kill the Mosquitto process `sudo pkill mosquitto`.

## Authentication

The broker has been setup with role based authentication.
The broker has been set up with role-based authentication.
The current roles with their permissions per topic are described in the table below.

| | read | write |
Expand All @@ -40,17 +40,17 @@ To change the password see [this guide](https://mosquitto.org/documentation/auth
on how to manage the [password file](./mosquitto/config/passwd_file).

To change the roles see [this guide]()
on how to manage the role based access control.
on how to manage the role-based access control.
They are defined in the [access_control file](./mosquitto/config/access_control).

## Installing broker outside of docker
## Installing broker outside of Docker

To test the dockerized broker, the functions `mosquitto_sub` and `mosquitto_pub` are useful.
To gain access to them on your machine you will need to install the mosquitto broker.
To gain access to them on your machine you will need to install the Mosquitto broker.

### Linux installation

To install the Mosquitto broker run the following commands
To install the Mosquitto broker run the following commands:

```
sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
Expand All @@ -62,17 +62,16 @@ sudo apt-get install mosquitto-clients
### Windows installation

Go to the [official Mosquitto download page](https://mosquitto.org/download/) and download and install the
binaries for windows.
binaries for Windows.

Then add the installation folder to your PATH variable for the commands to be available from your terminal.

### Start non-docker broker
### Start non-Docker broker

If running the broker outside docker, you will need to manually create the `server-key.pem` file, containing the secret server key
mentioned in the [setup section](#set-up-the-broker).
The mosquitto config file expects this file to be stored in the [mosquitto/config/certs](./mosquitto/config/certs) folder.
If running the broker outside Docker, you will need to manually create the `server-key.pem` file, containing the secret server key mentioned in the [setup section](#set-up-the-broker).
The Mosquitto config file expects this file to be stored in the [mosquitto/config/certs](./mosquitto/config/certs) folder.

The broker may then be started with
The broker may then be started with:

```
mosquitto -p 1883 -c mosquitto/config/mosquitto.conf
Expand All @@ -82,17 +81,17 @@ mosquitto -p 1883 -c mosquitto/config/mosquitto.conf

To test that the broker functions as expected the `mosquitto_sub` and `mosquitto_pub` tools that are wrapped in the installation may be used.
For access to all topics, you need to use the admin user.
The password for the admin can be found in our keyvault.
The password for the admin can be found in our key vault.

For the TLS encryption, you will need to reference the CA certificate. This is not a secret and can be found in [mosquitto/config/certs](./mosquitto/config/certs).

First, subscribe to a topic
First, subscribe to a topic:

```
mosquitto_sub -t topic_name -u admin -P secret_password --cafile ca-cert.pem
```

Then attempt to publish something to the same topic in a different terminal
Then attempt to publish something to the same topic in a different terminal:

```
mosquitto_pub -t topic_name -m hei -u admin -P secret_password --cafile ca-cert.pem
Expand Down
34 changes: 17 additions & 17 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Flotilla frontend

This document describes how to run the frontend. For information on best practises related to development, [see the best practises document](./best_practises.md).
This document describes how to run the frontend. For information on best practices related to development, [see the best practices document](./best_practices.md).

## Setup

Expand All @@ -11,7 +11,7 @@ The application reads environment variables from the `.env` file in the `fronten

### Automatic environment setup

See [Flotilla readme](../README.md#automatic-environment-setup)
See [Flotilla readme](../README.md#automatic-environment-setup).

### Manual environment setup

Expand All @@ -33,53 +33,53 @@ To start the app, run the following command in the root folder:
npm start
```

This command runs the app in the development mode. Open [http://localhost:3001/robotics-frontend](http://localhost:3001/robotics-frontend) to view it in the browser.
This command runs the app in development mode. Open [http://localhost:3001/robotics-frontend](http://localhost:3001/robotics-frontend) to view it in the browser.

The page will reload if you make edits. You will also be able to see any lint errors in the console.

## Run in Docker

To run the frontend in docker, run the following command in the root folder of flotilla:
To run the frontend in Docker, run the following command in the root folder of Flotilla:

```
docker compose up --build frontend
```

## Authentication

Authentication is implemented for the frontend following the [official Microsoft tutorial on Oauth2 flow in React](https://docs.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-react).
Authentication is implemented for the frontend following the [official Microsoft tutorial on OAuth2 flow in React](https://docs.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-react).

## Automatically generated models

The typescript models have been automatically generated using an [openapi-to-typescript npm package](https://www.npmjs.com/package/openapi-typescript).
The TypeScript models have been automatically generated using an [openapi-to-typescript npm package](https://www.npmjs.com/package/openapi-typescript).
This can be updated by cloning the [flotilla-openapi](https://github.com/equinor/flotilla-openapi) repository and then running:

```bash
npx openapi-typescript <path-to-flotilla-openapi>/openapi.yaml --output ./src/models/schema.ts
npx openapi-typescript <path-to-flotilla-openapi>/openapi.yaml --output ./src/models/schema.ts
```

## Formatting

We use prettier for formatting.
To test the formatting locally, run
We use Prettier for formatting.
To test the formatting locally, run:

```
npm run prettier_check
```

We recommend to install the [prettier extension for vs code](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
and set the `format on save` option for vs code to true.
You can do this by going to `File` -> `Preferences` -> `Settings` and then searching for "Format On Save" and tick the box.
We recommend installing the [Prettier extension for VS Code](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
and setting the `format on save` option for VS Code to true.
You can do this by going to `File` -> `Preferences` -> `Settings` and then searching for "Format On Save" and ticking the box.

## Config

The application reads custom environment variables from the `.env` file on startup. The files need to be prefixed `VITE_` to be included in the application.
The application reads custom environment variables from the `.env` file on startup. The variables need to be prefixed with `VITE_` to be included in the application.
These are parsed and defined in [config.ts](./src/config.ts).

## Run locally with Staging and Prod Databases

To run locally towards the databases follow the steps below:
To run locally towards the databases, follow the steps below:

1. Change UseInMemoryDatabase to false on appsettings.Local and set ASPNETCORE_ENVIRONMENT to the correct environment on launchSettings.json.
2. Update AZURE_CLIENT_ID and AZURE_CLIENT_SECRET in the .env located in backend/api folder.
3. Update VITE_BACKEND_API_SCOPE in the .env located in the frontend folder.
1. Change `UseInMemoryDatabase` to `false` in `appsettings.Local` and set `ASPNETCORE_ENVIRONMENT` to the correct environment in `launchSettings.json`.
2. Update `AZURE_CLIENT_ID` and `AZURE_CLIENT_SECRET` in the `.env` file located in the `backend/api` folder.
3. Update `VITE_BACKEND_API_SCOPE` in the `.env` file located in the `frontend` folder.
Loading

0 comments on commit c668286

Please sign in to comment.