Merge pull request #706 from processing/production-docker
Production deployment
This commit is contained in:
commit
fc8e6144a1
56 changed files with 1582 additions and 1141 deletions
11
.env.example
11
.env.example
|
@ -10,6 +10,13 @@ GITHUB_ID=<your-github-client-id>
|
|||
GITHUB_SECRET=<your-github-client-secret>
|
||||
GOOGLE_ID=<your-google-client-id> (use google+ api)
|
||||
GOOGLE_SECRET=<your-google-client-secret> (use google+ api)
|
||||
MAILGUN_DOMAIN=<your-mailgun-domain>
|
||||
MAILGUN_KEY=<your-mailgun-api-key>
|
||||
EXAMPLE_USER_EMAIL=<your-email-id>
|
||||
EXAMPLE_USER_PASSWORD=<your-password>
|
||||
EMAIL_SENDER=<transactional-email-sender>
|
||||
EMAIL_VERIFY_SECRET_TOKEN=whatever_you_want_this_to_be_it_only_matters_for_production
|
||||
S3_BUCKET_URL_BASE=<alt-for-s3-url>
|
||||
EXAMPLE_USER_EMAIL=examples@p5js.org
|
||||
EXAMPLE_USER_PASSWORD=hellop5js
|
||||
GG_EXAMPLES_USERNAME=generative-design
|
||||
GG_EXAMPLES_PASS=generativedesign
|
||||
GG_EXAMPLES_EMAIL=benedikt.gross@generative-gestaltung.de
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
webpack.config.js
|
||||
webpack/*
|
||||
index.js
|
58
contributing.md → .github/CONTRIBUTING.md
vendored
58
contributing.md → .github/CONTRIBUTING.md
vendored
|
@ -1,17 +1,12 @@
|
|||
# Contributing to the p5.js web editor
|
||||
# Contributing to the p5.js Web Editor
|
||||
|
||||
Hello! We welcome community contributions to the p5.js web editor. Contributing takes many forms and doesn't have to be **writing code**, it can be **documenting bugs**, **proposing new features**, and **updating documentation**. We would also like to Thank you for choosing to contribute p5.js web editor, any way possible. You are awesome! :blush:
|
||||
|
||||
This **web editor** for **p5.js**, a JavaScript library with the goal of making coding accessible to **artists**, **designers**, **educators**, and **beginners**, is an environment to make p5.js sketches without needing to download any software or do any configuration, which makes it a great place to start learning how to code and start learning p5.js.
|
||||
Hello! We welcome community contributions to the p5.js Web Editor. Contributing takes many forms and doesn't have to be **writing code**, it can be **report bugs**, **proposing new features**, **creating UI/UX designs**, and **updating documentation**.
|
||||
|
||||
Here are links to all the sections in this document:
|
||||
|
||||
<!-- If you change any of the headings in this document, remember to update the table of contents. -->
|
||||
|
||||
- [Code of Conduct](#code-of-conduct)
|
||||
- [Technologies Used](#technologies-used)
|
||||
- [Development Installation](#development-installation)
|
||||
- [New Design](#new-design)
|
||||
- [How Can I Contribute ?](#how-can-i-contribute?)
|
||||
- [First Timers](#first-timers)
|
||||
- [Want something more challenging](#want-something-more-challenging)
|
||||
|
@ -19,35 +14,11 @@ Here are links to all the sections in this document:
|
|||
- [Creating a Pull request](#creating-a-pull-request)
|
||||
- - [Tips](#tips)
|
||||
|
||||
# Code of Conduct
|
||||
## Code of Conduct
|
||||
|
||||
Please follow the guidelines mentioned at [CODE OF CONDUCT.md](https://github.com/processing/p5.js-web-editor/blob/master/CODE_OF_CONDUCT.md#p5js-code-of-conduct).
|
||||
|
||||
# Technologies Used
|
||||
|
||||
> **MERN stack - MongoDB, Express, React/Redux, and Node**.
|
||||
|
||||
- For a reference to the **file structure format** I am using, please look at the [Mern Starter](https://github.com/Hashnode/mern-starter).
|
||||
|
||||
- This project **does not use CSS Modules, but uses Sass**. [BEM guidelines and naming conventions](http://getbem.com/) are followed.
|
||||
|
||||
- For repeatitive and common styles, write OOSCSS (Object-Oriented SCSS) with placeholders and mixins. For organizing styles, follow the 7-1 Pattern for Sass.
|
||||
|
||||
- We're using [ES6](http://es6-features.org/) and transpiling to ES5 using [Babel](https://babeljs.io/).
|
||||
|
||||
- For reference to the JavaScript style guide, see the [Airbnb Style Guide](https://github.com/airbnb/javascript), [React ESLint Plugin](https://github.com/yannickcr/eslint-plugin-react).
|
||||
|
||||
- The ESLint configuration is based on a few popular React/Redux boilerplates. Open to suggestions on this. If in development, **you're getting annoyed with ESLint**, you can **remove** it from `webpack.config.dev.js` in the JavaScript loader, or disable any line from eslint by commenting at the end of the line `// eslint-disable-line`.
|
||||
|
||||
# Development Installation
|
||||
|
||||
To get started on a patch, first read the instruction from [README.md](https://github.com/processing/p5.js-web-editor#development-installation).
|
||||
|
||||
# New Design
|
||||
|
||||
Design proposed and theme changes are present at: [Zeplin](https://scene.zeplin.io/project/55f746c54a02e1e50e0632c3).
|
||||
|
||||
# How Can I Contribute?
|
||||
## How Can I Contribute?
|
||||
|
||||
### First Timers
|
||||
For first-time contributors or those who want to start with a small task: [check out our list of good first bugs](https://github.com/processing/p5.js-web-editor/labels/good%20first%20issue). First read the github discussion on that issue and find out if there's currently a person working on that or not. If no one is working on it or if there has was one claimed to but has not been active for a while, ask if it is up for grabs. It's okay to not know how to fix an issue and feel free to ask questions about to approach the problem! We are all just here to learn and make something awesome. Someone from the community would help you out and these are great issues for learning about the web editor, its file structure and its development process.
|
||||
|
@ -59,31 +30,14 @@ If you're already familiar with the project or would like take on something a li
|
|||
If you want to work on building new things, please take a look at [type: feature](https://github.com/processing/p5.js-web-editor/labels/type%3Afeature).
|
||||
|
||||
If you'd like to work on a bug, please comment on it to let the maintainers know.
|
||||
If someone else has already commented and taken up that bug, please refrain from working on it and submitting
|
||||
a PR without asking the maintainers as it leads to unnecessary duplication of effort.
|
||||
If someone else has already commented and taken up that bug, please refrain from working on it and submitting a PR without asking the maintainers as it leads to unnecessary duplication of effort.
|
||||
|
||||
### Contribution guides
|
||||
|
||||
* [https://guides.github.com/activities/hello-world/](https://guides.github.com/activities/hello-world/)
|
||||
* [https://guides.github.com/activities/forking/](https://guides.github.com/activities/forking/)
|
||||
|
||||
# Creating a pull request
|
||||
|
||||
Set up a new remote that points to the original project so that you can update your local repository once any changes have made to remote.
|
||||
|
||||
$ git remote add upstream https://github.com/processing/p5.js-web-editor
|
||||
|
||||
and also before you submit a [pull request](https://help.github.com/articles/creating-a-pull-request/), please remember to fetch the changes using:
|
||||
|
||||
$ git fetch upstream
|
||||
|
||||
When you create a pull request for a new fix or feature, be sure to mention the issue number for what you're working on. The best way to do it is to mention the issue like this at the top of your description:
|
||||
|
||||
Fixes #333
|
||||
|
||||
The issue number in this case is "333." The word *Fixes* is magical; GitHub will automatically close the issue when your pull request is merged.
|
||||
|
||||
# Writing commit messages
|
||||
## Writing commit messages
|
||||
|
||||
Good commit messages serve at least three important purposes:
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,5 +1,6 @@
|
|||
.DS_Store
|
||||
.env
|
||||
.env.production
|
||||
.vscode/
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
|
|
38
.travis.yml
38
.travis.yml
|
@ -1,3 +1,39 @@
|
|||
sudo: required
|
||||
language: node_js
|
||||
node_js:
|
||||
- "8.11.1"
|
||||
- "8.11.1"
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- "$HOME/google-cloud-sdk/"
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
before_install:
|
||||
- docker-compose -f docker-compose-development.yml up -d
|
||||
- docker ps -a
|
||||
|
||||
install: true
|
||||
|
||||
script:
|
||||
- docker-compose exec -T app npm run test --verbose
|
||||
|
||||
before_deploy:
|
||||
- docker-compose stop
|
||||
- if [ ! -d "$HOME/google-cloud-sdk/bin" ]; then rm -rf $HOME/google-cloud-sdk; export CLOUDSDK_CORE_DISABLE_PROMPTS=1; curl https://sdk.cloud.google.com | bash >/dev/null; fi
|
||||
- source /home/travis/google-cloud-sdk/path.bash.inc
|
||||
- gcloud --quiet version
|
||||
- gcloud --quiet components update
|
||||
- gcloud --quiet components update kubectl
|
||||
|
||||
deploy:
|
||||
- provider: script
|
||||
script: ./deploy.sh
|
||||
skip_cleanup: true
|
||||
on:
|
||||
branch: master
|
||||
|
||||
env:
|
||||
global:
|
||||
- APP_IMAGE_NAME=p5jswebeditor_app
|
||||
|
|
45
Dockerfile
45
Dockerfile
|
@ -1,20 +1,29 @@
|
|||
FROM node:8.9.0
|
||||
|
||||
ENV APP_HOME=/opt/node/app \
|
||||
TERM=xterm
|
||||
|
||||
# Copy in the project files and set as working directory
|
||||
ADD . $APP_HOME
|
||||
FROM node:8.11.1 as base
|
||||
ENV APP_HOME=/usr/src/app \
|
||||
TERM=xterm
|
||||
RUN mkdir -p $APP_HOME
|
||||
WORKDIR $APP_HOME
|
||||
|
||||
# Install node modules
|
||||
RUN npm install
|
||||
|
||||
# Rebuild node-sass just to be safe
|
||||
RUN npm rebuild node-sass
|
||||
|
||||
# For development, mark the directory as a mount override point
|
||||
VOLUME $APP_HOME
|
||||
|
||||
# Expose default server port
|
||||
EXPOSE 8000
|
||||
|
||||
FROM base as development
|
||||
ENV NODE_ENV development
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm install
|
||||
RUN npm rebuild node-sass
|
||||
COPY .babelrc index.js nodemon.json ./
|
||||
COPY ./webpack ./webpack
|
||||
COPY client ./client
|
||||
COPY server ./server
|
||||
CMD ["npm", "start"]
|
||||
|
||||
FROM development as build
|
||||
ENV NODE_ENV production
|
||||
RUN npm run build
|
||||
|
||||
FROM base as production
|
||||
ENV NODE_ENV=production
|
||||
COPY package.json package-lock.json index.js ./
|
||||
RUN npm install --production
|
||||
RUN npm rebuild node-sass
|
||||
COPY --from=build $APP_HOME/dist ./dist
|
||||
CMD ["npm", "run", "start:prod"]
|
||||
|
|
169
README.md
169
README.md
|
@ -1,166 +1,23 @@
|
|||
# p5.js Web Editor
|
||||
# [p5.js Web Editor](https://editor.p5js.org)
|
||||
|
||||
This project is currently in development! It will be announced when there is a (public) beta release.
|
||||
The p5.js Web Editor is an in-browser code editor for creating [p5.js](https://p5js.org/) sketches. p5.js, which is a separate project, is a JavaScript library with the goal of making coding accessible for artists, designers, educators, and beginners, and the web editor shares this same spirit. It is designed with the benginner in mind—when using the web editor, you don't need to download or configure anything, you can simply open the website, and start writing code. You can also host their work online and share it with others.
|
||||
|
||||
## Development Installation
|
||||
The p5.js Web Editor is currently in active development, and looking for contributions of any type! Please check out the [contribution guide](https://github.com/processing/p5.js-web-editor/blob/master/.github/CONTRIBUTING.md) for more details.
|
||||
|
||||
1. Fork this repository.
|
||||
2. Clone the forked repository and cd into it
|
||||
3. `$ npm install`
|
||||
4. Install MongoDB and make sure it is running
|
||||
* For Mac OSX with [homebrew](http://brew.sh/): `brew install mongodb` then `brew services start mongodb`
|
||||
* For Windows and Linux: [MongoDB Installation](https://docs.mongodb.com/manual/installation/)
|
||||
5. Create a file called `.env` in the root of this directory that looks like
|
||||
If you have found a bug in the p5.js Web Editor, you can file it under the ["issues" tab](https://github.com/processing/p5.js-web-editor/issues).
|
||||
|
||||
```
|
||||
API_URL=/api
|
||||
MONGO_URL=mongodb://localhost:27017/p5js-web-editor
|
||||
PORT=8000
|
||||
SESSION_SECRET=whatever_you_want_this_to_be_it_only_matters_for_production
|
||||
AWS_ACCESS_KEY=<your-aws-access-key>
|
||||
AWS_SECRET_KEY=<your-aws-secret-key>
|
||||
AWS_REGION=<your-aws-region>
|
||||
S3_BUCKET=<your-s3-bucket>
|
||||
GITHUB_ID=<your-github-client-id>
|
||||
GITHUB_SECRET=<your-github-client-secret>
|
||||
GOOGLE_ID=<your-google-client-id> (use google+ api)
|
||||
GOOGLE_SECRET=<your-google-client-secret> (use google+ api)
|
||||
MAILGUN_KEY=<your-mailgun-api-key>
|
||||
EXAMPLE_USER_EMAIL=<email-id-for-p5-example-user>
|
||||
EXAMPLE_USER_PASSWORD=<password-for-p5-example-user>
|
||||
```
|
||||
## Issues
|
||||
|
||||
If you don't care about being able to upload media files to S3 or Login with Github or Google, you can drop in the file exactly how it is. Or, if you don't want to do that, just ask me to send you mine. Refer to [this gist](https://gist.github.com/catarak/70c9301f0fd1ac2d6b58de03f61997e3) for creating an S3 bucket for testing, or if you don't want to do that, I can add you to one of my S3 buckets.
|
||||
Please post bugs and feature requests in the correct repository:
|
||||
|
||||
6. `$ npm run fetch-examples` - this downloads the example sketches into a user called 'p5'
|
||||
7. `$ npm start`
|
||||
8. Navigate to [http://localhost:8000](http://localhost:8000) in your browser
|
||||
9. Install the [React Developer Tools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en).
|
||||
10. Open and close the Redux DevTools using `ctrl+h`, and move them with `ctrl+w`
|
||||
* p5.js general and p5.dom: [https://github.com/processing/p5.js/issues](https://github.com/processing/p5.js/issues)
|
||||
* p5.accessibility: [https://github.com/processing/p5.accessibility/issues](https://github.com/processing/p5.accessibility/issues)
|
||||
* p5.sound: [https://github.com/processing/p5.js-sound/issues](https://github.com/processing/p5.js-sound/issues)
|
||||
* p5.js website: [https://github.com/processing/p5.js-website/issues](https://github.com/processing/p5.js-website/issues)
|
||||
|
||||
### Testing SSL on your local machine
|
||||
Please refer to [this gist](https://gist.github.com/andrewn/953ffd5cb17ac2634dc969fc7bdaff3f). This allows you to access the editor using both HTTP and HTTPS. Don't worry about this unless you need to make changes or test HTTPS behavior.
|
||||
## Get Involved
|
||||
|
||||
The automatic redirection to HTTPS is turned off by default in development. If you need to test this behavior, put `FORCE_TO_HTTPS=true` in your `.env` file.
|
||||
The p5.js Web Editor is a collaborative project created by many individuals, and you are invited to help. All types of involvement are welcome. You can start with the [p5.js community section](https://p5js.org/community), which also applies to this project.
|
||||
|
||||
## Development Installation using Docker
|
||||
Developers, check the [developer docs](https://github.com/processing/p5.js-web-editor/blob/master/developer_docs/) details about contributing code, bug fixes, and documentation.
|
||||
|
||||
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
|
||||
* Mac: https://www.docker.com/docker-mac
|
||||
* Windows: https://www.docker.com/docker-windows
|
||||
2. Clone this repository and cd into it
|
||||
3. `$ docker-compose build`
|
||||
4. `$ docker-compose run --rm server npm run fetch-examples`
|
||||
|
||||
Now, anytime you wish to start the server with its dependencies, you can run:
|
||||
|
||||
5. `$ docker-compose up`
|
||||
6. Navigate to [http://localhost:8000](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):
|
||||
|
||||
7. `$ docker-compose exec server 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):
|
||||
|
||||
8. `$ docker-compose run server --rm bash -l`
|
||||
|
||||
## Production Installation
|
||||
1. Clone this repository and `cd` into it
|
||||
2. `$ npm install`
|
||||
3. Install MongoDB and make sure it is running
|
||||
4. Create a file called `.env` in the root of this directory that looks like
|
||||
|
||||
```
|
||||
API_URL=/api
|
||||
MONGO_URL=mongodb://localhost:27017/p5js-web-editor
|
||||
PORT=8000
|
||||
SESSION_SECRET=make_this_a_long-random_string_like_maybe_126_characters_long
|
||||
AWS_ACCESS_KEY=<your-aws-access-key>
|
||||
AWS_SECRET_KEY=<your-aws-secret-key>
|
||||
AWS_REGION=<your-aws-region>
|
||||
S3_BUCKET=<your-s3-bucket>
|
||||
GITHUB_ID=<your-github-client-id>
|
||||
GITHUB_SECRET=<your-github-client-secret>
|
||||
GOOGLE_ID=<your-google-client-id> (use google+ api)
|
||||
GOOGLE_SECRET=<your-google-client-secret> (use google+ api)
|
||||
EMAIL_SENDER=<email-address-to-send-from>
|
||||
MAILGUN_KEY=<mailgun-api-key>
|
||||
MAILGUN_DOMAIN=<mailgun-domain>
|
||||
EMAIL_VERIFY_SECRET_TOKEN=whatever_you_want_this_to_be_it_only_matters_for_production
|
||||
EXAMPLE_USER_EMAIL=<email-id-for-p5-example-user>
|
||||
EXAMPLE_USER_PASSWORD=<password-for-p5-example-user>
|
||||
```
|
||||
For production, you will need to have real Github and Amazon credentials. Refer to [this gist](https://gist.github.com/catarak/70c9301f0fd1ac2d6b58de03f61997e3) for creating an S3 bucket for testing.
|
||||
|
||||
5. `$ npm run fetch-examples` - this downloads the example sketches into a user called 'p5'
|
||||
6. `$ npm run build`
|
||||
7. `$ npm run start:prod`
|
||||
|
||||
### For Production Setup with PM2
|
||||
1. `$ npm install -g pm2`
|
||||
2. `$ pm2 start ecosystem.json`
|
||||
|
||||
## Optional S3 bucket URL base configuration
|
||||
|
||||
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
|
||||
|
||||
## Accessibility Guidelines
|
||||
|
||||
Here is guide on [how to use the accessible editor](https://gist.github.com/MathuraMG/e86666b7b41fbc8c078bad9aff3f666d) and here is an overview of the [p5-accessibility.js](https://github.com/processing/p5.accessibility) library that makes p5.js sketches accessible to screen readers.
|
||||
|
||||
The code for the p5.js web editor adheres to web accessibility standards. The following guidelines will help to ensure that accessibility continues to be a priority as development continues.
|
||||
|
||||
**Code Structure**
|
||||
|
||||
* Screen Readers are an assistive technology for vision loss which helps users to navigate a web page. They are able to prioritize content based on the semantic meaning of HTML tags. Therefore, it is important to use specific tags, such as `nav`, `ul`, `li`, `section`, and so on. `div` is the least screen reader friendly tag. For example, [here is the semantic meaning of the `body` tag](http://html5doctor.com/element-index/#body)
|
||||
* All buttons/links/windows need to be accessible by the keyboard ( By tabbing, pressing space etc.)
|
||||
* In cases where tags are not screen reader friendly, we can take advantage of [tabIndex](http://webaim.org/techniques/keyboard/tabindex). Using tabIndex ensures that all elements are accessible via keyboard. [code example](https://github.com/processing/p5.js-web-editor/blob/master/client/modules/IDE/components/Editor.jsx#L249)
|
||||
* When opening a new window or pop up window, ensure the keyboard focus also moves to the new window. [code example](https://github.com/processing/p5.js-web-editor/blob/master/client/modules/IDE/components/NewFileForm.jsx#L16)
|
||||
|
||||
**Labeling**
|
||||
|
||||
* When creating button icons, images, or something without text (this does not include an HTML5 `<button>`), use [aria-labels](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute). [code example](https://github.com/processing/p5.js-web-editor/blob/master/client/modules/IDE/components/Toolbar.jsx#L67)
|
||||
* All `<table>`s need to have a `summary` attribute. This will ensure user is given context to what the table is. [code example](https://github.com/processing/p5.js-web-editor/blob/master/client/modules/IDE/components/SketchList.jsx#L39)
|
||||
* `ul`s and `nav`s menus need to include a title. [code example](https://github.com/processing/p5.js-web-editor/blob/master/client/components/Nav.jsx#L7)
|
||||
|
||||
For more information on accessibility see the [teach access tutorial](https://teachaccess.github.io/tutorial/)
|
||||
|
||||
## Contributing
|
||||
|
||||
See [CONTRIBUTING.md](https://github.com/processing/p5.js-web-editor/blob/master/contributing.md).
|
||||
|
||||
## Tooling and Style Overview
|
||||
|
||||
The p5.js Web Editor is built on a MERN stack - MongoDB, Express, React/Redux, and Node. For a reference to the file structure format I am using, please look at the [Mern Starter](https://github.com/Hashnode/mern-starter) and [this comment](https://github.com/Hashnode/mern-starter/issues/90#issuecomment-221553573).
|
||||
|
||||
This project uses an in-development [p5-accessibility.js library](https://github.com/processing/p5.accessibility) for accessibility.
|
||||
|
||||
This project does not use CSS Modules, but uses Sass. I like to follow [BEM rules](http://getbem.com/) for CSS naming conventions, write OOSCSS with placeholders and mixins, and follow the [7-1 Pattern](https://sass-guidelin.es/#the-7-1-pattern) for Sass.
|
||||
|
||||
I'm using [ES6](http://es6-features.org/) and transpiling to ES5 using [Babel](https://babeljs.io/). For reference to the JavaScript style guide, see the [Airbnb Style Guide](https://github.com/airbnb/javascript), [React ESLint Plugin](https://github.com/yannickcr/eslint-plugin-react).
|
||||
|
||||
The ESLint configuration is based on a few popular React/Redux boilerplates. Open to suggestions on this. If in development, you're getting annoyed with ESLint, you can remove it from `webpack.config.dev.js` in the JavaScript loader, or disable any line from eslint by commenting at the end of the line `// eslint-disable-line`.
|
||||
|
||||
## AWS information
|
||||
This project is currently hosted on an EC2 instance and uses S3 for media hosting.
|
||||
|
||||
Backups on the MongoDB are also hosted on an S3 bucket, based on the following [gist](https://gist.github.com/eladnava/96bd9771cd2e01fb4427230563991c8d). The backup script runs nightly via a cronjob at 8AM UTC/3AM EST/12AM PST. Backups are deleted after 30 days.
|
||||
|
|
57
backup.sh
57
backup.sh
|
@ -1,57 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Make sure to:
|
||||
# 1) Name this file `backup.sh` and place it in /home/ec2-user (or symlink it)
|
||||
# 2) Run sudo apt-get install awscli to install the AWSCLI
|
||||
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
|
||||
# 4) Fill in DB host + name
|
||||
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
|
||||
# 6) Run chmod +x backup.sh
|
||||
# 7) Test it out via ./backup.sh
|
||||
# 8) Set up a daily backup at 8AM UTC via `crontab -e`:
|
||||
# 0 8 * * * /home/ec2-user/backup.sh > /home/ec2-user/backup.log
|
||||
|
||||
# DB host (secondary preferred as to avoid impacting primary performance)
|
||||
HOST=localhost:27017
|
||||
|
||||
# DB name
|
||||
DBNAME=p5js-web-editor
|
||||
|
||||
# S3 bucket name
|
||||
BUCKET=p5js-web-editor-backup
|
||||
|
||||
# Linux user account
|
||||
USER=ec2-user
|
||||
|
||||
# Current time
|
||||
TIME=`/bin/date +%d-%m-%Y-%T`
|
||||
|
||||
# Backup directory
|
||||
DEST=/home/$USER/tmp
|
||||
|
||||
# Tar file of backup directory
|
||||
TAR=$DEST/../$TIME.tar
|
||||
|
||||
# Create backup dir (-p to avoid warning if already exists)
|
||||
/bin/mkdir -p $DEST
|
||||
|
||||
# Log
|
||||
echo "Backing up $HOST/$DBNAME to s3://$BUCKET/ on $TIME";
|
||||
|
||||
# Dump from mongodb host into backup directory
|
||||
/usr/bin/mongodump -h $HOST -d $DBNAME -o $DEST
|
||||
|
||||
# Create tar of backup directory
|
||||
/bin/tar cvf $TAR -C $DEST .
|
||||
|
||||
# Upload tar to s3
|
||||
/usr/bin/aws s3 cp $TAR s3://$BUCKET/
|
||||
|
||||
# Remove tar file locally
|
||||
/bin/rm -f $TAR
|
||||
|
||||
# Remove backup directory
|
||||
/bin/rm -rf $DEST
|
||||
|
||||
# All done
|
||||
echo "Backup available at https://s3.amazonaws.com/$BUCKET/$TIME.tar"
|
|
@ -28,7 +28,6 @@ export const AUTH_ERROR = 'AUTH_ERROR';
|
|||
export const SETTINGS_UPDATED = 'SETTINGS_UPDATED';
|
||||
|
||||
export const SET_PROJECT_NAME = 'SET_PROJECT_NAME';
|
||||
export const SET_SERVE_SECURE = 'SET_SERVE_SECURE';
|
||||
|
||||
export const PROJECT_SAVE_SUCCESS = 'PROJECT_SAVE_SUCCESS';
|
||||
export const PROJECT_SAVE_FAIL = 'PROJECT_SAVE_FAIL';
|
||||
|
|
|
@ -4,6 +4,8 @@ import { connect } from 'react-redux';
|
|||
import DevTools from './components/DevTools';
|
||||
import { setPreviousPath } from '../IDE/actions/ide';
|
||||
|
||||
const __process = (typeof global !== 'undefined' ? global : window).process;
|
||||
|
||||
class App extends React.Component {
|
||||
constructor(props, context) {
|
||||
super(props, context);
|
||||
|
@ -23,7 +25,7 @@ class App extends React.Component {
|
|||
render() {
|
||||
return (
|
||||
<div className="app">
|
||||
{this.state.isMounted && !window.devToolsExtension && process.env.NODE_ENV === 'development' && <DevTools />}
|
||||
{this.state.isMounted && !window.devToolsExtension && __process.env.NODE_ENV === 'development' && <DevTools />}
|
||||
{this.props.children}
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -2,7 +2,8 @@ import axios from 'axios';
|
|||
|
||||
import * as ActionTypes from '../../../constants';
|
||||
|
||||
const ROOT_URL = process.env.API_URL;
|
||||
const __process = (typeof global !== 'undefined' ? global : window).process;
|
||||
const ROOT_URL = __process.env.API_URL;
|
||||
|
||||
function setAssets(assets) {
|
||||
return {
|
||||
|
|
|
@ -5,7 +5,8 @@ import { reset } from 'redux-form';
|
|||
import * as ActionTypes from '../../../constants';
|
||||
import { setUnsavedChanges } from './ide';
|
||||
|
||||
const ROOT_URL = process.env.API_URL;
|
||||
const __process = (typeof global !== 'undefined' ? global : window).process;
|
||||
const ROOT_URL = __process.env.API_URL;
|
||||
|
||||
function appendToFilename(filename, string) {
|
||||
const dotIndex = filename.lastIndexOf('.');
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import axios from 'axios';
|
||||
import * as ActionTypes from '../../../constants';
|
||||
|
||||
const ROOT_URL = process.env.API_URL;
|
||||
const __process = (typeof global !== 'undefined' ? global : window).process;
|
||||
const ROOT_URL = __process.env.API_URL;
|
||||
|
||||
function updatePreferences(formParams, dispatch) {
|
||||
axios.put(`${ROOT_URL}/preferences`, formParams, { withCredentials: true })
|
||||
|
|
|
@ -12,16 +12,10 @@ import { setUnsavedChanges,
|
|||
import { clearState, saveState } from '../../../persistState';
|
||||
import { redirectToProtocol, protocols } from '../../../components/forceProtocol';
|
||||
|
||||
const ROOT_URL = process.env.API_URL;
|
||||
const __process = (typeof global !== 'undefined' ? global : window).process;
|
||||
const ROOT_URL = __process.env.API_URL;
|
||||
|
||||
export function setProject(project) {
|
||||
const targetProtocol = project.serveSecure === true ?
|
||||
protocols.https :
|
||||
protocols.http;
|
||||
|
||||
// This will not reload if on same protocol
|
||||
redirectToProtocol(targetProtocol);
|
||||
|
||||
return {
|
||||
type: ActionTypes.SET_PROJECT,
|
||||
project,
|
||||
|
@ -264,22 +258,6 @@ export function cloneProject() {
|
|||
};
|
||||
}
|
||||
|
||||
export function setServeSecure(serveSecure, { redirect = true } = {}) {
|
||||
return (dispatch, getState) => {
|
||||
dispatch({
|
||||
type: ActionTypes.SET_SERVE_SECURE,
|
||||
serveSecure
|
||||
});
|
||||
|
||||
if (redirect === true) {
|
||||
dispatch(saveProject(false /* autosave */))
|
||||
.then(() => redirectToProtocol(serveSecure === true ? protocols.https : protocols.http));
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
export function showEditProjectName() {
|
||||
return {
|
||||
type: ActionTypes.SHOW_EDIT_PROJECT_NAME
|
||||
|
|
|
@ -3,7 +3,8 @@ import * as ActionTypes from '../../../constants';
|
|||
import { showErrorModal, setPreviousPath } from './ide';
|
||||
import { resetProject } from './project';
|
||||
|
||||
const ROOT_URL = process.env.API_URL;
|
||||
const __process = (typeof global !== 'undefined' ? global : window).process;
|
||||
const ROOT_URL = __process.env.API_URL;
|
||||
|
||||
export function getProjects(username) {
|
||||
return (dispatch) => {
|
||||
|
|
|
@ -2,9 +2,10 @@ import axios from 'axios';
|
|||
import { createFile } from './files';
|
||||
import { TEXT_FILE_REGEX } from '../../../../server/utils/fileUtils';
|
||||
|
||||
const s3BucketHttps = process.env.S3_BUCKET_URL_BASE ||
|
||||
`https://s3-${process.env.AWS_REGION}.amazonaws.com/${process.env.S3_BUCKET}/`;
|
||||
const ROOT_URL = process.env.API_URL;
|
||||
const __process = (typeof global !== 'undefined' ? global : window).process;
|
||||
const s3BucketHttps = __process.env.S3_BUCKET_URL_BASE ||
|
||||
`https://s3-${__process.env.AWS_REGION}.amazonaws.com/${__process.env.S3_BUCKET}/`;
|
||||
const ROOT_URL = __process.env.API_URL;
|
||||
const MAX_LOCAL_FILE_SIZE = 80000; // bytes, aka 80 KB
|
||||
|
||||
function localIntercept(file, options = {}) {
|
||||
|
@ -58,10 +59,10 @@ export function dropzoneAcceptCallback(userId, file, done) {
|
|||
}
|
||||
)
|
||||
.then((response) => {
|
||||
file.custom_status = 'ready'; // eslint-disable-line
|
||||
file.postData = response.data; // eslint-disable-line
|
||||
file.s3 = response.data.key; // eslint-disable-line
|
||||
file.previewTemplate.className += ' uploading'; // eslint-disable-line
|
||||
file.custom_status = 'ready'; // eslint-disable-line
|
||||
file.postData = response.data; // eslint-disable-line
|
||||
file.s3 = response.data.key; // eslint-disable-line
|
||||
file.previewTemplate.className += ' uploading'; // eslint-disable-line
|
||||
done();
|
||||
})
|
||||
.catch((response) => {
|
||||
|
|
|
@ -6,8 +6,9 @@ import { connect } from 'react-redux';
|
|||
import * as UploaderActions from '../actions/uploader';
|
||||
import { fileExtensionsAndMimeTypes } from '../../../../server/utils/fileUtils';
|
||||
|
||||
const s3Bucket = process.env.S3_BUCKET_URL_BASE ||
|
||||
`https://s3-${process.env.AWS_REGION}.amazonaws.com/${process.env.S3_BUCKET}/`;
|
||||
const __process = (typeof global !== 'undefined' ? global : window).process;
|
||||
const s3Bucket = __process.env.S3_BUCKET_URL_BASE ||
|
||||
`https://s3-${__process.env.AWS_REGION}.amazonaws.com/${__process.env.S3_BUCKET}/`;
|
||||
|
||||
class FileUploader extends React.Component {
|
||||
componentDidMount() {
|
||||
|
|
|
@ -59,7 +59,6 @@ class Preferences extends React.Component {
|
|||
<TabList>
|
||||
<div className="preference__subheadings">
|
||||
<Tab><h4 className="preference__subheading">General Settings</h4></Tab>
|
||||
<Tab><h4 className="preference__subheading">Sketch Settings</h4></Tab>
|
||||
<Tab><h4 className="preference__subheading">Accessibility</h4></Tab>
|
||||
</div>
|
||||
</TabList>
|
||||
|
@ -217,34 +216,6 @@ class Preferences extends React.Component {
|
|||
</div>
|
||||
</div>
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
{/* <div className="preference">
|
||||
<h4 className="preference__title">Add a p5.js or an external library</h4>
|
||||
</div> */}
|
||||
<div className="preference">
|
||||
<h4 className="preference__title">Security Protocol</h4>
|
||||
<div className="preference__serve-secure">
|
||||
<input
|
||||
id="serve-secure"
|
||||
type="checkbox"
|
||||
checked={this.props.serveSecure || false}
|
||||
onChange={(event) => {
|
||||
this.props.setServeSecure(event.target.checked);
|
||||
}}
|
||||
/>
|
||||
<label htmlFor="serve-secure">Serve over HTTPS</label>
|
||||
<span
|
||||
className="serve-secture__tooltip tooltipped tooltipped-n tooltipped-no-delay tooltipped-multiline"
|
||||
aria-label={'Choose HTTPS if you need to \n • access a microphone or webcam \n'
|
||||
+ '• access an API served over HTTPS \n\n'
|
||||
+ 'Choose HTTP if you need to \n'
|
||||
+ '• access an API served over HTTP'}
|
||||
>
|
||||
<InlineSVG src={infoUrl} className="serve-secure__icon" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<div className="preference">
|
||||
<h4 className="preference__title">Lint warning sound</h4>
|
||||
|
@ -349,8 +320,6 @@ Preferences.propTypes = {
|
|||
lintWarning: PropTypes.bool.isRequired,
|
||||
setLintWarning: PropTypes.func.isRequired,
|
||||
theme: PropTypes.string.isRequired,
|
||||
serveSecure: PropTypes.bool.isRequired,
|
||||
setServeSecure: PropTypes.func.isRequired,
|
||||
setTheme: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
|
|
|
@ -277,8 +277,6 @@ class IDEView extends React.Component {
|
|||
setSoundOutput={this.props.setSoundOutput}
|
||||
theme={this.props.preferences.theme}
|
||||
setTheme={this.props.setTheme}
|
||||
serveSecure={this.props.project.serveSecure}
|
||||
setServeSecure={this.props.setServeSecure}
|
||||
/>
|
||||
</Overlay>
|
||||
}
|
||||
|
@ -556,7 +554,6 @@ IDEView.propTypes = {
|
|||
project: PropTypes.shape({
|
||||
id: PropTypes.string,
|
||||
name: PropTypes.string.isRequired,
|
||||
serveSecure: PropTypes.bool,
|
||||
owner: PropTypes.shape({
|
||||
username: PropTypes.string,
|
||||
id: PropTypes.string
|
||||
|
@ -564,7 +561,6 @@ IDEView.propTypes = {
|
|||
updatedAt: PropTypes.string
|
||||
}).isRequired,
|
||||
setProjectName: PropTypes.func.isRequired,
|
||||
setServeSecure: PropTypes.func.isRequired,
|
||||
openPreferences: PropTypes.func.isRequired,
|
||||
editorAccessibility: PropTypes.shape({
|
||||
lintMessages: PropTypes.array.isRequired,
|
||||
|
|
|
@ -7,7 +7,6 @@ const initialState = () => {
|
|||
const generatedName = generatedString.charAt(0).toUpperCase() + generatedString.slice(1);
|
||||
return {
|
||||
name: generatedName,
|
||||
serveSecure: isSecurePage(),
|
||||
updatedAt: ''
|
||||
};
|
||||
};
|
||||
|
@ -17,8 +16,6 @@ const project = (state, action) => {
|
|||
state = initialState(); // eslint-disable-line
|
||||
}
|
||||
switch (action.type) {
|
||||
case ActionTypes.SET_SERVE_SECURE:
|
||||
return Object.assign({}, { ...state }, { serveSecure: action.serveSecure });
|
||||
case ActionTypes.SET_PROJECT_NAME:
|
||||
return Object.assign({}, { ...state }, { name: action.name });
|
||||
case ActionTypes.NEW_PROJECT:
|
||||
|
@ -26,7 +23,6 @@ const project = (state, action) => {
|
|||
id: action.project.id,
|
||||
name: action.project.name,
|
||||
updatedAt: action.project.updatedAt,
|
||||
serveSecure: action.project.serveSecure,
|
||||
owner: action.owner
|
||||
};
|
||||
case ActionTypes.SET_PROJECT:
|
||||
|
@ -34,7 +30,6 @@ const project = (state, action) => {
|
|||
id: action.project.id,
|
||||
name: action.project.name,
|
||||
updatedAt: action.project.updatedAt,
|
||||
serveSecure: action.project.serveSecure,
|
||||
owner: action.owner
|
||||
};
|
||||
case ActionTypes.RESET_PROJECT:
|
||||
|
|
|
@ -3,8 +3,8 @@ import axios from 'axios';
|
|||
import * as ActionTypes from '../../constants';
|
||||
import { showErrorModal, justOpenedProject } from '../IDE/actions/ide';
|
||||
|
||||
|
||||
const ROOT_URL = process.env.API_URL;
|
||||
const __process = (typeof global !== 'undefined' ? global : window).process;
|
||||
const ROOT_URL = __process.env.API_URL;
|
||||
|
||||
export function authError(error) {
|
||||
return {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Route, IndexRoute } from 'react-router';
|
||||
import React from 'react';
|
||||
import forceProtocol, { protocols, findSourceProtocol } from './components/forceProtocol';
|
||||
import App from './modules/App/App';
|
||||
import IDEView from './modules/IDE/pages/IDEView';
|
||||
import FullView from './modules/IDE/pages/FullView';
|
||||
|
@ -14,6 +13,8 @@ import AccountView from './modules/User/pages/AccountView';
|
|||
import { getUser } from './modules/User/actions';
|
||||
import { stopSketch } from './modules/IDE/actions/ide';
|
||||
|
||||
const __process = (typeof global !== 'undefined' ? global : window).process;
|
||||
|
||||
const checkAuth = (store) => {
|
||||
store.dispatch(getUser());
|
||||
};
|
||||
|
@ -22,39 +23,27 @@ const onRouteChange = (store) => {
|
|||
store.dispatch(stopSketch());
|
||||
};
|
||||
|
||||
const routes = (store) => {
|
||||
const sourceProtocol = findSourceProtocol(store.getState());
|
||||
|
||||
// If the flag is false, we stay on HTTP
|
||||
const forceToHttps = forceProtocol({
|
||||
targetProtocol: protocols.https,
|
||||
sourceProtocol,
|
||||
// prints debugging but does not reload page
|
||||
disable: process.env.FORCE_TO_HTTPS === false,
|
||||
});
|
||||
|
||||
return (
|
||||
<Route path="/" component={App} onChange={() => { onRouteChange(store); }}>
|
||||
<IndexRoute component={IDEView} onEnter={checkAuth(store)} />
|
||||
<Route path="/login" component={forceToHttps(LoginView)} />
|
||||
<Route path="/signup" component={forceToHttps(SignupView)} />
|
||||
<Route path="/reset-password" component={forceToHttps(ResetPasswordView)} />
|
||||
<Route path="/verify" component={forceToHttps(EmailVerificationView)} />
|
||||
<Route
|
||||
path="/reset-password/:reset_password_token"
|
||||
component={forceToHttps(NewPasswordView)}
|
||||
/>
|
||||
<Route path="/projects/:project_id" component={IDEView} />
|
||||
<Route path="/full/:project_id" component={FullView} />
|
||||
<Route path="/sketches" component={IDEView} />
|
||||
<Route path="/assets" component={IDEView} />
|
||||
<Route path="/account" component={forceToHttps(AccountView)} />
|
||||
<Route path="/:username/sketches/:project_id" component={IDEView} />
|
||||
<Route path="/:username/sketches" component={IDEView} />
|
||||
<Route path="/about" component={IDEView} />
|
||||
<Route path="/feedback" component={IDEView} />
|
||||
</Route>
|
||||
);
|
||||
};
|
||||
const routes = store => (
|
||||
<Route path="/" component={App} onChange={() => { onRouteChange(store); }}>
|
||||
<IndexRoute component={IDEView} onEnter={checkAuth(store)} />
|
||||
<Route path="/login" component={LoginView} />
|
||||
<Route path="/signup" component={SignupView} />
|
||||
<Route path="/reset-password" component={ResetPasswordView} />
|
||||
<Route path="/verify" component={EmailVerificationView} />
|
||||
<Route
|
||||
path="/reset-password/:reset_password_token"
|
||||
component={NewPasswordView}
|
||||
/>
|
||||
<Route path="/projects/:project_id" component={IDEView} />
|
||||
<Route path="/full/:project_id" component={FullView} />
|
||||
<Route path="/sketches" component={IDEView} />
|
||||
<Route path="/assets" component={IDEView} />
|
||||
<Route path="/account" component={AccountView} />
|
||||
<Route path="/:username/sketches/:project_id" component={IDEView} />
|
||||
<Route path="/:username/sketches" component={IDEView} />
|
||||
<Route path="/about" component={IDEView} />
|
||||
<Route path="/feedback" component={IDEView} />
|
||||
</Route>
|
||||
);
|
||||
|
||||
export default routes;
|
||||
|
|
|
@ -4,12 +4,14 @@ import DevTools from './modules/App/components/DevTools';
|
|||
import rootReducer from './reducers';
|
||||
import { clearState, loadState } from './persistState';
|
||||
|
||||
const __process = (typeof global !== 'undefined' ? global : window).process;
|
||||
|
||||
export default function configureStore(initialState) {
|
||||
const enhancers = [
|
||||
applyMiddleware(thunk),
|
||||
];
|
||||
|
||||
if (process.env.CLIENT && process.env.NODE_ENV === 'development') {
|
||||
if (__process.env.CLIENT && __process.env.NODE_ENV === 'development') {
|
||||
// Enable DevTools only when rendering on client and during development.
|
||||
enhancers.push(window.devToolsExtension ? window.devToolsExtension() : DevTools.instrument());
|
||||
}
|
||||
|
|
23
deploy.sh
Executable file
23
deploy.sh
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
docker-compose build --no-cache
|
||||
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
||||
docker tag $APP_IMAGE_NAME $DOCKER_USERNAME/$DOCKER_REPOSITORY:$TRAVIS_COMMIT
|
||||
docker tag $APP_IMAGE_NAME $DOCKER_USERNAME/$DOCKER_REPOSITORY:latest
|
||||
docker push $DOCKER_USERNAME/$DOCKER_REPOSITORY:$TRAVIS_COMMIT
|
||||
docker push $DOCKER_USERNAME/$DOCKER_REPOSITORY:latest
|
||||
|
||||
echo $GCLOUD_SERVICE_KEY_PRD | base64 --decode -i > ${HOME}/gcloud-service-key.json
|
||||
gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json
|
||||
|
||||
gcloud --quiet config set project $PROJECT_NAME_PRD
|
||||
gcloud --quiet config set container/cluster $CLUSTER_NAME_PRD
|
||||
gcloud --quiet config set compute/zone ${CLOUDSDK_COMPUTE_ZONE}
|
||||
gcloud --quiet container clusters get-credentials $CLUSTER_NAME_PRD
|
||||
|
||||
kubectl config view
|
||||
kubectl config current-context
|
||||
|
||||
kubectl set image deployment/${KUBE_DEPLOYMENT_NAME} ${KUBE_DEPLOYMENT_CONTAINER_NAME}=index.docker.io/$DOCKER_USERNAME/$DOCKER_REPOSITORY:$TRAVIS_COMMIT
|
12
developer_docs/README.md
Normal file
12
developer_docs/README.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
This folder contains documents intended for developers of the p5.js Web Editor.
|
||||
|
||||
## List of Documents
|
||||
* [Installation](https://github.com/processing/p5.js-web-editor/blob/master/developer_docs/installation.md) - A guide for setting up your development environment
|
||||
* [Preparing a pull-request](https://github.com/processing/p5.js/blob/master/developer_docs/preparing_a_pull_request.md) - Instructions for how to make a pull-request
|
||||
* [Accessibility Guidelines](https://github.com/processing/p5.js-web-editor/blob/master/developer_docs/accessibility.md) - Guidelines for writing code to create an accessible application
|
||||
* [Deployment](https://github.com/processing/p5.js-web-editor/blob/master/developer_docs/deployment.md) - A guide to production deployment, and all platforms that are being used.
|
||||
|
||||
## Documents to Create
|
||||
* Design Principles - reference [p5.js design principles](https://github.com/processing/p5.js/edit/master/developer_docs/design_principles.md)
|
||||
* Issue Labels - reference [p5.js issue labels](https://github.com/processing/p5.js/blob/master/developer_docs/issue_labels.md)
|
||||
* File Structure - An explanation of the file structure of this application.
|
20
developer_docs/accessibility.md
Normal file
20
developer_docs/accessibility.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
## Accessibility Guidelines
|
||||
|
||||
Here is guide on [how to use the accessible editor](https://gist.github.com/MathuraMG/e86666b7b41fbc8c078bad9aff3f666d) and here is an overview of the [p5-accessibility.js](https://github.com/processing/p5.accessibility) library that makes p5.js sketches accessible to screen readers.
|
||||
|
||||
The code for the p5.js web editor adheres to web accessibility standards. The following guidelines will help to ensure that accessibility continues to be a priority as development continues.
|
||||
|
||||
**Code Structure**
|
||||
|
||||
* Screen Readers are an assistive technology for vision loss which helps users to navigate a web page. They are able to prioritize content based on the semantic meaning of HTML tags. Therefore, it is important to use specific tags, such as `nav`, `ul`, `li`, `section`, and so on. `div` is the least screen reader friendly tag. For example, [here is the semantic meaning of the `body` tag](http://html5doctor.com/element-index/#body)
|
||||
* All buttons/links/windows need to be accessible by the keyboard ( By tabbing, pressing space etc.)
|
||||
* In cases where tags are not screen reader friendly, we can take advantage of [tabIndex](http://webaim.org/techniques/keyboard/tabindex). Using tabIndex ensures that all elements are accessible via keyboard. [code example](https://github.com/processing/p5.js-web-editor/blob/master/client/modules/IDE/components/Editor.jsx#L249)
|
||||
* When opening a new window or pop up window, ensure the keyboard focus also moves to the new window. [code example](https://github.com/processing/p5.js-web-editor/blob/master/client/modules/IDE/components/NewFileForm.jsx#L16)
|
||||
|
||||
**Labeling**
|
||||
|
||||
* When creating button icons, images, or something without text (this does not include an HTML5 `<button>`), use [aria-labels](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute). [code example](https://github.com/processing/p5.js-web-editor/blob/master/client/modules/IDE/components/Toolbar.jsx#L67)
|
||||
* All `<table>`s need to have a `summary` attribute. This will ensure user is given context to what the table is. [code example](https://github.com/processing/p5.js-web-editor/blob/master/client/modules/IDE/components/SketchList.jsx#L39)
|
||||
* `ul`s and `nav`s menus need to include a title. [code example](https://github.com/processing/p5.js-web-editor/blob/master/client/components/Nav.jsx#L7)
|
||||
|
||||
For more information on accessibility see the [teach access tutorial](https://teachaccess.github.io/tutorial/)
|
40
developer_docs/deployment.md
Normal file
40
developer_docs/deployment.md
Normal file
|
@ -0,0 +1,40 @@
|
|||
# Deployment
|
||||
|
||||
This document contains information about how to deploy to production, all of the different platforms and tools, and how to configure them.
|
||||
|
||||
WIP.
|
||||
* Production Setup/Installation
|
||||
* Travis
|
||||
* Docker Hub
|
||||
* Kubernetes
|
||||
* S3
|
||||
* Mailgun
|
||||
* Cloudflare
|
||||
* DNS/Dreamhost
|
||||
* mLab
|
||||
|
||||
## Deployment Process
|
||||
|
||||
These are the steps that happen when you deploy the application.
|
||||
|
||||
1. Push to `master` branch, or merge in a pull request to the `master` branch.
|
||||
2. This triggers a build on [Travis CI](https://travis-ci.org/processing/p5.js-web-editor).
|
||||
3. Travis CI builds a (development) Docker image of the whole application.
|
||||
4. Travis CI runs some tests, which in this case, is just `npm run lint`. This could be updated in the future to include more extensive tests. If the tests fail, the build stops here.
|
||||
5. If the tests pass, then Travis CI builds a (production) Docker image of the whole application.
|
||||
6. This image is pushed to [Docker Hub](https://hub.docker.com/r/catarak/p5.js-web-editor/) with a unique tag name (the Travis commit) and also to the `latest` tag.
|
||||
7. The Kubernetes deployment is updated to image just pushed to Docker Hub on the cluster on Google Kubernetes Engine.
|
||||
|
||||
## Production Installation
|
||||
|
||||
You'll only need to do this if you're testing the production environment locally.
|
||||
|
||||
1. Clone this repository and `cd` into it
|
||||
2. `$ npm install`
|
||||
3. Install MongoDB and make sure it is running
|
||||
4. `$ cp .env.example .env`
|
||||
5. (NOT Optional) edit `.env` and fill in all necessary values.
|
||||
6. `$ npm run fetch-examples` - this downloads the example sketches into a user called 'p5'
|
||||
7. `$ npm run build`
|
||||
8. Since production assumes your environment variables are in the shell environment, and not in a `.env` file, you will have to run `export $(grep -v '^#' .env | xargs)` or a similar command, see this [Stack Overflow answer](https://stackoverflow.com/a/20909045/4086967).
|
||||
9. `$ npm run start:prod`
|
25
developer_docs/development.md
Normal file
25
developer_docs/development.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Development
|
||||
|
||||
A guide for adding code to this project.
|
||||
|
||||
## Installation
|
||||
Follow the [installation guide](https://github.com/processing/p5.js-web-editor/blob/master/developer_docs/installation.md).
|
||||
|
||||
## Design
|
||||
Design proposed and theme changes are present at: [Zeplin](https://scene.zeplin.io/project/55f746c54a02e1e50e0632c3).
|
||||
|
||||
# Technologies Used
|
||||
|
||||
**MERN stack** - MongoDB, Express, React/Redux, and Node.
|
||||
|
||||
- For a reference to the **file structure format** this project is using, please look at the [Mern Starter](https://github.com/Hashnode/mern-starter).
|
||||
|
||||
- This project does not use CSS Modules, styled-components, or other CSS-in-JS libraries, but uses Sass. [BEM guidelines and naming conventions](http://getbem.com/) are followed.
|
||||
|
||||
- For common and reusable styles, write OOSCSS (Object-Oriented SCSS) with placeholders and mixins. For organizing styles, follow the [7-1 Pattern](https://sass-guidelin.es/#the-7-1-pattern) for Sass.
|
||||
|
||||
- We're using [ES6](http://es6-features.org/) and transpiling to ES5 using [Babel](https://babeljs.io/).
|
||||
|
||||
- For reference to the JavaScript style guide, see the [Airbnb Style Guide](https://github.com/airbnb/javascript), [React ESLint Plugin](https://github.com/yannickcr/eslint-plugin-react).
|
||||
|
||||
- The ESLint configuration is based on a few popular React/Redux boilerplates. Open to suggestions on this. If in development, you're getting annoyed with ESLint, you can temporarily remove the `eslint-loader` it from `webpack/config.dev.js` in the JavaScript loader, or disable any line from eslint by commenting at the end of the line `// eslint-disable-line`.
|
78
developer_docs/installation.md
Normal file
78
developer_docs/installation.md
Normal file
|
@ -0,0 +1,78 @@
|
|||
# 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](http://nodejs.org/), which also automatically installs the [npm](https://www.npmjs.org) package manager.
|
||||
2. [Fork](https://help.github.com/articles/fork-a-repo) the [p5.js Web Editor repository](https://github.com/processing/p5.js-web-editor) into your own GitHub account.
|
||||
3. [Clone](https://help.github.com/articles/cloning-a-repository/) 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
|
||||
* For Mac OSX with [homebrew](http://brew.sh/): `brew install mongodb` then `brew services start mongodb`
|
||||
* For Windows and Linux: [MongoDB Installation](https://docs.mongodb.com/manual/installation/)
|
||||
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](http://localhost:8000) in your browser
|
||||
11. Install the [React Developer Tools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en)
|
||||
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
|
||||
* Mac: https://www.docker.com/docker-mac
|
||||
* Windows: https://www.docker.com/docker-windows
|
||||
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:
|
||||
|
||||
7. `$ docker-compose -f docker-compose-development.yml up`
|
||||
8. Navigate to [http://localhost:8000](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):
|
||||
|
||||
9. `$ 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):
|
||||
|
||||
10. `$ 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 folllowing [gist](https://gist.github.com/catarak/70c9301f0fd1ac2d6b58de03f61997e3) 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
|
47
developer_docs/preparing_a_pull_request.md
Normal file
47
developer_docs/preparing_a_pull_request.md
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Preparing a pull request
|
||||
|
||||
Copied from the [p5.js repository](https://github.com/processing/p5.js).
|
||||
|
||||
Pull-requests are easier when your code is up to date! You can use git rebase to update your code to incorporate changes from other contributors. Here's how.
|
||||
|
||||
## Save and Update
|
||||
|
||||
### Save everything you have!
|
||||
git status
|
||||
git add -u
|
||||
git commit
|
||||
|
||||
|
||||
### Find out about changes
|
||||
Make sure you're tracking upstream p5.js repository.
|
||||
|
||||
git remote show upstream
|
||||
|
||||
If you see an error, you'll need to start tracking the main p5.js repo as an "upstream" remote repository. You'll only need to do this once! But, no harm is done if you run it a second time.
|
||||
|
||||
git remote add upstream https://github.com/processing/p5.js
|
||||
|
||||
Then ask git about the latest changes.
|
||||
|
||||
git fetch upstream
|
||||
|
||||
### Just in case: make a copy of your changes in a new branch
|
||||
git branch your-branch-name-backup
|
||||
|
||||
### Apply changes from master branch, adds your changes *after*
|
||||
git rebase upstream/master
|
||||
|
||||
## CONFLICTS
|
||||
You will probably have some conflicts!
|
||||
If it’s just lib/p5.js and lib/p5.min.js, it’s easy to fix. just build the project again with grunt.
|
||||
|
||||
grunt
|
||||
git add -u
|
||||
git rebase --continue
|
||||
|
||||
If you have conflicts in other files & you're not sure how to resolve them... ask for help! Lauren, David, Kevin, and Kate are familiar with recent changes and can help you figure out what's new.
|
||||
|
||||
## And finally, for great glory
|
||||
git push origin
|
||||
|
||||
Here's a good reference on rebasing, in case you're intensely curious about the technical details. https://www.atlassian.com/git/tutorials/merging-vs-rebasing
|
22
docker-compose-development.yml
Normal file
22
docker-compose-development.yml
Normal file
|
@ -0,0 +1,22 @@
|
|||
version: '3.4'
|
||||
services:
|
||||
mongo:
|
||||
image: mongo:3.6
|
||||
volumes:
|
||||
- dbdata:/data/db
|
||||
app:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile
|
||||
target: development
|
||||
environment:
|
||||
- MONGO_URL=mongodb://mongo:27017/p5js-web-editor
|
||||
volumes:
|
||||
- .:/usr/src/app
|
||||
- /usr/src/app/node_modules
|
||||
ports:
|
||||
- '8000:8000'
|
||||
depends_on:
|
||||
- mongo
|
||||
volumes:
|
||||
dbdata:
|
|
@ -1,22 +1,47 @@
|
|||
version: '2'
|
||||
version: '3.4'
|
||||
services:
|
||||
mongo:
|
||||
image: mongo:3.4.7
|
||||
server:
|
||||
build: .
|
||||
command: npm start
|
||||
image: mongo:3.6
|
||||
volumes:
|
||||
- dbdata:/data/db
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
target: production
|
||||
# uncomment the following line to pull the image from docker hub
|
||||
# image: index.docker.io/catarak/p5.js-web-editor:latest
|
||||
# uncomment the following lines if you don't want export all of the variables
|
||||
# defined in your .env file for testing
|
||||
# env_file:
|
||||
# - "$PWD/.env"
|
||||
environment:
|
||||
- API_URL=/api
|
||||
- MONGO_URL=mongodb://mongo:27017/p5js-web-editor
|
||||
- PORT=8000
|
||||
- SESSION_SECRET=override_in_dotenv
|
||||
- AWS_ACCESS_KEY=override_in_dotenv
|
||||
- AWS_SECRET_KEY=override_in_dotenv
|
||||
- AWS_REGION=override_in_dotenv
|
||||
- S3_BUCKET=override_in_dotenv
|
||||
- GITHUB_ID=override_in_dotenv
|
||||
- GITHUB_SECRET=override_in_dotenv
|
||||
- MAILGUN_KEY=override_in_dotenv
|
||||
- API_URL
|
||||
- MONGO_URL
|
||||
- PORT
|
||||
- SESSION_SECRET
|
||||
- AWS_ACCESS_KEY
|
||||
- AWS_SECRET_KEY
|
||||
- S3_BUCKET
|
||||
- AWS_REGION
|
||||
- GITHUB_ID
|
||||
- GITHUB_SECRET
|
||||
- MAILGUN_DOMAIN
|
||||
- MAILGUN_KEY
|
||||
- EMAIL_SENDER
|
||||
- EMAIL_VERIFY_SECRET_TOKEN
|
||||
- S3_BUCKET_URL_BASE
|
||||
- GG_EXAMPLES_USERNAME
|
||||
- GG_EXAMPLES_PASS
|
||||
- GG_EXAMPLES_EMAIL
|
||||
- GOOGLE_ID
|
||||
- GOOGLE_SECRET
|
||||
- EXAMPLE_USER_EMAIL
|
||||
- EXAMPLE_USER_PASSWORD
|
||||
- FORCE_TO_HTTPS
|
||||
# you can either set this in your .env or as an environment variables
|
||||
# or here YOU CHOOSE
|
||||
# - MONGO_URL=mongodb://mongo:27017/p5js-web-editor
|
||||
volumes:
|
||||
- .:/opt/node/app
|
||||
- /opt/node/app/node_modules
|
||||
|
@ -24,3 +49,5 @@ services:
|
|||
- '8000:8000'
|
||||
depends_on:
|
||||
- mongo
|
||||
volumes:
|
||||
dbdata:
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"name": "p5js-web-editor",
|
||||
"script": "index.js",
|
||||
"env": {
|
||||
"NODE_ENV": "production"
|
||||
},
|
||||
"instances" : 2,
|
||||
"exec_mode" : "cluster"
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
require('babel-register');
|
||||
require('babel-polyfill');
|
||||
require('dotenv').config();
|
||||
require('./server/examples-gg-latest.js');
|
|
@ -1,4 +0,0 @@
|
|||
require('babel-register');
|
||||
require('babel-polyfill');
|
||||
require('dotenv').config();
|
||||
require('./server/examples.js');
|
17
index.html
17
index.html
|
@ -1,17 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="keywords" content="p5.js, p5.js web editor, web editor, processing, code editor" />
|
||||
<meta name="description" content="A web editor for sketching using p5.js library." />
|
||||
<title>p5.js Web Editor</title>
|
||||
<link href='https://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css'>
|
||||
<link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" class="root-app">
|
||||
</div>
|
||||
<script src="/dist/vendor.js"></script>
|
||||
<script src="/dist/app.js"></script>
|
||||
</body>
|
||||
</html>
|
15
index.js
15
index.js
|
@ -1,15 +1,15 @@
|
|||
let parsed = require('dotenv').config();
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
process.env.webpackAssets = JSON.stringify(require('./dist/static/manifest.json'));
|
||||
process.env.webpackChunkAssets = JSON.stringify(require('./dist/static/chunk-manifest.json'));
|
||||
require('./dist/server.bundle.js');
|
||||
} else {
|
||||
let parsed = require('dotenv').config();
|
||||
require('babel-register')({
|
||||
"plugins": [
|
||||
[
|
||||
"babel-plugin-webpack-loaders",
|
||||
{
|
||||
"config": "./webpack.config.babel.js",
|
||||
"config": "./webpack/config.babel.js",
|
||||
"verbose": false
|
||||
}
|
||||
]
|
||||
|
@ -17,10 +17,11 @@ if (process.env.NODE_ENV === 'production') {
|
|||
});
|
||||
require('babel-polyfill');
|
||||
//// in development, let .env values override those in the environment already (i.e. in docker-compose.yml)
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
for (let key in parsed) {
|
||||
process.env[key] = parsed[key];
|
||||
}
|
||||
}
|
||||
// so commenting this out makes the docker container work.
|
||||
// if (process.env.NODE_ENV === 'development') {
|
||||
// for (let key in parsed) {
|
||||
// process.env[key] = parsed[key];
|
||||
// }
|
||||
// }
|
||||
require('./server/server');
|
||||
}
|
||||
|
|
120
kubernetes_app.yml
Normal file
120
kubernetes_app.yml
Normal file
|
@ -0,0 +1,120 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: editor-ingress
|
||||
annotations:
|
||||
kubernetes.io/ingress.global-static-ip-name: "web-editor-ip"
|
||||
spec:
|
||||
backend:
|
||||
serviceName: web-editor-node
|
||||
servicePort: 8000
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: web-editor-node
|
||||
labels:
|
||||
app: web-editor
|
||||
spec:
|
||||
# if your cluster supports it, uncomment the following to automatically create
|
||||
# an external load-balanced IP for the frontend service.
|
||||
# type: LoadBalancer
|
||||
type: NodePort
|
||||
ports:
|
||||
- port: 8000
|
||||
targetPort: 8000
|
||||
selector:
|
||||
app: web-editor
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: web-editor-node
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: web-editor
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: web-editor
|
||||
spec:
|
||||
containers:
|
||||
- name: web-editor-app
|
||||
image: index.docker.io/catarak/p5.js-web-editor:latest
|
||||
# temp, just to test kubernetes
|
||||
# envFrom:
|
||||
# - configMapRef:
|
||||
# name: web-editor-env
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: web-editor-credentials
|
||||
imagePullPolicy: Always
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8000
|
||||
---
|
||||
apiVersion: autoscaling/v1
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
annotations:
|
||||
name: web-editor-node
|
||||
namespace: default
|
||||
spec:
|
||||
maxReplicas: 6
|
||||
minReplicas: 1
|
||||
scaleTargetRef:
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
name: web-editor-node
|
||||
targetCPUUtilizationPercentage: 80
|
||||
# ---
|
||||
# # cronjob for p5.js examples
|
||||
# apiVersion: batch/v1beta1
|
||||
# kind: CronJob
|
||||
# metadata:
|
||||
# name: fetch-examples-job
|
||||
# spec:
|
||||
# schedule: "0 0 * * 0"
|
||||
# jobTemplate:
|
||||
# spec:
|
||||
# template:
|
||||
# spec:
|
||||
# containers:
|
||||
# - name: fetch-examples
|
||||
# image: index.docker.io/catarak/p5.js-web-editor:latest
|
||||
# command: ["npm", "run", "fetch-examples:prod"]
|
||||
# imagePullPolicy: Always
|
||||
# envFrom:
|
||||
# - secretRef:
|
||||
# name: web-editor-credentials
|
||||
# restartPolicy: Never
|
||||
# ---
|
||||
# # cronjob for generative gestaltung p5.js examples
|
||||
# apiVersion: batch/v1beta1
|
||||
# kind: CronJob
|
||||
# metadata:
|
||||
# name: fetch-examples-gg-job
|
||||
# spec:
|
||||
# schedule: "30 0 * * 0"
|
||||
# jobTemplate:
|
||||
# spec:
|
||||
# template:
|
||||
# spec:
|
||||
# containers:
|
||||
# - name: fetch-examples-gg
|
||||
# image: index.docker.io/catarak/p5.js-web-editor:latest
|
||||
# command: ["npm", "run", "fetch-examples-gg:prod"]
|
||||
# imagePullPolicy: Always
|
||||
# envFrom:
|
||||
# - secretRef:
|
||||
# name: web-editor-credentials
|
||||
# restartPolicy: Never
|
61
nginx.conf
61
nginx.conf
|
@ -1,61 +0,0 @@
|
|||
# HTTP - redirect all requests to HTTPS:
|
||||
server {
|
||||
listen 80;
|
||||
server_name alpha.editor.p5js.org;
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
location ~* \/login(\/)* {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
location ~* \/signup(\/)* {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
location ~* \/reset-password(\/)* {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
location ~* "\/[a-zA-Z0-9._-]{1,20}\/account(\/)*" {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443;
|
||||
ssl on;
|
||||
ssl_certificate /etc/letsencrypt/live/alpha.editor.p5js.org/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/alpha.editor.p5js.org/privkey.pem;
|
||||
server_name alpha.editor.p5js.org;
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name editor.p5js.org;
|
||||
location ~ ^/(.*) {
|
||||
return 302 http://alpha.editor.p5js.org/$1;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443;
|
||||
ssl on;
|
||||
ssl_certificate /etc/letsencrypt/live/editor.p5js.org/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/editor.p5js.org/privkey.pem;
|
||||
server_name editor.p5js.org;
|
||||
location ~ ^/(.*) {
|
||||
return 302 https://alpha.editor.p5js.org/$1;
|
||||
}
|
||||
}
|
1354
package-lock.json
generated
1354
package-lock.json
generated
File diff suppressed because it is too large
Load diff
16
package.json
16
package.json
|
@ -8,12 +8,15 @@
|
|||
"start:prod": "cross-env NODE_ENV=production node index.js",
|
||||
"lint": "eslint client server --ext .jsx --ext .js",
|
||||
"lint-fix": "eslint client server --ext .jsx --ext .js --fix",
|
||||
"build": "npm run build:client && npm run build:server",
|
||||
"build:client": "cross-env NODE_ENV=production webpack --config webpack.config.prod.js --progress",
|
||||
"build:server": "cross-env NODE_ENV=production webpack --config webpack.config.server.js --progress",
|
||||
"build": "npm run build:client && npm run build:server && npm run build:examples",
|
||||
"build:client": "cross-env NODE_ENV=production webpack --config webpack/config.prod.js",
|
||||
"build:server": "cross-env NODE_ENV=production webpack --config webpack/config.server.js",
|
||||
"build:examples": "cross-env NODE_ENV=production webpack --config webpack/config.examples.js",
|
||||
"test": "npm run lint",
|
||||
"fetch-examples": "node fetch-examples.js",
|
||||
"fetch-examples-gg": "node fetch-examples-gg.js"
|
||||
"fetch-examples": "cross-env NODE_ENV=development node ./server/scripts/fetch-examples.js",
|
||||
"fetch-examples-gg": "cross-env NODE_ENV=development node ./server/scripts/fetch-examples-gg.js",
|
||||
"fetch-examples:prod": "cross-env NODE_ENV=production node ./dist/fetch-examples.bundle.js",
|
||||
"fetch-examples-gg:prod": "cross-env NODE_ENV=production node ./dist/fetch-examples-gg.bundle.js"
|
||||
},
|
||||
"main": "index.js",
|
||||
"author": "Cassie Tarakajian",
|
||||
|
@ -84,6 +87,7 @@
|
|||
"escape-string-regexp": "^1.0.5",
|
||||
"eslint-loader": "^1.3.0",
|
||||
"express": "^4.13.4",
|
||||
"express-basic-auth": "^1.1.5",
|
||||
"express-session": "^1.13.0",
|
||||
"htmlhint": "^0.9.13",
|
||||
"is-url": "^1.2.2",
|
||||
|
@ -94,7 +98,7 @@
|
|||
"loop-protect": "github:catarak/loop-protect",
|
||||
"mjml": "^3.3.2",
|
||||
"moment": "^2.14.1",
|
||||
"mongoose": "^4.4.16",
|
||||
"mongoose": "^4.6.8",
|
||||
"node-uuid": "^1.4.7",
|
||||
"nodemailer": "^2.6.4",
|
||||
"nodemailer-mailgun-transport": "^1.2.2",
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
const config = {
|
||||
mongoURL: process.env.MONGO_URL || 'mongodb://localhost:27017/p5js-web-editor',
|
||||
port: process.env.PORT || 8000,
|
||||
};
|
||||
|
||||
export default config;
|
|
@ -3,10 +3,11 @@ import Q from 'q';
|
|||
import mongoose from 'mongoose';
|
||||
import objectID from 'bson-objectid';
|
||||
import shortid from 'shortid';
|
||||
import { URL } from 'url';
|
||||
|
||||
import eachSeries from 'async/eachSeries';
|
||||
import User from './models/user';
|
||||
import Project from './models/project';
|
||||
import User from '../models/user';
|
||||
import Project from '../models/project';
|
||||
|
||||
// TODO: change to true when testing!
|
||||
const testMake = false;
|
||||
|
@ -65,7 +66,9 @@ canvas {
|
|||
|
||||
const headers = { 'User-Agent': 'p5js-web-editor/0.0.1' };
|
||||
|
||||
mongoose.connect(process.env.MONGO_URL);
|
||||
const mongoConnectionString = process.env.MONGO_URL;
|
||||
|
||||
mongoose.connect(mongoConnectionString, { useMongoClient: true });
|
||||
mongoose.connection.on('error', () => {
|
||||
console.error('MongoDB Connection Error. Please make sure that MongoDB is running.');
|
||||
process.exit(1);
|
|
@ -4,8 +4,9 @@ import mongoose from 'mongoose';
|
|||
import objectID from 'bson-objectid';
|
||||
import shortid from 'shortid';
|
||||
import eachSeries from 'async/eachSeries';
|
||||
import User from './models/user';
|
||||
import Project from './models/project';
|
||||
import { URL } from 'url';
|
||||
import User from '../models/user';
|
||||
import Project from '../models/project';
|
||||
|
||||
const defaultHTML =
|
||||
`<!DOCTYPE html>
|
||||
|
@ -35,7 +36,9 @@ const clientSecret = process.env.GITHUB_SECRET;
|
|||
|
||||
const headers = { 'User-Agent': 'p5js-web-editor/0.0.1' };
|
||||
|
||||
mongoose.connect(process.env.MONGO_URL);
|
||||
const mongoConnectionString = process.env.MONGO_URL;
|
||||
|
||||
mongoose.connect(mongoConnectionString, { useMongoClient: true });
|
||||
mongoose.connection.on('error', () => {
|
||||
console.error('MongoDB Connection Error. Please make sure that MongoDB is running.');
|
||||
process.exit(1);
|
8
server/scripts/fetch-examples-gg.js
Normal file
8
server/scripts/fetch-examples-gg.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
require('babel-register');
|
||||
require('babel-polyfill');
|
||||
const dotenv = require('dotenv');
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
dotenv.config();
|
||||
}
|
||||
require('./examples-gg-latest.js');
|
8
server/scripts/fetch-examples.js
Normal file
8
server/scripts/fetch-examples.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
require('babel-register');
|
||||
require('babel-polyfill');
|
||||
const dotenv = require('dotenv');
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
dotenv.config();
|
||||
}
|
||||
require('./examples.js');
|
|
@ -7,15 +7,16 @@ import session from 'express-session';
|
|||
import connectMongo from 'connect-mongo';
|
||||
import passport from 'passport';
|
||||
import path from 'path';
|
||||
import { URL } from 'url';
|
||||
import basicAuth from 'express-basic-auth';
|
||||
|
||||
// Webpack Requirements
|
||||
import webpack from 'webpack';
|
||||
import webpackDevMiddleware from 'webpack-dev-middleware';
|
||||
import webpackHotMiddleware from 'webpack-hot-middleware';
|
||||
import config from '../webpack.config.dev';
|
||||
import config from '../webpack/config.dev';
|
||||
|
||||
// Import all required modules
|
||||
import serverConfig from './config';
|
||||
import users from './routes/user.routes';
|
||||
import sessions from './routes/session.routes';
|
||||
import projects from './routes/project.routes';
|
||||
|
@ -32,6 +33,18 @@ import { get404Sketch } from './views/404Page';
|
|||
const app = new Express();
|
||||
const MongoStore = connectMongo(session);
|
||||
|
||||
app.get('/health', (req, res) => res.json({ success: true }));
|
||||
|
||||
// For basic auth, in setting up beta editor
|
||||
if (process.env.BASIC_USERNAME && process.env.BASIC_PASSWORD) {
|
||||
app.use(basicAuth({
|
||||
users: {
|
||||
[process.env.BASIC_USERNAME]: process.env.BASIC_PASSWORD
|
||||
},
|
||||
challenge: true
|
||||
}));
|
||||
}
|
||||
|
||||
const corsOriginsWhitelist = [
|
||||
/p5js\.org$/,
|
||||
];
|
||||
|
@ -45,6 +58,7 @@ if (process.env.NODE_ENV === 'development') {
|
|||
corsOriginsWhitelist.push(/localhost/);
|
||||
}
|
||||
|
||||
const mongoConnectionString = process.env.MONGO_URL;
|
||||
app.set('trust proxy', true);
|
||||
|
||||
// Enable Cross-Origin Resource Sharing (CORS) for all origins
|
||||
|
@ -75,7 +89,7 @@ app.use(session({
|
|||
secure: false,
|
||||
},
|
||||
store: new MongoStore({
|
||||
url: process.env.MONGO_URL,
|
||||
url: mongoConnectionString,
|
||||
autoReconnect: true
|
||||
})
|
||||
}));
|
||||
|
@ -108,8 +122,7 @@ require('./config/passport');
|
|||
// const passportConfig = require('./config/passport');
|
||||
|
||||
// Connect to MongoDB
|
||||
// mongoose.connect(process.env.MONGODB_URI || process.env.MONGOLAB_URI);
|
||||
mongoose.connect(serverConfig.mongoURL);
|
||||
mongoose.connect(mongoConnectionString, { useMongoClient: true });
|
||||
mongoose.connection.on('error', () => {
|
||||
console.error('MongoDB Connection Error. Please make sure that MongoDB is running.');
|
||||
process.exit(1);
|
||||
|
@ -134,9 +147,9 @@ app.get('*', (req, res) => {
|
|||
});
|
||||
|
||||
// start app
|
||||
app.listen(serverConfig.port, (error) => {
|
||||
app.listen(process.env.PORT, (error) => {
|
||||
if (!error) {
|
||||
console.log(`p5js web editor is running on port: ${serverConfig.port}!`); // eslint-disable-line
|
||||
console.log(`p5js web editor is running on port: ${process.env.PORT}!`); // eslint-disable-line
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -15,6 +15,21 @@ export function renderIndex() {
|
|||
<link href='https://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css'>
|
||||
<link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
|
||||
<link rel='shortcut icon' href='https://raw.githubusercontent.com/processing/p5.js-website-OLD/master/favicon.ico' type='image/x-icon'/ >
|
||||
<script>
|
||||
if (!window.process) {
|
||||
window.process = {};
|
||||
}
|
||||
if (!window.process.env) {
|
||||
window.process.env = {};
|
||||
}
|
||||
window.process.env.API_URL = '${process.env.API_URL}';
|
||||
window.process.env.NODE_ENV = '${process.env.NODE_ENV}';
|
||||
window.process.env.S3_BUCKET = '${process.env.S3_BUCKET}';
|
||||
window.process.env.S3_BUCKET_URL_BASE = ${process.env.S3_BUCKET_URL_BASE ? `'${process.env.S3_BUCKET_URL_BASE}'` : undefined};
|
||||
window.process.env.AWS_REGION = '${process.env.AWS_REGION}';
|
||||
window.process.env.FORCE_TO_HTTPS = ${process.env.FORCE_TO_HTTPS === 'false' ? false : undefined};
|
||||
window.process.env.CLIENT = true;
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" class="root-app">
|
||||
|
@ -24,19 +39,19 @@ export function renderIndex() {
|
|||
`//<![CDATA[
|
||||
window.webpackManifest = ${JSON.stringify(chunkManifest)};
|
||||
//]]>` : ''}
|
||||
</script>
|
||||
<script src='${process.env.NODE_ENV === 'production' ? `${assetsManifest['/vendor.js']}` : '/vendor.js'}'></script>
|
||||
<script src='${process.env.NODE_ENV === 'production' ? `${assetsManifest['/app.js']}` : '/app.js'}'></script>
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||
</script>
|
||||
<script src='${process.env.NODE_ENV === 'production' ? `${assetsManifest['/vendor.js']}` : '/vendor.js'}'></script>
|
||||
<script src='${process.env.NODE_ENV === 'production' ? `${assetsManifest['/app.js']}` : '/app.js'}'></script>
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', 'UA-53383000-1', 'auto');
|
||||
ga('send', 'pageview');
|
||||
ga('create', 'UA-53383000-1', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
require('dotenv').config();
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
require('dotenv').config();
|
||||
}
|
||||
|
||||
module.exports = [{
|
||||
devtool: 'cheap-module-eval-source-map',
|
||||
|
@ -36,15 +39,7 @@ module.exports = [{
|
|||
}),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
API_URL: process.env.API_URL ? `"${process.env.API_URL}"` : undefined,
|
||||
CLIENT: JSON.stringify(true),
|
||||
FORCE_TO_HTTPS: process.env.FORCE_TO_HTTPS === 'true' ?
|
||||
JSON.stringify(true) :
|
||||
JSON.stringify(false),
|
||||
NODE_ENV: JSON.stringify('development'),
|
||||
S3_BUCKET: process.env.S3_BUCKET ? `"${process.env.S3_BUCKET}"` : undefined,
|
||||
S3_BUCKET_URL_BASE: process.env.S3_BUCKET_URL_BASE ? `"${process.env.S3_BUCKET_URL_BASE}"` : undefined,
|
||||
AWS_REGION: process.env.AWS_REGION ? `"${process.env.AWS_REGION}"` : undefined
|
||||
NODE_ENV: JSON.stringify('development')
|
||||
}
|
||||
})
|
||||
],
|
||||
|
@ -93,7 +88,7 @@ module.exports = [{
|
|||
},
|
||||
},
|
||||
{
|
||||
entry: path.resolve(__dirname, 'client/utils/previewEntry.js'),
|
||||
entry: path.resolve(__dirname, '../client/utils/previewEntry.js'),
|
||||
target: 'web',
|
||||
output: {
|
||||
path: `${__dirname}`,
|
||||
|
@ -122,8 +117,8 @@ module.exports = [{
|
|||
plugins: [
|
||||
[
|
||||
'babel-plugin-webpack-loaders', {
|
||||
'config': './webpack.config.babel.js',
|
||||
"verbose": false
|
||||
'config': path.resolve(__dirname, './config.babel.js'),
|
||||
'verbose': false
|
||||
}
|
||||
]
|
||||
]
|
93
webpack/config.examples.js
Normal file
93
webpack/config.examples.js
Normal file
|
@ -0,0 +1,93 @@
|
|||
const path = require('path');
|
||||
const nodeExternals = require('webpack-node-externals');
|
||||
|
||||
module.exports = [{
|
||||
entry: path.resolve(__dirname, '../server/scripts/fetch-examples.js'),
|
||||
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../dist/'),
|
||||
filename: 'fetch-examples.bundle.js'
|
||||
},
|
||||
|
||||
target: 'node',
|
||||
|
||||
externals: [nodeExternals()],
|
||||
|
||||
resolve: {
|
||||
extensions: ['*', '.js', '.jsx'],
|
||||
modules: [
|
||||
'client',
|
||||
'node_modules',
|
||||
],
|
||||
},
|
||||
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader',
|
||||
query: {
|
||||
presets: [
|
||||
'react',
|
||||
'env',
|
||||
'stage-0',
|
||||
],
|
||||
plugins: [
|
||||
[
|
||||
'babel-plugin-webpack-loaders', {
|
||||
'config': path.resolve(__dirname, './config.babel.js'),
|
||||
"verbose": false
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
entry: path.resolve(__dirname, '../server/scripts/fetch-examples-gg.js'),
|
||||
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../dist/'),
|
||||
filename: 'fetch-examples-gg.bundle.js'
|
||||
},
|
||||
|
||||
target: 'node',
|
||||
|
||||
externals: [nodeExternals()],
|
||||
|
||||
resolve: {
|
||||
extensions: ['*', '.js', '.jsx'],
|
||||
modules: [
|
||||
'client',
|
||||
'node_modules',
|
||||
],
|
||||
},
|
||||
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader',
|
||||
query: {
|
||||
presets: [
|
||||
'react',
|
||||
'env',
|
||||
'stage-0',
|
||||
],
|
||||
plugins: [
|
||||
[
|
||||
'babel-plugin-webpack-loaders', {
|
||||
'config': path.resolve(__dirname, './config.babel.js'),
|
||||
"verbose": false
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
}
|
||||
],
|
||||
},
|
||||
}];
|
|
@ -1,4 +1,5 @@
|
|||
const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
const ManifestPlugin = require('webpack-manifest-plugin');
|
||||
const ChunkManifestPlugin = require('chunk-manifest-webpack-plugin');
|
||||
|
@ -6,7 +7,9 @@ const cssnext = require('postcss-cssnext');
|
|||
const postcssFocus = require('postcss-focus');
|
||||
const postcssReporter = require('postcss-reporter');
|
||||
const cssnano = require('cssnano');
|
||||
require('dotenv').config();
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
require('dotenv').config();
|
||||
}
|
||||
|
||||
module.exports = [{
|
||||
devtool: 'source-map',
|
||||
|
@ -14,7 +17,7 @@ module.exports = [{
|
|||
entry: {
|
||||
app: [
|
||||
'babel-polyfill',
|
||||
'./client/index.jsx'
|
||||
path.resolve(__dirname, '../client/index.jsx')
|
||||
],
|
||||
vendor: [
|
||||
'axios',
|
||||
|
@ -37,7 +40,7 @@ module.exports = [{
|
|||
]
|
||||
},
|
||||
output: {
|
||||
path: `${__dirname}/dist/static`,
|
||||
path: path.resolve(__dirname, '../dist/static'),
|
||||
filename: '[name].[chunkhash].js',
|
||||
publicPath: '/'
|
||||
},
|
||||
|
@ -86,11 +89,7 @@ module.exports = [{
|
|||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
API_URL: process.env.API_URL ? `"${process.env.API_URL}"` : undefined,
|
||||
NODE_ENV: JSON.stringify('production'),
|
||||
S3_BUCKET: process.env.S3_BUCKET ? `"${process.env.S3_BUCKET}"` : undefined,
|
||||
S3_BUCKET_URL_BASE: process.env.S3_BUCKET_URL_BASE ? `"${process.env.S3_BUCKET_URL_BASE}"` : undefined,
|
||||
AWS_REGION: process.env.AWS_REGION ? `"${process.env.AWS_REGION}"` : undefined
|
||||
NODE_ENV: JSON.stringify('production')
|
||||
}
|
||||
}),
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
|
@ -107,6 +106,7 @@ module.exports = [{
|
|||
manifestVariable: 'webpackManifest',
|
||||
}),
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
sourceMap: true,
|
||||
compress: {
|
||||
warnings: false
|
||||
}
|
||||
|
@ -133,12 +133,12 @@ module.exports = [{
|
|||
{
|
||||
entry: {
|
||||
app: [
|
||||
'./client/utils/previewEntry.js'
|
||||
path.resolve(__dirname, '../client/utils/previewEntry.js')
|
||||
]
|
||||
},
|
||||
target: 'web',
|
||||
output: {
|
||||
path: `${__dirname}/dist/static`,
|
||||
path: path.resolve(__dirname, '../dist/static'),
|
||||
filename: 'previewScripts.js',
|
||||
publicPath: '/'
|
||||
},
|
||||
|
@ -165,4 +165,4 @@ module.exports = [{
|
|||
}
|
||||
})
|
||||
]
|
||||
}];
|
||||
}];
|
|
@ -4,10 +4,10 @@ const nodeExternals = require('webpack-node-externals');
|
|||
|
||||
module.exports = {
|
||||
|
||||
entry: path.resolve(__dirname, 'server/server.js'),
|
||||
entry: path.resolve(__dirname, '../server/server.js'),
|
||||
|
||||
output: {
|
||||
path: __dirname + '/dist/',
|
||||
path: path.resolve(__dirname, '../dist/'),
|
||||
filename: 'server.bundle.js',
|
||||
},
|
||||
|
||||
|
@ -42,7 +42,7 @@ module.exports = {
|
|||
plugins: [
|
||||
[
|
||||
'babel-plugin-webpack-loaders', {
|
||||
'config': './webpack.config.babel.js',
|
||||
'config': path.resolve(__dirname, './config.babel.js'),
|
||||
"verbose": false
|
||||
}
|
||||
]
|
Loading…
Reference in a new issue