Skip to content

Commit 289489c

Browse files
committed
Switch to yarn and update scripts and readme
1 parent d6bf558 commit 289489c

11 files changed

+24765
-35808
lines changed

Dockerfile

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
FROM node:14.15-alpine
1+
FROM node:14-alpine
22

33
# Bundle Source
44
RUN mkdir -p /usr/src/bolt
55
WORKDIR /usr/src/bolt
66
COPY . /usr/src/bolt
7-
RUN npm install --unsafe-perm
7+
RUN yarn install
88

99
# Set Timezone to EST
1010
RUN apk add tzdata
1111
ENV TZ="/usr/share/zoneinfo/America/New_York"
1212

13-
FROM node:14.15-alpine
13+
FROM node:14-alpine
1414
COPY --from=0 /usr/src/bolt/server/ /usr/src/bolt/server/
1515
COPY --from=0 /usr/src/bolt/client/ /usr/src/bolt/client/
1616
WORKDIR /usr/src/bolt
17+
1718
EXPOSE 3000
1819
WORKDIR /usr/src/bolt/server
19-
CMD ["npm", "run", "start:server"]
20+
CMD ["yarn", "start-migrate"]

README.md

+39-51
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,63 @@
11
# bolt
2+
23
Simple and efficient hardware checkout system
34

45
# Server setup
5-
Required items:
66

7-
- A postrgesql server and database
8-
- Install dependencies: `npm install`
9-
- **NOTE:** For server deployments, the `postinstall` NPM script, which will also run when you run `npm install`, will
10-
try to run the Knex (database abstraction layer) migrations. Since you probably haven't added your database configuration,
11-
this step will fail. Just ignore the error for now and follow the steps after this to properly run the migrations.
12-
- Configure the required environment variables in `configs/config.json`. You can copy and rename `configs/configs.json.example`.
13-
- Re-run the database migrations using `npm run knex:migrate:latest`.
7+
Required items:
148

15-
By default, DB migrations will run automatically if you run `npm start`. To avoid this, you can start the server using `npm run dev` or `npm run start:no-migration` and database migrations will *not* run before you start the server.
9+
- A postrgesql server and database
10+
- Install dependencies: `yarn install`
11+
- Configure the required environment variables in `configs/config.json`. You can copy and rename `configs/configs.json.example`.
12+
- Run the database migrations using `yarn migrate:dev`.
13+
- Start the server for development with `yarn dev`
1614

1715
# Client setup
1816

1917
Note: the hardware desk page (/admin/desk) relies on a WebSocket connection to the server. The client assumes that you are
20-
running the server on port 3000. If this isn't right, then you'll need to update the port in
18+
running the server on port 3000. If this isn't right, then you'll need to update the port in
2119

2220
1. The `proxy` property in the **client's** package.json file
2321
2. The local development WebSocket URL in `client/index.tsx`
2422
3. `baseUrl` in `client/src/components/admin/AdminOverviewContainer.tsx`
2523

26-
to use the correct server port. Make sure you don't commit the files with the changed port!
27-
28-
Required environment variables
29-
-----
24+
to use the correct server port. Make sure you don't commit the files with the changed port!
25+
26+
## Required environment variables
3027

3128
### Backend
32-
| Variable | Description |
33-
|----|----|
34-
| secrets.adminKey | Random string of letters and numbers
35-
| secrets.session | Random string of letters and numbers used to secure sessions
36-
| secrets.groundTruth.url | URL to [Ground Truth](https://github.com/hackgt/ground-truth) authentication service
37-
| secrets.groundTruth.id | Client ID provided by Ground Truth
38-
| secrets.groundTruth.secret | Client secret provided by Ground Truth
39-
| secrets.admins.domains | Email domains that will result in a user being automatically made an admin
40-
| secrets.admins.emails | Email address that will result in a user being automatically made an admin
41-
| secrets.server.postgresURL | URL to connect to the postgresql database. If you need to supply database connection credentials, this is the place to do it.
42-
| secrets.server.isProduction | Boolean indicating whether to run the server in production mode.
43-
| secrets.server.defaultTimezone | Default server timezone
29+
30+
| Variable | Description |
31+
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
32+
| secrets.adminKey | Random string of letters and numbers |
33+
| secrets.session | Random string of letters and numbers used to secure sessions |
34+
| secrets.groundTruth.url | URL to [Ground Truth](https://github.com/hackgt/ground-truth) authentication service |
35+
| secrets.groundTruth.id | Client ID provided by Ground Truth |
36+
| secrets.groundTruth.secret | Client secret provided by Ground Truth |
37+
| secrets.admins.domains | Email domains that will result in a user being automatically made an admin |
38+
| secrets.admins.emails | Email address that will result in a user being automatically made an admin |
39+
| secrets.server.postgresURL | URL to connect to the postgresql database. If you need to supply database connection credentials, this is the place to do it. |
40+
| secrets.server.isProduction | Boolean indicating whether to run the server in production mode. |
41+
| secrets.server.defaultTimezone | Default server timezone |
4442

4543
### Frontend
46-
In /client, .env contains defaults for required variables. Create .env.local to override these environment
44+
45+
In /client, .env contains defaults for required variables. Create .env.local to override these environment
4746
variables, or define them as temporary environment variables in your shell.
4847

49-
| Variable | Description |
50-
|----|----|
51-
| REACT_APP_ENABLE_BUGSNAG | "true" or "false" whether to enable the Bugsnag integration. Keep disabled for local development unless testing Bugsnag-specific features
52-
| REACT_APP_BUGSNAG_API_KEY | Required if REACT_APP_ENABLE_BUGSNAG is enabled. Value should be the Notifier API Key for the Bugsnag project
48+
| Variable | Description |
49+
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
50+
| REACT_APP_ENABLE_BUGSNAG | "true" or "false" whether to enable the Bugsnag integration. Keep disabled for local development unless testing Bugsnag-specific features |
51+
| REACT_APP_BUGSNAG_API_KEY | Required if REACT_APP_ENABLE_BUGSNAG is enabled. Value should be the Notifier API Key for the Bugsnag project |
52+
53+
# Development
5354

54-
Development
55-
====
5655
- For local development:
5756
- Access server endpoints, such as authentication, using the development server.
58-
- For frontend development, run `npm start` inside the `/client` directory.
59-
- You can find GraphiQL at `/api/graphiql`, but note that this endpoint is restricted to admin users. For local development,
60-
promote your account to an admin in order to access GraphiQL.
61-
62-
Code Style
63-
----
64-
Code style is enforced by tslint. The project standard is 4-space indentation; please ensure that any files you change
65-
comply with this.
66-
67-
If you use an editor like IntelliJ, you can automatically apply most of the code style specifications found in `tslint.json`.
68-
69-
Database
70-
----
71-
**Note** - If you add an item to the database manually (e.g., by manually executing SQL queries in Postgres),
72-
knex (our DB query builder) will not know about this and you'll get errors on any table that has an auto-incrementing
73-
primary key. Solution: keep running your query (if the IDs are still a low number) and eventually knex will catch up, or
74-
only insert rows into these tables through existing Bolt APIs (e.g., create items using the GraphQL API or web UI).
75-
Source: https://github.com/tgriesser/knex/issues/1855#issuecomment-416076299
57+
- For frontend development, run `yarn start` inside the `/client` directory.
58+
- You can find GraphiQL at `/api/graphiql`, but note that this endpoint is restricted to admin users. For local development,
59+
promote your account to an admin in order to access GraphiQL.
60+
61+
## Code Style
62+
63+
Code style is enforced by eslint, prettier, and stylelint via config.

client/.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@
2121
npm-debug.log*
2222
yarn-debug.log*
2323
yarn-error.log*
24-
package-lock.json
25-
yarn.lock
24+
package-lock.json

0 commit comments

Comments
 (0)