refactor(build): some random dev build changes

This commit is contained in:
Danny Coates 2019-10-28 13:34:38 -07:00
Родитель cd1494af0c
Коммит 3c3a888a84
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4C442633C62E00CB
38 изменённых файлов: 61 добавлений и 395 удалений

Просмотреть файл

@ -13,10 +13,6 @@ if grep -e "$MODULE" -e 'all' $DIR/../packages/test.list; then
mkdir -p config mkdir -p config
cp $DIR/../packages/version.json config cp $DIR/../packages/version.json config
if [ "${MODULE}" == "fxa-auth-server" ]; then
"$DIR/../_scripts/clone-authdb.sh"
fi
if [ "${MODULE}" == 'fxa-auth-server' ]; then if [ "${MODULE}" == 'fxa-auth-server' ]; then
cd .. cd ..
docker build -f fxa-auth-server/Dockerfile-build -t ${MODULE}:build . docker build -f fxa-auth-server/Dockerfile-build -t ${MODULE}:build .

Просмотреть файл

@ -5,7 +5,10 @@ TEST=$2
DIR=$(dirname "$0") DIR=$(dirname "$0")
if grep -e "$MODULE" -e 'all' $DIR/../packages/test.list; then if grep -e "$MODULE" -e 'all' $DIR/../packages/test.list; then
if [ "${MODULE}" == 'fxa-oauth-server' ]; then if [ "${MODULE}" == 'fxa-auth-server' ]; then
docker build -f Dockerfile-test -t ${MODULE}:test ..
docker run --net="host" ${MODULE}:test npm test
elif [ "${MODULE}" == 'fxa-oauth-server' ]; then
docker build -f Dockerfile-oauth-test -t ${MODULE}:test . docker build -f Dockerfile-oauth-test -t ${MODULE}:test .
docker run --net="host" -e DB="mysql" ${MODULE}:test npm run test-oauth docker run --net="host" -e DB="mysql" ${MODULE}:test npm run test-oauth
elif [[ -e Dockerfile-test ]]; then elif [[ -e Dockerfile-test ]]; then

Просмотреть файл

@ -19,19 +19,20 @@ The Firefox Accounts (fxa) monorepo
```sh ```sh
cd fxa cd fxa
npm install npm install
npm start
``` ```
4. Visit [127.0.0.1:3030](http://127.0.0.1:3030/). 4. Visit [127.0.0.1:3030](http://127.0.0.1:3030/).
Use the [PM2 tool](https://github.com/Unitech/PM2#main-features) to stop and start the servers, and read server logs. Use the [PM2 tool](https://github.com/Unitech/PM2#main-features) to stop and start the servers, and read server logs.
To start all servers with **mysql database** To start all servers:
- `./pm2 start mysql_servers.json` - `npm start`
The most common commands are: The most common commands are:
- `./pm2 kill` **- stop all servers.** - `npm stop` **- stop all servers.**
- `./pm2 status` - display running servers. - `./pm2 status` - display running servers.
@ -45,12 +46,6 @@ The most common commands are:
- More commands in the [PM2 Readme](https://github.com/Unitech/PM2#main-features). - More commands in the [PM2 Readme](https://github.com/Unitech/PM2#main-features).
When you want to [fetch the latest changes](_scripts/update_all.sh) to all servers:
```sh
npm run update
```
--- ---
### Contributing ### Contributing
@ -61,12 +56,12 @@ See the separate [CONTRIBUTING.md](https://github.com/mozilla/fxa/blob/master/CO
> This is an example workflow for **fxa**. > This is an example workflow for **fxa**.
After installing **fxa** the servers should automatically start up. Use `./pm2 status` command to check the status of the servers: After installing **fxa** run `npm start`. Use `./pm2 status` command to check the status of the servers:
![](http://i.imgur.com/eqL8FiZ.png) ![](http://i.imgur.com/eqL8FiZ.png)
To avoid wasting computer resources while not working on FxA make sure to stop the servers using `./pm2 kill`. To avoid wasting computer resources while not working on FxA make sure to stop the servers using `npm stop`.
Once you are back working on FxA just use the `./pm2 start servers.json` command to bring the servers back up. Keep in mind that the memory store will restart and all your database data will be brand new. Once you are back working on FxA just use the `npm start` command to bring the servers back up. Keep in mind that the memory store will restart and all your database data will be brand new.
#### Verifying email and viewing logs #### Verifying email and viewing logs
@ -194,7 +189,7 @@ npm install -g grunt-cli
### Firefox Custom Profile ### Firefox Custom Profile
**Use `npm start` to start Firefox with local server configurations.** **Use `npm run start-firefox` to start Firefox with local server configurations.**
Available options: Available options:
- `FXA_ENV=local` or `latest` or `stable` or `stage` (NOTE: `local` is default). - `FXA_ENV=local` or `latest` or `stable` or `stage` (NOTE: `local` is default).
@ -239,7 +234,7 @@ adb reverse tcp:1111 tcp:1111 # Profile server
adb reverse tcp:5000 tcp:5000 # Sync server adb reverse tcp:5000 tcp:5000 # Sync server
``` ```
Then run `./pm2 start servers.json` and get to work! Then run `npm start` and get to work!
--- ---
@ -251,7 +246,7 @@ The pm2 scripts run the `latest` docker version of the email service by default.
start making changes to the email service then do the following: start making changes to the email service then do the following:
1. Stop the email-service using `./pm2 stop <email_service_id>` 1. Stop the email-service using `./pm2 stop <email_service_id>`
1. Build the service: `cd packages/fxa-email-service; cargo build --bin fxa_email_send; ../../_scripts/clone-authdb.sh` 1. Build the service: `cd packages/fxa-email-service; cargo build --bin fxa_email_send`
1. Run the service: `cd packages/fxa-email-service; ./scripts/run_send.sh` 1. Run the service: `cd packages/fxa-email-service; ./scripts/run_send.sh`
### Firefox for Android ### Firefox for Android
@ -298,7 +293,7 @@ npm install maildev -g
#### Run #### Run
```bash ```bash
./pm2 start servers.json npm start
./pm2 stop 'auth-server local mail helper' ./pm2 stop 'auth-server local mail helper'
``` ```

Просмотреть файл

@ -1,28 +0,0 @@
#!/bin/sh
set -e
SCRIPT_DIR=`dirname "$0"`
DB_PACKAGE=fxa-auth-db-mysql
DB_DIR="$SCRIPT_DIR/../packages/$DB_PACKAGE"
rm -rf "$DB_PACKAGE"
cp -R "$DB_DIR" "$DB_PACKAGE"
cd "$DB_PACKAGE"
npm ci > /dev/null 2>&1
if [ "$1" = "run" ]; then
if [ "$2" = "local" ]; then
DB_SCRIPT="bin/mem"
else
node bin/db_patcher > /dev/null
DB_SCRIPT="bin/server"
fi
node "$DB_SCRIPT" > "../$DB_PACKAGE.log" 2>&1 &
DB_PID=$!
echo "$DB_PID"
sleep 1
fi
cd ..

Просмотреть файл

@ -15,7 +15,7 @@ function on_sigint() {
trap on_sigint INT trap on_sigint INT
docker run --rm --name fxa_email_service \ docker run --rm --name fxa_email_service \
--network fxa-net \ --network host \
-e NODE_ENV=dev \ -e NODE_ENV=dev \
-e FXA_EMAIL_ENV=dev \ -e FXA_EMAIL_ENV=dev \
-e FXA_EMAIL_LOG_LEVEL=debug \ -e FXA_EMAIL_LOG_LEVEL=debug \

Просмотреть файл

@ -1,3 +1,8 @@
#!/bin/sh -ex #!/bin/sh -ex
_scripts/install_packages.sh _scripts/install_packages.sh
if [ "${SKIP_DOCKER}" = "true" ]; then
exit 0
fi
_scripts/install_docker.sh _scripts/install_docker.sh

Просмотреть файл

@ -1,5 +1,4 @@
#!/bin/sh -ex #!/bin/sh -ex
docker network create fxa-net || true
docker pull memcached docker pull memcached

Просмотреть файл

@ -4,34 +4,5 @@ _scripts/check.sh
# Set ulimit, need it for npm # Set ulimit, need it for npm
ulimit -S -n 2048 || echo "Setting ulimit failed" ulimit -S -n 2048 || echo "Setting ulimit failed"
# Install and Setup all the projects npm run npm-ci-all
cd packages
# Install and build fxa-shared first
cd fxa-shared
npm ci
cd ..
PATH=$PATH:$HOME/.cargo/bin
# Now for concurrently!
../node_modules/.bin/concurrently \
"cd fxa-content-server; npm ci; cp server/config/local.json-dist server/config/local.json" \
"cd fxa-auth-server; npm ci; node ./scripts/gen_keys.js; NODE_ENV=dev ./scripts/oauth_gen_keys.js; node ./scripts/gen_vapid_keys.js; node ./fxa-oauth-server/scripts/gen_keys; ../../_scripts/clone-authdb.sh" \
"cd fxa-auth-db-mysql; npm ci" \
"cd browserid-verifier; npm ci" \
"cd fxa-js-client; npm ci; npx grunt sjcl" \
"cd fxa-customs-server; npm ci" \
"cd fxa-event-broker; npm ci" \
"cd fxa-payments-server; npm ci" \
"cd fxa-profile-server; npm ci; mkdir -p var/public/" \
"cd 123done; npm i" \
"cd fortress; npm i" \
"cd fxa-geodb; npm i" \
"cd fxa-email-event-proxy; npm i" \
"cd fxa-support-panel ; npm ci"
cd ..
ln -sf node_modules/.bin/pm2 pm2 ln -sf node_modules/.bin/pm2 pm2

Просмотреть файл

@ -16,7 +16,7 @@ trap on_sigint INT
# Create pushbox db on start (because pushbox doesn't create it) # Create pushbox db on start (because pushbox doesn't create it)
docker run --rm --name=mydb \ docker run --rm --name=mydb \
--network fxa-net \ --network host \
-e MYSQL_ALLOW_EMPTY_PASSWORD=true \ -e MYSQL_ALLOW_EMPTY_PASSWORD=true \
-e MYSQL_ROOT_HOST=% \ -e MYSQL_ROOT_HOST=% \
-e MYSQL_DATABASE=pushbox \ -e MYSQL_DATABASE=pushbox \

Просмотреть файл

@ -1,9 +0,0 @@
#!/bin/bash -ex
. ../../../_scripts/check_mysql.sh
check_mysql
mysqlStarted=$?
if [ "$mysqlStarted" ]; then
node ./bin/server.js
fi

Просмотреть файл

@ -3,11 +3,5 @@
if [ "${CIRCLECI}" = "true" ]; then if [ "${CIRCLECI}" = "true" ]; then
exit 0 exit 0
else else
if [ "${SKIP_DOCKER}" = "true" ]; then
_scripts/install_packages.sh
exit 0
fi
_scripts/install_all.sh _scripts/install_all.sh
pm2 delete mysql_servers.json && pm2 start mysql_servers.json
echo "Use './pm2 kill' to stop all the servers"
fi fi

Просмотреть файл

@ -25,7 +25,7 @@ if [ "$mysqlStarted" ]; then
trap on_singint INT trap on_singint INT
docker run --rm --name pushbox \ docker run --rm --name pushbox \
--network fxa-net \ --network host \
-p 8002:8002 \ -p 8002:8002 \
-e ROCKET_PORT=8002 \ -e ROCKET_PORT=8002 \
-e ROCKET_SERVER_TOKEN=Correct_Horse_Battery_Staple_1 \ -e ROCKET_SERVER_TOKEN=Correct_Horse_Battery_Staple_1 \

Просмотреть файл

@ -15,7 +15,7 @@ function on_singint() {
trap on_singint INT trap on_singint INT
docker run --rm --name pushbox_db \ docker run --rm --name pushbox_db \
--network fxa-net \ --network host \
-p 4306:3306 \ -p 4306:3306 \
-e MYSQL_ROOT_PASSWORD=random \ -e MYSQL_ROOT_PASSWORD=random \
-e MYSQL_DATABASE=pushbox \ -e MYSQL_DATABASE=pushbox \

Просмотреть файл

@ -1,10 +0,0 @@
#!/bin/sh
# Update all projects
git pull
# Migration
docker network create fxa-net || true # Don't error out in case the network already exists
docker pull mozilla/syncserver || echo "syncserver update failed"

Просмотреть файл

@ -22,7 +22,8 @@
}, },
{ {
"name": "auth-server key server PORT 9000", "name": "auth-server key server PORT 9000",
"script": "bin/key_server.js", "script": "npm",
"args": ["start"],
"cwd": "packages/fxa-auth-server", "cwd": "packages/fxa-auth-server",
"env": { "env": {
"DB": "mysql", "DB": "mysql",

Просмотреть файл

@ -83,7 +83,8 @@
}, },
{ {
"name": "auth-server key server PORT 9000", "name": "auth-server key server PORT 9000",
"script": "bin/key_server.js", "script": "npm",
"args": ["start"],
"cwd": "packages/fxa-auth-server", "cwd": "packages/fxa-auth-server",
"env": { "env": {
"DB": "mysql", "DB": "mysql",

95
package-lock.json сгенерированный
Просмотреть файл

@ -2518,91 +2518,6 @@
"source-map": "^0.6.1" "source-map": "^0.6.1"
} }
}, },
"concurrently": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/concurrently/-/concurrently-4.1.1.tgz",
"integrity": "sha512-48+FE5RJ0qc8azwKv4keVQWlni1hZeSjcWr8shBelOBtBHcKj1aJFM9lHRiSc1x7lq416pkvsqfBMhSRja+Lhw==",
"requires": {
"chalk": "^2.4.1",
"date-fns": "^1.23.0",
"lodash": "^4.17.10",
"read-pkg": "^4.0.1",
"rxjs": "^6.3.3",
"spawn-command": "^0.0.2-1",
"supports-color": "^4.5.0",
"tree-kill": "^1.1.0",
"yargs": "^12.0.1"
},
"dependencies": {
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"requires": {
"color-convert": "^1.9.0"
}
},
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"requires": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
},
"dependencies": {
"supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"requires": {
"has-flag": "^3.0.0"
}
}
}
},
"parse-json": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
"integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=",
"requires": {
"error-ex": "^1.3.1",
"json-parse-better-errors": "^1.0.1"
}
},
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY="
},
"read-pkg": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-4.0.1.tgz",
"integrity": "sha1-ljYlN48+HE1IyFhytabsfV0JMjc=",
"requires": {
"normalize-package-data": "^2.3.2",
"parse-json": "^4.0.0",
"pify": "^3.0.0"
}
},
"supports-color": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
"integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=",
"requires": {
"has-flag": "^2.0.0"
},
"dependencies": {
"has-flag": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
"integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE="
}
}
}
}
},
"config-chain": { "config-chain": {
"version": "1.1.12", "version": "1.1.12",
"resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz",
@ -8793,11 +8708,6 @@
"resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz",
"integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=" "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM="
}, },
"spawn-command": {
"version": "0.0.2-1",
"resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz",
"integrity": "sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A="
},
"spdx-correct": { "spdx-correct": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz",
@ -9224,11 +9134,6 @@
"punycode": "^2.1.0" "punycode": "^2.1.0"
} }
}, },
"tree-kill": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.1.tgz",
"integrity": "sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q=="
},
"trim-newlines": { "trim-newlines": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz",

Просмотреть файл

@ -5,8 +5,9 @@
"scripts": { "scripts": {
"authors": "git shortlog -s | cut -c8- | sort -f > AUTHORS", "authors": "git shortlog -s | cut -c8- | sort -f > AUTHORS",
"postinstall": "_scripts/postinstall.sh", "postinstall": "_scripts/postinstall.sh",
"update": "pm2 kill && _scripts/update_all.sh", "npm-ci-all": "lerna exec --no-bail -- npm ci",
"start": "pm2 start mysql_servers.json", "start": "pm2 start mysql_servers.json && echo \"Use 'npm stop' to stop all the servers\"",
"stop": "pm2 kill",
"start-firefox": "fxa-dev-launcher", "start-firefox": "fxa-dev-launcher",
"start-android": "node _scripts/start-android.js", "start-android": "node _scripts/start-android.js",
"test": "lerna run test", "test": "lerna run test",
@ -26,7 +27,6 @@
"dependencies": { "dependencies": {
"adr-log": "^2.1.1", "adr-log": "^2.1.1",
"chalk": "1.1.1", "chalk": "1.1.1",
"concurrently": "^4.1.1",
"diffparser": "^2.0.1", "diffparser": "^2.0.1",
"fxa-dev-launcher": "github:vladikoff/fxa-dev-launcher", "fxa-dev-launcher": "github:vladikoff/fxa-dev-launcher",
"hot-shots": "^6.4.1", "hot-shots": "^6.4.1",

Просмотреть файл

@ -13,5 +13,4 @@ LICENSE
Dockerfile* Dockerfile*
test/load/* test/load/*
test/scripts/test_output/* test/scripts/test_output/*
fxa-auth-db-mysql/* fxa-content-server-l10n/*
fxa-content-server-l10n/*

Просмотреть файл

@ -1,6 +1,7 @@
FROM fxa-auth-server:build FROM fxa-auth-server:build
WORKDIR /app/fxa-auth-db-mysql COPY --chown=app:app ["fxa-auth-db-mysql", "../fxa-auth-db-mysql/"]
WORKDIR /fxa-auth-db-mysql
RUN npm ci RUN npm ci
# install dev dependencies # install dev dependencies

Просмотреть файл

@ -12,16 +12,15 @@
"bump-template-versions": "node scripts/template-version-bump", "bump-template-versions": "node scripts/template-version-bump",
"lint:deps": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-", "lint:deps": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
"postinstall": "scripts/download_l10n.sh", "postinstall": "scripts/download_l10n.sh",
"start": "NODE_ENV=dev scripts/start-local.sh 2>&1", "start": "npm run gen-keys && node ./bin/key_server.js",
"start-oauth": "NODE_ENV=dev node fxa-oauth-server/bin/server.js",
"start-mysql": "NODE_ENV=dev scripts/start-local-mysql.sh 2>&1",
"test": "VERIFIER_VERSION=0 NO_COVERAGE=1 scripts/test-local.sh", "test": "VERIFIER_VERSION=0 NO_COVERAGE=1 scripts/test-local.sh",
"test-oauth": "fxa-oauth-server/scripts/test-local.sh", "test-oauth": "fxa-oauth-server/scripts/test-local.sh",
"test-ci": "scripts/test-local.sh && npm run test-e2e && npm run test-scripts", "test-ci": "npm run gen-keys && scripts/test-local.sh && npm run test-e2e && npm run test-scripts",
"test-e2e": "NODE_ENV=dev mocha test/e2e", "test-e2e": "NODE_ENV=dev mocha test/e2e",
"test-scripts": "NODE_ENV=dev mocha test/scripts --exit", "test-scripts": "NODE_ENV=dev mocha test/scripts --exit",
"test-remote": "MAILER_HOST=restmail.net MAILER_PORT=80 CORS_ORIGIN=http://baz mocha --timeout=300000 test/remote", "test-remote": "MAILER_HOST=restmail.net MAILER_PORT=80 CORS_ORIGIN=http://baz mocha --timeout=300000 test/remote",
"format": "prettier '**' --write" "format": "prettier '**' --write",
"gen-keys": "./scripts/gen_keys.js; ./scripts/oauth_gen_keys.js; ./scripts/gen_vapid_keys.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

Просмотреть файл

@ -1,23 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
node ./scripts/gen_keys.js
NODE_ENV=dev node ./scripts/oauth_gen_keys.js
node ./scripts/gen_vapid_keys.js
node ./test/mail_helper.js &
MH=$!
if [ -e "../../_scripts/clone-authdb.sh" ]; then
DB=`../../_scripts/clone-authdb.sh run`
else
ls fxa-auth-db-mysql/node_modules/mysql-patcher || npm i ./fxa-auth-db-mysql
node fxa-auth-db-mysql/bin/db_patcher
node fxa-auth-db-mysql/bin/server > fxa-auth-db-mysql.log 2>&1 &
DB=$!
fi
node ./bin/key_server.js
kill $MH
kill $DB

Просмотреть файл

@ -1,25 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
node ./scripts/gen_keys.js
NODE_ENV=dev ./scripts/oauth_gen_keys.js
node ./scripts/gen_vapid_keys.js
node ./test/mail_helper.js &
MH=$!
if [ -e "../../_scripts/clone-authdb.sh" ]; then
DB=`../../_scripts/clone-authdb.sh run local`
else
node fxa-auth-db-mysql/bin/mem > fxa-auth-db-mysql.log 2>&1 &
DB=$!
fi
NODE_ENV=dev node ./fxa-oauth-server/bin/server.js &
OA=$!
node ./bin/key_server.js
kill $MH
kill $DB
kill $OA

Просмотреть файл

@ -1,3 +0,0 @@
#!/usr/bin/env bash
node ./bin/key_server.js
exit $PIPESTATUS[0]

Просмотреть файл

@ -13,10 +13,6 @@ DEFAULT_ARGS="-R dot --recursive --timeout 5000 --exit"
./scripts/gen_vapid_keys.js ./scripts/gen_vapid_keys.js
node ./scripts/oauth_gen_keys.js node ./scripts/oauth_gen_keys.js
if [ ! -e fxa-auth-db-mysql ] && [ -e "../../_scripts/clone-authdb.sh" ]; then
../../_scripts/clone-authdb.sh
fi
GLOB=$* GLOB=$*
if [ -z "$GLOB" ]; then if [ -z "$GLOB" ]; then
echo "Local tests" echo "Local tests"

Просмотреть файл

@ -7,7 +7,7 @@
const { assert } = require('chai'); const { assert } = require('chai');
const TestServer = require('../test_server'); const TestServer = require('../test_server');
const Client = require('../client')(); const Client = require('../client')();
const createDBServer = require('../../fxa-auth-db-mysql'); const createDBServer = require('../../../fxa-auth-db-mysql');
const log = { trace() {}, info() {} }; const log = { trace() {}, info() {} };
const config = require('../../config').getProperties(); const config = require('../../config').getProperties();

Просмотреть файл

@ -4,7 +4,7 @@
'use strict'; 'use strict';
const createDBServer = require('../fxa-auth-db-mysql'); const createDBServer = require('../../fxa-auth-db-mysql');
function TestServer(config) { function TestServer(config) {
this.config = config; this.config = config;

Просмотреть файл

@ -8,7 +8,7 @@ const crypto = require('crypto');
const EventEmitter = require('events'); const EventEmitter = require('events');
const P = require('../lib/promise'); const P = require('../lib/promise');
const mailbox = require('./mailbox'); const mailbox = require('./mailbox');
const createDBServer = require('../fxa-auth-db-mysql'); const createDBServer = require('../../fxa-auth-db-mysql');
const createAuthServer = require('../bin/key_server'); const createAuthServer = require('../bin/key_server');
const createMailHelper = require('./mail_helper'); const createMailHelper = require('./mail_helper');
const createProfileHelper = require('./profile_helper'); const createProfileHelper = require('./profile_helper');

Просмотреть файл

@ -4,11 +4,10 @@
"description": "Firefox Accounts Content Server", "description": "Firefox Accounts Content Server",
"scripts": { "scripts": {
"build-production": "NODE_ENV=production grunt build", "build-production": "NODE_ENV=production grunt build",
"postinstall": "scripts/download_l10n.sh", "postinstall": "cp server/config/local.json-dist server/config/local.json && scripts/download_l10n.sh",
"lint": "eslint app server tests --cache", "lint": "eslint app server tests --cache",
"lint:deps": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-", "lint:deps": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
"start": "node scripts/check-local-config && grunt server", "start": "node scripts/check-local-config && grunt server",
"start-circle": "CONFIG_FILES=server/config/local.json,server/config/production.json,tests/ci/config_circleci.json node_modules/.bin/grunt build && CONFIG_FILES=server/config/local.json,server/config/production.json,tests/ci/config_circleci.json node_modules/.bin/grunt serverproc:dist",
"start-production": "NODE_ENV=production grunt build && CONFIG_FILES=server/config/local.json,server/config/production.json grunt serverproc:dist", "start-production": "NODE_ENV=production grunt build && CONFIG_FILES=server/config/local.json,server/config/production.json grunt serverproc:dist",
"start-remote": "scripts/run_remote_dev.sh", "start-remote": "scripts/run_remote_dev.sh",
"test": "node tests/intern.js --unit=true", "test": "node tests/intern.js --unit=true",

Просмотреть файл

@ -1,16 +0,0 @@
{
"csp": {
"enabled": false
},
"public_url": "http://127.0.0.1:3030",
"fxaccount_url": "https://fxaci.dev.lcip.org/auth",
"oauth_client_id": "98e6508e88680e1a",
"oauth_url": "https://oauth-fxaci.dev.lcip.org",
"profile_url": "https://fxaci.dev.lcip.org/profile",
"profile_images_url": "https://fxaci.dev.lcip.org/profile",
"allowed_parent_origins": ["https://123done-fxaci.dev.lcip.org"],
"use_https": false,
"i18n": {
"supportedLanguages": ["en"]
}
}

Просмотреть файл

@ -1,9 +0,0 @@
{
"logging": {
"loggers": {
"bid": {
"level": "ERROR"
}
}
}
}

Просмотреть файл

@ -1,50 +0,0 @@
#!/bin/bash -ex
# Create a separate store for deps to avoid dependency issues with the content server
mkdir -p deps/node_modules
cd deps
# Auth
if [ -d fxa-auth-server ]
then
# node_modules is cached and we can't clone into a non-empty directory
cd fxa-auth-server
git init
git remote add origin https://github.com/mozilla/fxa-auth-server.git
git fetch origin master
git checkout -f -b master origin/master
else
git clone https://github.com/mozilla/fxa-auth-server.git --depth=1
cd fxa-auth-server
fi
# Install devDeps for the Auth Server to get memory db
npm i &> /dev/null
LOG_LEVEL=error node ./node_modules/fxa-auth-db-mysql/bin/mem.js &
node ./scripts/gen_keys.js
SIGNIN_UNBLOCK_ALLOWED_EMAILS="^block.*@restmail\\.net$" SIGNIN_UNBLOCK_FORCED_EMAILS="^block.*@restmail\\.net$" npm start &> /dev/null &
# OAuth
cd fxa-oauth-server
npm i > /dev/null
LOG_LEVEL=error NODE_ENV=dev node ./bin/server.js &
cd ../..
# Profile
npm i mozilla/fxa-profile-server &> /dev/null
cd node_modules/fxa-profile-server
npm i
LOG_LEVEL=error NODE_ENV=dev npm start &
cd ../..
# Verifier
npm i vladikoff/browserid-verifier#http &> /dev/null
cd node_modules/browserid-verifier
npm i vladikoff/browserid-local-verify#http &> /dev/null
PORT=5050 CONFIG_FILES=../../../tests/ci/config_verifier.json node server.js &
cd ../..
# Leave "deps"
cd ..

Просмотреть файл

@ -1,18 +0,0 @@
#!/bin/sh
# This script sets up a default password for VNC
# If you do not run this then the first time VNC
# starts it will ask you to set a password.
prog=/usr/bin/vnc4passwd
mypass="newpass"
/usr/bin/expect <<EOF
spawn "$prog"
expect "Password:"
send "$mypass\r"
expect "Verify:"
send "$mypass\r"
expect eof
exit
EOF

Просмотреть файл

@ -1,7 +1,5 @@
FROM node:10-alpine FROM node:10-alpine
RUN npm install -g npm@6 && rm -rf ~app/.npm /tmp/*
RUN apk add --no-cache make git gcc g++ python RUN apk add --no-cache make git gcc g++ python
RUN addgroup -g 10001 app && \ RUN addgroup -g 10001 app && \
@ -10,9 +8,9 @@ WORKDIR /app
USER app USER app
COPY package-lock.json package-lock.json COPY --chown=app:app package-lock.json package-lock.json
COPY package.json package.json COPY --chown=app:app package.json package.json
RUN npm ci --production && rm -rf ~app/.npm /tmp/* RUN npm ci --production && rm -rf ~app/.npm /tmp/*
COPY . /app COPY --chown=app:app . /app

Просмотреть файл

@ -2,13 +2,12 @@
set -e set -e
if [ -e "../../_scripts/clone-authdb.sh" ]; then cd ../fxa-auth-db-mysql
DB_PID=`../../_scripts/clone-authdb.sh run` npm ci
else node ./bin/db_patcher
node fxa-auth-db-mysql/bin/db_patcher node ./bin/server > fxa-auth-db-mysql.log 2>&1 &
node fxa-auth-db-mysql/bin/server > fxa-auth-db-mysql.log 2>&1 & DB_PID="$!"
DB_PID="$!" cd ../fxa-email-service
fi
if [ -z "$FXA_EMAIL_LOG_LEVEL" ]; then if [ -z "$FXA_EMAIL_LOG_LEVEL" ]; then
export FXA_EMAIL_LOG_LEVEL=off export FXA_EMAIL_LOG_LEVEL=off

Просмотреть файл

@ -6,11 +6,11 @@
"license": "MPL-2.0", "license": "MPL-2.0",
"scripts": { "scripts": {
"start": "grunt", "start": "grunt",
"postinstall": "grunt sjcl",
"lint": "npm-run-all --parallel lint:*", "lint": "npm-run-all --parallel lint:*",
"lint:deps": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-", "lint:deps": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
"test": "npm run lint && mocha tests/lib --reporter dot --timeout 5000", "test": "npm run lint && mocha tests/lib --reporter dot --timeout 5000",
"test-local": "AUTH_SERVER_URL=http://127.0.0.1:9000 npm test", "test-local": "AUTH_SERVER_URL=http://127.0.0.1:9000 npm test",
"setup": "npm install && grunt sjcl",
"contributors": "git shortlog -s | cut -c8- | sort -f > CONTRIBUTORS.md", "contributors": "git shortlog -s | cut -c8- | sort -f > CONTRIBUTORS.md",
"format": "prettier '**' --write" "format": "prettier '**' --write"
}, },

Просмотреть файл

@ -4,20 +4,20 @@ RUN groupadd --gid 10001 app && \
RUN mkdir /fxa-content-server && chown -R app:app /fxa-content-server RUN mkdir /fxa-content-server && chown -R app:app /fxa-content-server
USER app USER app
WORKDIR /app WORKDIR /app
COPY ["fxa-payments-server/package*.json", "./"] COPY --chown=app:app ["fxa-payments-server/package*.json", "./"]
RUN npm ci RUN npm ci
COPY ["fxa-payments-server/.storybook", ".storybook/"] COPY --chown=app:app ["fxa-payments-server/.storybook", ".storybook/"]
COPY ["fxa-payments-server/public", "public/"] COPY --chown=app:app ["fxa-payments-server/public", "public/"]
COPY ["fxa-payments-server/src", "src/"] COPY --chown=app:app ["fxa-payments-server/src", "src/"]
COPY --chown=app:app ["fxa-content-server", "../fxa-content-server/"]
USER app
COPY ["fxa-content-server", "../fxa-content-server/"]
WORKDIR /fxa-content-server WORKDIR /fxa-content-server
RUN npm ci RUN npm ci
WORKDIR /app WORKDIR /app
ENV PUBLIC_URL / ENV PUBLIC_URL /
ENV INLINE_RUNTIME_CHUNK false ENV INLINE_RUNTIME_CHUNK false
RUN npm run build RUN npm run build
FROM node:12-stretch-slim FROM node:12-stretch-slim
RUN groupadd --gid 10001 app && \ RUN groupadd --gid 10001 app && \
useradd --uid 10001 --gid 10001 --home /app --create-home app useradd --uid 10001 --gid 10001 --home /app --create-home app
@ -29,8 +29,6 @@ COPY --chown=app:app [ "fxa-payments-server/", "./" ]
COPY --chown=app:app ["fxa-geodb", "../fxa-geodb/"] COPY --chown=app:app ["fxa-geodb", "../fxa-geodb/"]
WORKDIR /fxa-geodb WORKDIR /fxa-geodb
USER root
RUN chown -R app:app /fxa-geodb
USER app USER app
RUN npm ci RUN npm ci
@ -58,8 +56,6 @@ COPY --chown=app:app ["fxa-shared/tsconfig.json", "../fxa-shared/tsconfig.json"]
COPY --chown=app:app ["fxa-shared/.nsprc", "../fxa-shared/.nsprc"] COPY --chown=app:app ["fxa-shared/.nsprc", "../fxa-shared/.nsprc"]
RUN mkdir /fxa-shared/node_modules RUN mkdir /fxa-shared/node_modules
WORKDIR /fxa-shared WORKDIR /fxa-shared
USER root
RUN chown -R app:app /fxa-shared
USER app USER app
RUN npm ci RUN npm ci

Просмотреть файл

@ -7,7 +7,7 @@
"lint": "npm-run-all --parallel lint:*", "lint": "npm-run-all --parallel lint:*",
"lint:deps": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-", "lint:deps": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
"outdated": "npm outdated --depth 0 || exit 0", "outdated": "npm outdated --depth 0 || exit 0",
"preinstall": "./scripts/check_gm.sh", "preinstall": "./scripts/check_gm.sh && mkdir -p var/public/",
"start": "scripts/run_dev.js", "start": "scripts/run_dev.js",
"test": "scripts/test-local.sh", "test": "scripts/test-local.sh",
"format": "prettier '**' --write" "format": "prettier '**' --write"