Skip to content

Commit

Permalink
New Sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
philippeauriach committed Jun 14, 2021
1 parent 0eabea8 commit 066ff72
Show file tree
Hide file tree
Showing 21 changed files with 65 additions and 275 deletions.
1 change: 0 additions & 1 deletion .env.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
DEBUG=true
PUBLIC_URL=http://localhost:1337
APP_PORT=1337
SANDBOX_PORT=1338

PARSE_APP_NAME=connect
PARSE_APP_ID=connect
Expand Down
8 changes: 2 additions & 6 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,9 @@ The response from batch will be a list with the same number of elements as the i
### <a name="sandbox">Sandbox</a>

Before use the production database you can use the sanbox environnement.
Just add the following header to every requests you make to `/classes/*` or `/batch`:

For that two changes should be done :

- Every endpoint uri is `https://connect-project.io/parse-sandbox` instead of `https://connect-project.io/parse`
- Change the header value `x-parse-application-id` to `connect-sandbox`.

For the authentication you have to use the APP_TOKEN_SANDBOX instead of the APP_TOKEN.
`x-is-sandbox: true`

## <a name="schema-contribute">Schema Contribute</a>

Expand Down
8 changes: 1 addition & 7 deletions ecosystem.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ module.exports = {
name: 'connect',
script: 'src/index.js',
watch: '.',
ignore_watch : ["node_modules", "logs"],
},
{
name: 'connect-sandbox',
script: 'src/sandbox.js',
watch: '.',
ignore_watch : ["node_modules", "logs"],
ignore_watch: ['node_modules', 'logs'],
},
],
};
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
"description": "An open platform to save anonymous data coming from any application using this API",
"scripts": {
"start": "node src/index.js",
"start.sandbox": "node src/sandbox.js",
"build": "webpack --mode production",
"build.dev": "webpack --mode development",
"eslint.check": "eslint --ext js,jsx .",
"eslint.fix": "eslint --ext js,jsx --fix .",
"prettier.check": "prettier --list-different .",
"prettier.fix": "prettier --write .",
"test": "jest --config spec/jest.config.js -i --forceExit --detectOpenHandles",
"copyToSandbox": "./bin/migration.sh",
"performance": "node bin/performance.js"
},
"eslintConfig": {
Expand Down
1 change: 0 additions & 1 deletion prod_deploy/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ VERSION_NUMBER=1.0.0
# Set all domain value if it need to be change
PUBLIC_URL=https://connect-project.io/
APP_PORT=3000
SANDBOX_PORT=3001

# Setup your custom key (a random string value)
PARSE_FILE_KEY=TOSETUP
Expand Down
10 changes: 6 additions & 4 deletions prod_deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
- `var passwd = "connect"`
- `use connect`
- `db.createUser({user: user, pwd: passwd, roles: ["readWrite"]});`
- `connect-api`
- `db.createUser({user: user, pwd: passwd, roles: ["readWrite"]});`
- `connect-sandbox`
- `db.createUser({user: user, pwd: passwd, roles: ["readWrite"]});`

- Installer node et yarn (suivre https://classic.yarnpkg.com/en/docs/install/#centos-stable

Expand Down Expand Up @@ -64,15 +60,19 @@
- `curl -v localhost:3001/parse-sandbox`

## Configure crontab to renew the certificate

- run `sudo crontab -e` and add the following:

```
PATH=/sbin:/bin:/usr/sbin:/usr/bin
45 2 * * 6 certbot renew && nginx -s reload
```

## Installation de webhook

Configuration de webhook pour effectuer la mise à jour du serveur de manière automatique

- `sudo mkdir /opt/webhook`
- `sudo chown $USER /opt/webhook`
- Download release from https://github.com/adnanh/webhook/releases and extract the `webhook` binary to `/opt/webhook`
Expand All @@ -85,11 +85,13 @@ Configuration de webhook pour effectuer la mise à jour du serveur de manière a
- `curl localhost:9990/hooks/deploy-connect` should answer: `Hook rules were not satisfied.`
- `sudo systemctl enable webhook`
- Add the following redirection to the nginx server:

```
location /hooks/ {
proxy_pass http://127.0.0.1:9990;
}
```

- `sudo nginx -s reload`

## Pare-feu
Expand Down
3 changes: 0 additions & 3 deletions spec/__mock__/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@ module.exports = {
PUBLIC_URL: 'http://localhost:3000',
API_URL: 'http://localhost:3000',
APP_PORT: '3000',
// SANDBOX_URL: 'http://localhost:3000',
// SANDBOX_PORT: '3000',
PARSE_APP_NAME: 'test',
PARSE_APP_ID: 'test',
PARSE_FILE_KEY: 'test',
PARSE_MASTER_KEY: 'test_masterkey',
PARSE_READONLY_MASTER_KEY: 'test_masterkey_readonly',
PARSE_DASHBOARD_MAINTENER_PWD: 'test',
PARSE_DASHBOARD_ROOT_PWD: 'test',
PARSE_SANDBOX: false,
PARSE_SILENT: true,
MONGO_URI: 'mongodb://test:test@localhost:27017/test',
AUTH_SECRET: 'test',
Expand Down
8 changes: 0 additions & 8 deletions src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ testConfig(APP_PORT, 'APP_PORT');

const API_URL = `http://localhost:${APP_PORT}`;

const { SANDBOX_PORT } = process.env;
testConfig(SANDBOX_PORT, 'SANDBOX_PORT');

const SANDBOX_URL = `http://localhost:${SANDBOX_PORT}`;

const { PARSE_APP_NAME } = process.env;
testConfig(PARSE_APP_NAME, 'PARSE_APP_NAME');

Expand Down Expand Up @@ -81,16 +76,13 @@ module.exports = {
PUBLIC_URL,
API_URL,
APP_PORT,
SANDBOX_URL,
SANDBOX_PORT,
PARSE_APP_NAME,
PARSE_APP_ID,
PARSE_FILE_KEY,
PARSE_MASTER_KEY,
PARSE_READONLY_MASTER_KEY,
PARSE_DASHBOARD_MAINTENER_PWD,
PARSE_DASHBOARD_ROOT_PWD,
PARSE_SANDBOX: false,
PARSE_SILENT: false,
MONGO_URI,
AUTH_SECRET,
Expand Down
6 changes: 5 additions & 1 deletion src/connectServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ const oauthApi = require('./oauth/oauth-routes');
const parseApi = require('./middleware/parse');
const parseDashboard = require('./middleware/parseDashboard');
const parseSwagger = require('./middleware/parseSwagger');
const sandboxMiddleware = require('./middleware/sandboxMiddleware');
const oauthMiddleware = require('./oauth/oauth-middleware');

const configFront = require('./config/front');
const oauthMiddleware = require('./oauth/oauth-middleware');

class ConnectServer {
constructor(app, server) {
Expand Down Expand Up @@ -42,6 +43,9 @@ class ConnectServer {
app.use('/parse/batch', oauthMiddleware);
app.use('/parse/classes', oauthMiddleware);

app.use('/parse/batch', sandboxMiddleware);
app.use('/parse/classes', sandboxMiddleware);

// Serve the Parse API at /parse URL prefix
const parseMiddleware = await parseApi(parseCloudEvent);
app.use('/parse', parseMiddleware.app);
Expand Down
31 changes: 0 additions & 31 deletions src/db/client.js

This file was deleted.

25 changes: 0 additions & 25 deletions src/db/model/application.js

This file was deleted.

18 changes: 0 additions & 18 deletions src/db/model/developer.js

This file was deleted.

12 changes: 0 additions & 12 deletions src/db/model/index.js

This file was deleted.

56 changes: 0 additions & 56 deletions src/db/parse.js

This file was deleted.

7 changes: 0 additions & 7 deletions src/middleware/parseDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ module.exports = () =>
readOnlyMasterKey: PARSE_READONLY_MASTER_KEY,
appName: PARSE_APP_NAME,
},
{
serverURL: `${PUBLIC_URL}/parse-sandbox`,
appId: `${PARSE_APP_ID}-sandbox`,
masterKey: PARSE_MASTER_KEY,
readOnlyMasterKey: PARSE_READONLY_MASTER_KEY,
appName: `${PARSE_APP_NAME}-sandbox`,
},
],
users: [
{
Expand Down
28 changes: 0 additions & 28 deletions src/middleware/parseSandbox.js

This file was deleted.

Loading

0 comments on commit 066ff72

Please sign in to comment.