-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1244 from artsy/staging
Deploy
- Loading branch information
Showing
126 changed files
with
2,139 additions
and
856 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,25 @@ | ||
{} | ||
{ | ||
"presets": [ | ||
"es2015", | ||
"react", | ||
"stage-3" | ||
], | ||
"plugins": [ | ||
"babel-plugin-rewire", | ||
"inline-react-svg", | ||
"transform-runtime", | ||
["module-resolver", { | ||
"root": ["./"] | ||
}], | ||
"transform-class-properties" | ||
], | ||
"env": { | ||
"development": { | ||
"plugins": [ | ||
["styled-components", { | ||
"ssr": true | ||
}] | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,12 @@ API_URL=http://localhost:3005/api | |
FORCE_URL=https://staging.artsy.net | ||
ARTSY_URL=https://stagingapi.artsy.net | ||
SESSION_SECRET=p0s1tr0n | ||
MONGOHQ_URL=mongodb://localhost:27017/positron | ||
ELASTICSEARCH_PORT=9200 | ||
|
||
# Local development only for the below; refers to the key in docker-compose.yml | ||
ELASTICSEARCH_URL=http://elasticsearch:9200 | ||
MONGOHQ_URL=mongodb://mongodb:27017/positron | ||
|
||
TECH_SUPPORT=[email protected] | ||
DEBUG=api,client,app | ||
SALT=$2a$10$PJrPMBadu1NPdmnshBgFbe | ||
|
@@ -34,4 +39,4 @@ INSTANT_ARTICLE_ACCESS_TOKEN=REPLACE | |
FB_PAGE_ID=REPLACE | ||
DEFAULT_PARTNER_ID=REPLACE | ||
SENTRY_PUBLIC_DSN=REPLACE | ||
SENTRY_PRIVATE_DSN=REPLACE | ||
SENTRY_PRIVATE_DSN=REPLACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"parser": "babel-eslint", | ||
"extends": [ | ||
"standard", | ||
"standard-react" | ||
], | ||
"globals": { | ||
__dirname: true | ||
}, | ||
"env": { | ||
"browser": true, | ||
"mocha": true, | ||
"node": true | ||
}, | ||
"rules": { | ||
"camelcase": 0, | ||
"no-mixed-operators": 0, | ||
"no-new": 0, | ||
"react/jsx-indent": 0 | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ dump.rdb | |
.env.ignore | ||
node_modules | ||
.vscode | ||
data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM node:7 | ||
RUN mkdir -p /usr/src/app | ||
WORKDIR /usr/src/app | ||
COPY package.json . | ||
RUN yarn install | ||
COPY . . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,23 @@ Meta | |
Set-Up | ||
--- | ||
|
||
- Copy `.env.example` to `.env` in the root of the project and edit all `REPLACE` values with sensitive configuration obtained from `positron-staging`. This should help. | ||
|
||
``` | ||
heroku config --app=positron-staging | grep -E `cat .env.example | grep REPLACE | cut -f1 -d= | xargs | tr ' ' \|` | sed -e 's/:\ /=/g' | sed -e 's/ //g' | ||
``` | ||
|
||
### Via Docker Compose | ||
- Install [Docker for Mac](https://docs.docker.com/docker-for-mac/install/) | ||
- `git clone [email protected]:<your username>/positron.git && cd positron` | ||
- `docker-compose up` | ||
|
||
This starts a new self-contained Docker instance that boots MongoDB, ElasticSearch and Node. Changes made to source-code located in `api` and `client` is [automatically reloaded](https://github.com/artsy/positron/blob/master/boot.js#L34) on browser-refresh; no need to restart the process. | ||
|
||
To shut down the process, press `ctrl+c` or execute `docker-compose down`. | ||
|
||
### Manually | ||
|
||
- Install [NVM](https://github.com/creationix/nvm) | ||
- Install Node 6 | ||
|
||
|
@@ -41,12 +58,6 @@ git clone [email protected]:craigspaeth/positron.git && cd positron | |
yarn install | ||
``` | ||
|
||
- Copy `.env.example` to `.env` in the root of the project and edit all `REPLACE` values with sensitive configuration obtained from `positron-staging`. This should help. | ||
|
||
``` | ||
heroku config --app=positron-staging | grep -E `cat .env.example | grep REPLACE | cut -f1 -d= | xargs | tr ' ' \|` | sed -e 's/:\ /=/g' | sed -e 's/ //g' | ||
``` | ||
|
||
- Positron uses MongoDB as a database. To install MongoDB using homebrew do the following, if you would prefer to install manually check the documentation at [MongoDB](http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/) | ||
|
||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** | ||
* Main server that combines API & client | ||
*/ | ||
|
||
import artsyXapp from 'artsy-xapp' | ||
import express from 'express' | ||
import newrelic from 'artsy-newrelic' | ||
import path from 'path' | ||
import { IpFilter } from 'express-ipfilter' | ||
import { createReloadable, isDevelopment } from '@artsy/express-reloadable' | ||
|
||
const debug = require('debug')('app') | ||
const app = module.exports = express() | ||
|
||
// Blacklist ips | ||
app.use( | ||
IpFilter([process.env.IP_BLACKLIST.split(',')], { log: false, mode: 'deny' }) | ||
) | ||
|
||
// Get an xapp token | ||
const xappConfig = { | ||
url: process.env.ARTSY_URL, | ||
id: process.env.ARTSY_ID, | ||
secret: process.env.ARTSY_SECRET | ||
} | ||
|
||
artsyXapp.init(xappConfig, () => { | ||
app.use(newrelic) | ||
|
||
if (isDevelopment) { | ||
const reloadAndMount = createReloadable(app, require) | ||
|
||
// Enable server-side code hot-swapping on change | ||
app.use('/api', reloadAndMount(path.resolve(__dirname, 'api'), { | ||
mountPoint: '/api' | ||
})) | ||
|
||
invalidateUserMiddleware(app) | ||
reloadAndMount(path.resolve(__dirname, 'client')) | ||
|
||
// Staging, Prod | ||
} else { | ||
app.use('/api', require('./api')) | ||
invalidateUserMiddleware(app) | ||
app.use(require('./client')) | ||
} | ||
|
||
// Start the server and send a message to IPC for the integration test | ||
// helper to hook into. | ||
app.listen(process.env.PORT, () => { | ||
debug(`Listening on port ${process.env.PORT}`) | ||
|
||
if (typeof process.send === 'function') { | ||
process.send('listening') | ||
} | ||
}) | ||
}) | ||
|
||
// Crash if we can't get/refresh an xapp token | ||
artsyXapp.on('error', (error) => { | ||
console.warn(error) | ||
process.exit(1) | ||
}) | ||
|
||
const invalidateUserMiddleware = (app) => { | ||
app.use((req, rest, next) => { | ||
req.user = null | ||
next() | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.