Skip to content

Production deployment #706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 85 commits into from
Sep 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
2fe11eb
move github files to .github folder, delete useless server config, ge…
catarak May 18, 2018
752b804
remove unused index.html, move example fetch to own folder
catarak May 18, 2018
073e307
start production docker configuration
catarak May 18, 2018
edadfd5
more changes to get dockerization working
catarak Jun 4, 2018
ece6c8e
update .env.example and README, start to build out Docker development…
catarak Jun 7, 2018
28c91b7
start to handle environment variables
catarak Jun 7, 2018
93e4052
change Dockerfile to fix environment variables and fetching examples
catarak Jun 8, 2018
6ecfe64
fix fetch example scripts, add webpack config to build fetch script b…
catarak Jun 14, 2018
d8e1297
get local-ssl-proxy working for testing prod locally
catarak Jun 15, 2018
5613a28
move github files to .github folder, delete useless server config, ge…
catarak May 18, 2018
41f793b
remove unused index.html, move example fetch to own folder
catarak May 18, 2018
c10ae61
start production docker configuration
catarak May 18, 2018
2f84fe1
more changes to get dockerization working
catarak Jun 4, 2018
0857a52
update .env.example and README, start to build out Docker development…
catarak Jun 7, 2018
6dd92a1
start to handle environment variables
catarak Jun 7, 2018
131e853
change Dockerfile to fix environment variables and fetching examples
catarak Jun 8, 2018
a14c232
fix fetch example scripts, add webpack config to build fetch script b…
catarak Jun 14, 2018
b172087
get local-ssl-proxy working for testing prod locally
catarak Jun 15, 2018
c7ce85e
fix merge conflicts
catarak Jun 18, 2018
d4b927f
get nginx proxying working on local machine
catarak Jun 19, 2018
f7db489
remove reference to .env file from docker-compose.yml
catarak Jun 20, 2018
25aa5c7
remove --progress from webpack build to see if it prints error
catarak Jun 20, 2018
f340d27
remove installation step from travis because it's in Dockerfile
catarak Jun 20, 2018
b86a409
try removing before_script
catarak Jun 20, 2018
217ae70
try building docker images in development first for linting
catarak Jun 20, 2018
d29be20
Merge branch 'master' into production-docker
catarak Jun 20, 2018
432361b
fix lint errors
catarak Jun 20, 2018
adebaab
try pushing images to docker hub
catarak Jun 20, 2018
4b78b7b
fix docker tag command
catarak Jun 20, 2018
72750e8
try to tag docker images again
catarak Jun 20, 2018
1c13563
okay this time definitely the docker push will work
catarak Jun 20, 2018
f06198a
start to add mongo configuration
catarak Jun 25, 2018
a7f319a
add authentication to mongo, properly, not tested to see if it works …
catarak Jun 26, 2018
f6f8e14
get the mongo authentication to workgit add .
catarak Jun 26, 2018
ffeb900
comment out .env file
catarak Jun 26, 2018
82059bb
remove nginx Dockerfile because it's not actually necessary
catarak Jun 27, 2018
fa5a9e3
fix linting errors and do stuff to make build work
catarak Jun 27, 2018
97acbf1
change tag to docker hub to latest
catarak Jul 3, 2018
6b560fb
in process changes to start kubernetes
catarak Jul 3, 2018
d53ed3c
start to add kubernetes configuration
catarak Jul 26, 2018
549d622
more config for kubernetes, fix example fetching tasks to include nod…
catarak Aug 9, 2018
27c9ea8
remove references to .env in docker-compose
catarak Aug 9, 2018
a1b9d39
try regenerating package-lock.json
catarak Aug 9, 2018
b25f0d3
add ability to disable FORCE_TO_HTTPS in prod
catarak Aug 9, 2018
8f912fe
fix webpack configuration to create source map
catarak Aug 9, 2018
c4b676d
fix Dockerfile and docker-compose.yml so that image will hopefully bu…
catarak Aug 10, 2018
66d24fc
try to get some insight on why env variables aren't being build into …
catarak Aug 13, 2018
b06c874
this time actually execute the right docker command
catarak Aug 13, 2018
ba051c2
try adding args to the build process and maybe this fixes it
catarak Aug 13, 2018
7f9a435
add args to Dockerfile
catarak Aug 13, 2018
dcb72b9
continue to develop kubernetes setup
catarak Aug 20, 2018
aa543fa
merge in master
catarak Aug 20, 2018
63fe883
fix merge conflict
catarak Aug 21, 2018
bd476d3
add basic auth to server for beta editor setup
catarak Aug 21, 2018
a8a008d
fix docker-compose config
catarak Aug 21, 2018
02456ea
try creating health check
catarak Aug 21, 2018
4dc0ee1
fix linting errors
catarak Aug 21, 2018
6705e4c
load client-side environment variables at runtime
catarak Aug 24, 2018
b4ca66e
update travis config to only build docker image on certain branches
catarak Aug 24, 2018
472bc0b
delete docker cloud file, is my travis yml fixed?
catarak Aug 24, 2018
1493d3e
try updating travis yaml again
catarak Aug 24, 2018
d44027c
for simplicity and security, remove redirect to HTTP and keep everyth…
catarak Aug 27, 2018
16b54b8
try updating travis to have deploy script
catarak Aug 27, 2018
363b9cc
ummm now does deploy work
catarak Aug 27, 2018
e332a29
does this fix the travis deployment????
catarak Aug 27, 2018
0930cf9
i have no idea why travis isn't running my deploy script
catarak Aug 27, 2018
49ab573
do i need to take out after_success???
catarak Aug 27, 2018
cab9aa5
try to fix google cloud sdk install in travis config
catarak Aug 27, 2018
89560fd
update before_deploy to remove 'beta' update which didn't work
catarak Aug 27, 2018
c3537b3
add step to deploy to push latest image to kubernetes cluster
catarak Aug 27, 2018
b5a32d7
update kubernetes config to include cronjobs to fetch examples
catarak Aug 28, 2018
2c09b08
Merge branch 'master' into production-docker
catarak Aug 29, 2018
5e70d8b
Merge branch 'master' into production-docker
catarak Aug 29, 2018
7cb2847
fix error with undefined env S3_URL_BUCKER_BASE
catarak Aug 30, 2018
0f0be1f
fix file uploads by updating mongoose
catarak Aug 31, 2018
02c7c2f
fix mongo connection so that deprecation warning doesn't appear
catarak Sep 5, 2018
545d4ae
fix mongo connection URL for example fetch scripts
catarak Sep 5, 2018
8be04ac
update fetch example scripts connection to mongodb, add pulling env v…
catarak Sep 7, 2018
cea61a7
Merge branch 'master' into production-docker
catarak Sep 7, 2018
d2c8140
Merge branch 'master' into production-docker
catarak Sep 7, 2018
a7e3c31
remove example cronjobs for now since they don't work
catarak Sep 9, 2018
a1d2acb
Merge branch 'master' into production-docker
catarak Sep 17, 2018
7ac6dd0
Merge branch 'master' into production-docker
catarak Sep 19, 2018
8495a59
Development documentation (#705)
catarak Sep 26, 2018
d66fad8
update documentation, change travis to only deploy on master
catarak Sep 26, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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>
[email protected]
EXAMPLE_USER_PASSWORD=hellop5js
GG_EXAMPLES_USERNAME=generative-design
GG_EXAMPLES_PASS=generativedesign
[email protected]
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
webpack.config.js
webpack/*
index.js
File renamed without changes.
58 changes: 6 additions & 52 deletions contributing.md → .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,24 @@
# 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)
- [Feature Enhancement](#feature-enhancement)
- [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.
Expand All @@ -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:

Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
.env
.env.production
.vscode/
node_modules/
npm-debug.log
Expand Down
38 changes: 37 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -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
37 changes: 23 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
EXPOSE 8000

# Install node modules
FROM base as development
ENV NODE_ENV development
COPY package.json package-lock.json ./
RUN npm install

# Rebuild node-sass just to be safe
RUN npm rebuild node-sass
COPY .babelrc index.js nodemon.json ./
COPY ./webpack ./webpack
COPY client ./client
COPY server ./server
CMD ["npm", "start"]

# For development, mark the directory as a mount override point
VOLUME $APP_HOME
FROM development as build
ENV NODE_ENV production
RUN npm run build

# Expose default server port
EXPOSE 8000
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"]
Loading