p5.js-web-editor/developer_docs/installation.md
Abhishek Kumar 0eea37e72a Fixing Spelling Mistake (#913)
* Fixing typos

* Fixed Spellings
2019-03-20 12:43:38 -04:00

4.2 KiB

Development Installation

Follow these instructions to set up your development environment, which you need to do before you start contributing code to this project.

Manual Installation

  1. Install node.js, which also automatically installs the npm package manager.

  2. Fork the p5.js Web Editor repository into your own GitHub account.

  3. Clone your new fork of the repository from GitHub onto your local computer.

    $ git clone https://github.com/YOUR_USERNAME/p5.js-web-editor.git
    
  4. Navigate into the project folder and install all its necessary dependencies with npm.

    $ cd p5.js-web-editor
    $ npm install
    
  5. Install MongoDB and make sure it is running

  6. $ cp .env.example .env

  7. (Optional) Update .env with necessary keys to enable certain app behavoirs, i.e. add Github ID and Github Secret if you want to be able to log in with Github.

  8. $ npm run fetch-examples - this downloads the example sketches into a user called 'p5'

  9. $ npm start

  10. Navigate to http://localhost:8000 in your browser

  11. Install the React Developer Tools

  12. Open and close the Redux DevTools using ctrl+h, and move them with ctrl+w

Docker Installation

Using Docker, you can have a complete, consistent development environment without having to manually install dependencies such as Node, Mongo, etc. It also helps isolate these dependencies and their data from other projects that you may have on the same computer that use different/conflicting versions, etc.

Note that this takes up a significant amount of space on your machine. Make sure you have at least 5GB free.

  1. Install Docker for your operating system
  2. Clone this repository and cd into it
  3. $ docker-compose -f docker-compose-development.yml build
  4. $ cp .env.example .env
  5. (Optional) Update .env with necessary keys to enable certain app behavoirs, i.e. add Github ID and Github Secret if you want to be able to log in with Github.
  6. $ docker-compose -f docker-compose-development.yml run --rm app npm run fetch-examples

Now, anytime you wish to start the server with its dependencies, you can run:

  1. $ docker-compose -f docker-compose-development.yml up
  2. Navigate to http://localhost:8000 in your browser

To open a terminal/shell in the running Docker server (i.e. after docker-compose up has been run):

  1. $ docker-compose -f docker-compose-development.yml exec app bash -l

If you don't have the full server environment running, you can launch a one-off container instance (and have it automatically deleted after you're done using it):

  1. $ docker-compose -f docker-compose-development.yml run app --rm bash -l

S3 Bucket Configuration

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 to set up an S3 bucket to be used with this project.

If your S3 bucket is in the US East (N Virginia) region (us-east-1), you'll need to set a custom URL base for it, because it does not follow the standard naming pattern as the rest of the regions. Instead, add the following to your environment/.env file:

S3_BUCKET_URL_BASE=https://s3.amazonaws.com

If you've configured your S3 bucket and DNS records to use a custom domain name, you can also set it using this variable. I.e.:

S3_BUCKET_URL_BASE=https://files.mydomain.com

For more information on using a custom domain, see this documentation link:

http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#VirtualHostingCustomURLs