Skip to content

Commit dda5f99

Browse files
committed
Document provisioning requirements, enable prettier formatting of markdown files
1 parent 3755945 commit dda5f99

File tree

6 files changed

+362
-291
lines changed

6 files changed

+362
-291
lines changed

.prettierrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"singleQuote": true,
3-
"trailingComma": "all"
3+
"trailingComma": "all",
4+
"proseWrap": "always"
45
}

README.md

Lines changed: 53 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ Requires [Node.js 20 or above](https://nodejs.org/en/).
1414
npm start
1515
```
1616

17-
The site will be available at <http://localhost:5000/>, using a mock
18-
Google authentication server and an in-memory database.
17+
The site will be available at <http://localhost:5000/>, using a mock Google
18+
authentication server and an in-memory database.
1919

2020
See [CONTRIBUTING.md](docs/CONTRIBUTING.md) for full guidance on local
2121
development.
2222

2323
## Building for deployment
2424

2525
You can find pre-built releases at
26-
[Refacto/releases](https://github.com/davidje13/Refacto/releases),
27-
or you can build your own:
26+
[Refacto/releases](https://github.com/davidje13/Refacto/releases), or you can
27+
build your own:
2828

2929
```sh
3030
npm run build
@@ -36,49 +36,77 @@ The output is placed in `build`.
3636

3737
### With Docker
3838

39-
You can deploy using the [Docker Hub image](https://hub.docker.com/r/refacto/refacto):
39+
You can deploy using the
40+
[Docker Hub image](https://hub.docker.com/r/refacto/refacto):
4041

4142
```sh
4243
docker run -d -e INSECURE_SHARED_ACCOUNT_ENABLED=true -p 5000:5000 refacto/refacto
4344
```
4445

45-
(see the image details for information on how to configure and secure docker deployments).
46+
(see the image details for information on how to configure and secure docker
47+
deployments).
4648

4749
### Without Docker
4850

4951
You will need to have Node.js 20 or newer installed in the deployment
5052
environment.
5153

52-
[Download and unpack a release](https://github.com/davidje13/Refacto/releases) (or
53-
[build your own](#building-for-deployment)), then in the release directory run:
54+
[Download and unpack a release](https://github.com/davidje13/Refacto/releases)
55+
(or [build your own](#building-for-deployment)), then in the release directory
56+
run:
5457

5558
```sh
5659
npm install --omit=dev
5760
INSECURE_SHARED_ACCOUNT_ENABLED=true ./index.js
5861
```
5962

63+
### Provisioning
64+
65+
Refacto does not require much CPU or RAM allocated to run smoothly. You should
66+
be able to provision the minimum available CPU on your platform of choice, and
67+
at least 0.5GB RAM (provision 1GB if you expect very heavy usage). One area
68+
which can be improved by allocating more CPU is the password login: this will be
69+
noticeably faster with more CPU resource available (or you can
70+
[enable more hashing rounds](./docs/SECURITY.md#work-factor) to increase
71+
security).
72+
73+
Note that because Refacto uses Web Sockets for live collaboration, you will need
74+
to ensure your deployment is capable of holding open a large number of
75+
simultaneous connections (at least one per expected concurrent user, plus some
76+
extra for static asset and API requests). For small deployments this is not a
77+
concern, as the defaults are usually ample.
78+
79+
You should _not_ enable any auto-scaling provided by your platform. Where
80+
possible, set the maximum number of instances to 1 (note that some platforms
81+
enable auto-scaling by default). For efficiency reasons, Refacto needs all
82+
participants in a particular retro to be connected to the same server, otherwise
83+
they will not see each other's changes in real time. Most deployments will not
84+
need more than a single small instance to run Refacto successfully, but if you
85+
have a very high load and _need_ additional instances, see
86+
[Load Balancing in the services documentation](docs/SERVICES.md#load-balancing)
87+
for an example of how to correctly load balance using an NGINX reverse proxy.
88+
6089
### Configuration
6190

6291
By default:
6392

64-
- no authentication providers are available (setting `INSECURE_SHARED_ACCOUNT_ENABLED`
65-
means everybody who can access the site will be able to see all retros);
66-
- an in-memory database is used
67-
(all data will be lost when the process ends);
68-
- blank secrets are used for encryption and password hashing
69-
(you can use `./scripts/random-secrets.mjs` to generate a set of
70-
secure random secrets for a deployment);
93+
- no authentication providers are available (setting
94+
`INSECURE_SHARED_ACCOUNT_ENABLED` means everybody who can access the site will
95+
be able to see all retros);
96+
- an in-memory database is used (all data will be lost when the process ends);
97+
- blank secrets are used for encryption and password hashing (you can use
98+
`./scripts/random-secrets.mjs` to generate a set of secure random secrets for
99+
a deployment);
71100
- Giphy integration is not enabled;
72101
- haveibeenpwned integration _is_ enabled;
73102
- the server listens on port `5000`.
74103

75-
See [SERVICES.md](docs/SERVICES.md) and
76-
[SECURITY.md](docs/SECURITY.md) for details.
104+
See [SERVICES.md](docs/SERVICES.md) and [SECURITY.md](docs/SECURITY.md) for
105+
details.
77106

78-
The full list of recognised configuration options (and their default
79-
values) can be found in
80-
[config/default.ts](./backend/src/config/default.ts)
81-
(nested properties are joined and written in `UPPER_SNAKE_CASE`).
107+
The full list of recognised configuration options (and their default values) can
108+
be found in [config/default.ts](./backend/src/config/default.ts) (nested
109+
properties are joined and written in `UPPER_SNAKE_CASE`).
82110

83111
Typical values to configure are:
84112

@@ -103,10 +131,10 @@ TOKEN_SECRET_PASSPHRASE="<value-from-random-secrets.mjs>" \
103131

104132
## Services
105133

106-
See the [services documentation](docs/SERVICES.md) for details on
107-
setting up a database and integrating with authentication providers.
134+
See the [services documentation](docs/SERVICES.md) for details on setting up a
135+
database and integrating with authentication providers.
108136

109137
## Extra security
110138

111-
See the [security documentation](docs/SECURITY.md) for details on
112-
configuring additional security for deployments.
139+
See the [security documentation](docs/SECURITY.md) for details on configuring
140+
additional security for deployments.

docs/CONTRIBUTING.md

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ npm start
77
```
88

99
The site (both frontend resources and backend API) will be available at
10-
<http://localhost:5000/>. The frontend will automatically rebuild if
11-
changed, but the backend will not (looking for a good Rollup HMR plugin!)
10+
<http://localhost:5000/>. The frontend will automatically rebuild if changed,
11+
but the backend will not (looking for a good Rollup HMR plugin!)
1212

13-
By default, this will run a mock Google authentication provider and an
14-
in-memory database. To enable real authentication providers (e.g.
15-
Google sign in) and data persistence, see the
16-
[services documentation](./SERVICES.md).
13+
By default, this will run a mock Google authentication provider and an in-memory
14+
database. To enable real authentication providers (e.g. Google sign in) and data
15+
persistence, see the [services documentation](./SERVICES.md).
1716

1817
## Running tests
1918

@@ -49,37 +48,36 @@ To automatically build and run the server, and run tests against it:
4948
npm run test:e2e
5049
```
5150

52-
During development, the build time can be significant. An alternative
53-
is to run the application in the background in watch mode using
54-
`npm start -- --mock-sso` (this differs from `npm start` because it
55-
uses a mock Google single-sign-on endpoint even if you have configured
56-
a real client ID), then run the end-to-end tests against that
57-
deployment:
51+
During development, the build time can be significant. An alternative is to run
52+
the application in the background in watch mode using `npm start -- --mock-sso`
53+
(this differs from `npm start` because it uses a mock Google single-sign-on
54+
endpoint even if you have configured a real client ID), then run the end-to-end
55+
tests against that deployment:
5856

5957
```sh
6058
TARGET_HOST=http://localhost:5000/ MODE=dev npm run test:e2e
6159
```
6260

63-
(`MODE=dev` disables the download time test, as the site is much
64-
larger when built in dev mode via `npm start`)
61+
(`MODE=dev` disables the download time test, as the site is much larger when
62+
built in dev mode via `npm start`)
6563

6664
Run end-to-end tests with non-headless browsers:
6765

6866
```sh
6967
HEADLESS=false npm run test:e2e
7068
```
7169

72-
The server logs generated during the end-to-end test run are written
73-
to `e2e/build/app.log`.
70+
The server logs generated during the end-to-end test run are written to
71+
`e2e/build/app.log`.
7472

7573
## Building
7674

7775
```sh
7876
npm run build
7977
```
8078

81-
The output will be placed in `build`. Specify the `PORT` environment
82-
variable when running (defaults to 5000):
79+
The output will be placed in `build`. Specify the `PORT` environment variable
80+
when running (defaults to 5000):
8381

8482
```sh
8583
cd build
@@ -100,19 +98,19 @@ This client ID is configured for use on `localhost` on ports 80, 443, 8080,
10098
8443, and 5000. The client secret is not required, as Refacto does not access
10199
any personal data.
102100

103-
See the [services documentation](./SERVICES.md) for details on
104-
setting up a database and integrating with authentication providers.
101+
See the [services documentation](./SERVICES.md) for details on setting up a
102+
database and integrating with authentication providers.
105103

106-
See the [security documentation](./SECURITY.md) for additional
107-
considerations when running in production.
104+
See the [security documentation](./SECURITY.md) for additional considerations
105+
when running in production.
108106

109107
## Dependency management
110108

111-
Add dependencies within the `backend`, `frontend` or `e2e` directories;
112-
not in the root of the project.
109+
Add dependencies within the `backend`, `frontend` or `e2e` directories; not in
110+
the root of the project.
113111

114-
Remember that runtime dependencies should be installed with `--save`,
115-
and build / test dependencies should be installed with `--save-dev`.
112+
Remember that runtime dependencies should be installed with `--save`, and build
113+
/ test dependencies should be installed with `--save-dev`.
116114

117115
### Examples
118116

@@ -135,16 +133,19 @@ npm install --save-dev selenium-webdriver
135133

136134
## Browser Support
137135

138-
The latest versions of Google Chrome and Mozilla Firefox are supported,
139-
and the end-to-end tests will run in both (see [Running tests](#running-tests)).
136+
The latest versions of Google Chrome and Mozilla Firefox are supported, and the
137+
end-to-end tests will run in both (see [Running tests](#running-tests)).
140138

141139
## Library documentation
142140

143141
- React: <https://reactjs.org/docs/react-api.html>
144142
- `update`: <https://github.com/davidje13/json-immutability-helper>
145143
- Wouter: <https://github.com/molefrog/wouter>
146144
- Jest: <https://jestjs.io/docs/en/api>
147-
- Flexible Testing Library React <https://github.com/davidje13/flexible-testing-library-react>
145+
- Flexible Testing Library React
146+
<https://github.com/davidje13/flexible-testing-library-react>
148147
- Jest DOM Matchers <https://github.com/testing-library/jest-dom>
149-
- Supertest: <https://github.com/visionmedia/supertest> and <https://visionmedia.github.io/superagent/>
150-
- Selenium: <https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/>
148+
- Supertest: <https://github.com/visionmedia/supertest> and
149+
<https://visionmedia.github.io/superagent/>
150+
- Selenium:
151+
<https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/>

0 commit comments

Comments
 (0)