Skip to content

Commit 229f86c

Browse files
authored
Merge pull request #3082 from beccyabraham/feature/update-contributor-docs
Update contributor docs for clarity
2 parents 0df9082 + 44faf23 commit 229f86c

File tree

2 files changed

+84
-23
lines changed

2 files changed

+84
-23
lines changed

contributor_docs/installation.md

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ _Note_: The installation steps assume you are using a Unix-like shell. If you ar
1414
$ git clone https://github.com/YOUR_USERNAME/p5.js-web-editor.git
1515
```
1616

17-
4. If you are using nvm, run `$ nvm use` to set your Node version to 16.14.2
17+
4. If you are using nvm, run `$ nvm use 16.14.2` to set your Node version to 16.14.2
1818
5. Ensure your npm version is set to 8.5.0. If it isn't, run `npm install -g npm@8.5.0` to install it.
1919
6. Navigate into the project folder and install all its necessary dependencies with npm.
2020

@@ -27,12 +27,14 @@ _Note_: The installation steps assume you are using a Unix-like shell. If you ar
2727
* For Windows and Linux: [MongoDB Installation](https://docs.mongodb.com/manual/installation/)
2828
8. `$ cp .env.example .env`
2929
9. (Optional) Update `.env` with necessary keys to enable certain app behaviors, i.e. add Github ID and Github Secret if you want to be able to log in with Github.
30-
10. Run `$ npm run fetch-examples` to download the example sketches into a user called 'p5'. Note that you need to configure your GitHub Credentials, which you can do by following the [Github API Configuration](#github-api-configuration) section.
31-
11. Enable Prettier in your text editor by following [this guide](https://prettier.io/docs/en/editors.html).
32-
12. `$ npm start`
33-
13. Navigate to [http://localhost:8000](http://localhost:8000) in your browser
34-
14. Install the [React Developer Tools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en)
35-
15. Open and close the Redux DevTools using `ctrl+h`, and move them with `ctrl+w`
30+
* See the [GitHub API Configuration](#github-api-configuration) section for information on how to authenticate with Github.
31+
* See the [S3 Bucket Configuration](#s3-bucket-configuration) section for information on how to set up an S3 bucket
32+
11. Run `$ npm run fetch-examples` to download the example sketches into a user called 'p5'. Note that you need to configure your GitHub Credentials, which you can do by following the [Github API Configuration](#github-api-configuration) section.
33+
12. Enable Prettier in your text editor by following [this guide](https://prettier.io/docs/en/editors.html).
34+
13. `$ npm start`
35+
14. Navigate to [http://localhost:8000](http://localhost:8000) in your browser
36+
15. Install the [React Developer Tools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en)
37+
16. Open and close the Redux DevTools using `ctrl+h`, and move them with `ctrl+w`
3638

3739
## Docker Installation
3840

@@ -50,6 +52,8 @@ Note that this takes up a significant amount of space on your machine. Make sure
5052
4. `$ docker-compose -f docker-compose-development.yml build`
5153
5. `$ cp .env.example .env`
5254
6. (Optional) Update `.env` with necessary keys to enable certain app behaviors, i.e. add Github ID and Github Secret if you want to be able to log in with Github.
55+
* See the [GitHub API Configuration](#github-api-configuration) section for information on how to authenticate with Github.
56+
* See the [S3 Bucket Configuration](#s3-bucket-configuration) section for information on how to set up an S3 bucket
5357
7. `$ docker-compose -f docker-compose-development.yml run --rm app npm run fetch-examples` - note that you need to configure your GitHub Credentials, which you can do by following the [Github API Configuration](#github-api-configuration) section.
5458
8. Enable Prettier in your text editor by following [this guide](https://prettier.io/docs/en/editors.html).
5559

@@ -68,22 +72,9 @@ If you don't have the full server environment running, you can launch a one-off
6872

6973
## S3 Bucket Configuration
7074

71-
Note that this is optional unless you are working on the part of the application that allows a user to upload images, videos, etc. Please refer to the following [gist](https://gist.github.com/catarak/70c9301f0fd1ac2d6b58de03f61997e3) to set up an S3 bucket to be used with this project.
75+
See [this configuration guide](./s3_configuration.md) for information about how to configure your own S3 bucket. These instructions were adapted from [this gist](https://gist.github.com/catarak/70c9301f0fd1ac2d6b58de03f61997e3).
7276

73-
If your S3 bucket is in the US East (N Virginia) region (us-east-1), you'll
74-
need to set a custom URL base for it, because it does not follow the standard
75-
naming pattern as the rest of the regions. Instead, add the following to your
76-
environment/.env file, changing `BUCKET_NAME` to your bucket name. This is necessary because this override is currently treated as the full path to the bucket rather than as a proper base URL:
77-
`S3_BUCKET_URL_BASE=https://s3.amazonaws.com/{BUCKET_NAME}/`
78-
79-
If you've configured your S3 bucket and DNS records to use a custom domain
80-
name, you can also set it using this variable. I.e.:
81-
82-
`S3_BUCKET_URL_BASE=https://files.mydomain.com`
83-
84-
For more information on using a custom domain, see this documentation link:
85-
86-
http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#VirtualHostingCustomURLs
77+
Note that this is optional unless you are working on the part of the application that allows a user to upload images, videos, etc.
8778

8879
## GitHub API Configuration
8980

@@ -94,9 +85,15 @@ In this application, GitHub credentials are used for:
9485

9586
If you are working on a part of the application that requires one of the above uses, then you will need to get GitHub API credentials.
9687

97-
When you go to the Developer settings in your GitHub account, you will see that you can create two types of Apps: `GitHub Apps` and `OAuth Apps` ([differences between GitHub Apps and OAuth Apps](https://docs.github.com/en/free-pro-team@latest/developers/apps/differences-between-github-apps-and-oauth-apps)). This project requires you to make an `OAuth App`. After clicking on "New OAuth App", you will need to fill in the following fields:
88+
When you go to the [Developer settings](https://github.com/settings/developers) in your GitHub account, you will see that you can create two types of Apps: `GitHub Apps` and `OAuth Apps` ([differences between GitHub Apps and OAuth Apps](https://docs.github.com/en/free-pro-team@latest/developers/apps/differences-between-github-apps-and-oauth-apps)). This project requires you to make an `OAuth App`. After clicking on "New OAuth App", you will need to fill in the following fields:
9889
- **Application name**: `p5.js Web Editor - Local`
9990
- **Homepage URL**: `http://localhost:8000`
10091
- **Authorization Callback URL**: `http://localhost:8000/auth/github/callback`
10192

93+
Once you've created a new OAuth app, update your `.env`:
94+
```
95+
GITHUB_ID={GITHUB_ID}
96+
GITHUB_SECRET={GITHUB_SECRET}
97+
```
98+
10299
If you would like to learn more about what you can do with the GitHub API, you can look at the [API documentation](https://developer.github.com/v3/).

contributor_docs/s3_configuration.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# S3 Bucket Configuration
2+
1. [Create an S3 bucket](https://docs.aws.amazon.com/AmazonS3/latest/userguide/create-bucket-overview.html), with any name
3+
2. Navigate to the S3 bucket permissions and add the following CORS policy. This is for development only, as it allows CORS from any origin.
4+
```
5+
[
6+
{
7+
"AllowedHeaders": [
8+
"*"
9+
],
10+
"AllowedMethods": [
11+
"GET",
12+
"PUT",
13+
"POST",
14+
"DELETE",
15+
"HEAD"
16+
],
17+
"AllowedOrigins": [
18+
"*"
19+
],
20+
"ExposeHeaders": []
21+
}
22+
]
23+
```
24+
3. In permissions, add the following bucket policy. Change "YOUR_BUCKET_NAME" to reflect name of the S3 bucket.
25+
```
26+
{
27+
"Version": "2008-10-17",
28+
"Id": "Policy1397632521960",
29+
"Statement": [
30+
{
31+
"Sid": "Stmt1397633323327",
32+
"Effect": "Allow",
33+
"Principal": {
34+
"AWS": "*"
35+
},
36+
"Action": "s3:GetObject",
37+
"Resource": "arn:aws:s3:::YOUR_BUCKET_NAME_HERE/*"
38+
}
39+
]
40+
}
41+
```
42+
4. Uncheck "Block all public access" under "Block public access (bucket settings)".
43+
5. Under "Object Ownership", check "ACLs enabled" and set "Object Ownership" to "Object writer"
44+
6. Locate your AWS key and Secret Key. You can find this in the top AWS navigation under your name -> Security Credentials.
45+
7. Update the following lines to your .env file:
46+
```
47+
AWS_ACCESS_KEY={AWS_ACCESS_KEY}
48+
AWS_REGION={S3_BUCKET_REGION}
49+
AWS_SECRET_KEY={AWS_SECRET_KEY}
50+
S3_BUCKET={S3_BUCKET_NAME}
51+
```
52+
53+
If your S3 bucket is in the US East (N Virginia) region (us-east-1), you'll
54+
need to set a custom URL base for it, because it does not follow the standard
55+
naming pattern as the rest of the regions. Instead, add the following to your
56+
environment/.env file, changing `BUCKET_NAME` to your bucket name. This is necessary because this override is currently treated as the full path to the bucket rather than as a proper base URL:
57+
`S3_BUCKET_URL_BASE=https://s3.amazonaws.com/{BUCKET_NAME}/`
58+
59+
If you've configured your S3 bucket and DNS records to use a custom domain
60+
name, you can also set it using this variable. I.e.:
61+
62+
`S3_BUCKET_URL_BASE=https://files.mydomain.com`
63+
64+
For more information on using a custom domain, see [this documentation link](http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#VirtualHostingCustomURLs).

0 commit comments

Comments
 (0)