refactor(npm-scripts): refactored npm scripts for better ergonomics

1. renamed _scripts/*.sh to use kebab-case
2. linted _scripts with shellcheck
3. added _dev directory and moved pm2 json files there
4. added nps and package-scripts.js
  - this allows us to do nice things like: `npm start debug firefox`
  - I'd like to expand this further but it's a start
5. refactored the install scripts to make `npm install` nicer
6. renamed pm2 process names for easier control
  - can use `pm2 logs auth` instead of the id
This commit is contained in:
Danny Coates 2020-04-10 11:33:30 -07:00
Родитель 35af352758
Коммит a4b3996349
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4C442633C62E00CB
42 изменённых файлов: 1436 добавлений и 637 удалений

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

@ -23,7 +23,6 @@ jobs:
type: string
environment:
SKIP_PACKAGES: true
SKIP_DOCKER: true
steps:
- base-install:
package: << parameters.package >>
@ -41,7 +40,6 @@ jobs:
- image: redis
environment:
SKIP_PACKAGES: true
SKIP_DOCKER: true
steps:
- base-install
- run:
@ -87,7 +85,6 @@ jobs:
RUST_BACKTRACE: 1
environment:
SKIP_PACKAGES: false
SKIP_DOCKER: true
steps:
- base-install:
package: fxa-content-server
@ -111,7 +108,6 @@ jobs:
- image: redis
environment:
SKIP_PACKAGES: true
SKIP_DOCKER: true
steps:
- base-install:
package: fxa-email-service
@ -125,7 +121,6 @@ jobs:
- image: circleci/node:12
environment:
SKIP_PACKAGES: true
SKIP_DOCKER: true
steps:
- base-install:
package: fxa-circleci
@ -138,7 +133,6 @@ jobs:
- image: circleci/node:12
environment:
SKIP_PACKAGES: true
SKIP_DOCKER: true
steps:
- base-install
- setup_remote_docker

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

@ -12,7 +12,7 @@
},
{
"name": "auth-server db mysql PORT 8000",
"script": "../../_scripts/start_after_mysql.sh",
"script": "../../_scripts/start-after-mysql.sh",
"cwd": "packages/fxa-auth-db-mysql",
"env": {
"NODE_ENV": "dev"
@ -22,7 +22,7 @@
},
{
"name": "auth-server key server PORT 9000",
"script": "../../_scripts/start_after_mysql.sh",
"script": "../../_scripts/start-after-mysql.sh",
"cwd": "packages/fxa-auth-server",
"env": {
"DB": "mysql",
@ -48,7 +48,7 @@
},
{
"name": "profile-server PORT 1111",
"script": "../../_scripts/start_after_mysql.sh",
"script": "../../_scripts/start-after-mysql.sh",
"cwd": "packages/fxa-profile-server",
"max_restarts": "1",
"env": {
@ -96,7 +96,7 @@
},
{
"name": "event-broker",
"script": "../../_scripts/start_after_mysql.sh",
"script": "../../_scripts/start-after-mysql.sh",
"cwd": "packages/fxa-event-broker",
"max_restarts": "1",
"env": {

32
.vscode/launch.json поставляемый
Просмотреть файл

@ -5,12 +5,36 @@
"version": "0.2.0",
"configurations": [
{
"name": "Attach by Process ID",
"processId": "${command:PickProcess}",
"name": "Attach to auth",
"type": "node",
"request": "attach",
"skipFiles": ["<node_internals>/**"],
"type": "pwa-node",
"restart": true
"cwd": "${workspaceFolder}",
"port": 9160
},
{
"name": "Attach to content",
"type": "node",
"request": "attach",
"skipFiles": ["<node_internals>/**"],
"cwd": "${workspaceFolder}",
"port": 9229
},
{
"name": "Attach to broker",
"type": "node",
"request": "attach",
"skipFiles": ["<node_internals>/**"],
"cwd": "${workspaceFolder}",
"port": 9180
},
{
"name": "Attach to payments",
"type": "node",
"request": "attach",
"skipFiles": ["<node_internals>/**"],
"cwd": "${workspaceFolder}",
"port": 9170
}
]
}

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

@ -59,11 +59,11 @@ The most common commands are:
- `./pm2 logs` - logs for all servers (note: this must be used to verify accounts).
- `./pm2 logs 1` - display logs for process `1`.
- `./pm2 logs auth` - display logs for service `auth`.
- `./pm2 stop 1` - stop process `1`.
- `./pm2 stop content` - stop `content` service.
- `./pm2 restart 1` - restart process `1`.
- `./pm2 restart mysql` - restart `mysql` process.
- More commands in the [PM2 Readme](https://github.com/Unitech/PM2#main-features).
@ -88,7 +88,7 @@ Once you are back working on FxA just use the `npm start` command to bring the s
Use the `./pm2 logs` command to get the logs of all servers. You may also use `./pm2 logs [id]` to just see the logs for that particular server.
When you signup for an account using the form on `127.0.0.1:3030/signup` the "auth-server local mail helper" logs will print out the verification code that you need to copy paste into your browser to verify your account locally:
When you signup for an account using the form on `127.0.0.1:3030/signup` the "inbox" logs will print out the verification code that you need to copy paste into your browser to verify your account locally:
![](https://i.imgur.com/cdh9Xrl.png)
@ -111,7 +111,6 @@ If you get an `error` status for any of the servers please verify that you insta
> [libgmp](https://gmplib.org/),
> [graphicsmagick](http://www.graphicsmagick.org/),
> [docker](https://docs.docker.com/),
> [grunt](https://github.com/gruntjs/grunt-cli),
> [gcloud CLI](https://cloud.google.com/sdk/)
##### OS X (with [Brew](http://brew.sh/)):
@ -196,16 +195,6 @@ Once the installer begins:
4. Type "y" for "Modify PATH variable?"
5. Select "1) Proceed with installation"
#### Installing grunt
```
npm install -g grunt-cli
```
---
---
---
### Secrets
@ -221,7 +210,7 @@ Check out the Secrets section in the following READMEs:
### Firefox Custom Profile
**Use `npm run start-firefox` to start Firefox with local server configurations.**
**Use `npm start firefox` to start Firefox with local server configurations.**
Available options:
- `FXA_ENV=local` or `latest` or `stable` or `stage` (NOTE: `local` is default).
@ -236,33 +225,23 @@ Available options:
**The following requires [the JDK](http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html#javasejdk) and tests the local servers only.**
## run the following commands from the fxa-content-server directory
To run all functional tests:
```
npm test
npm run test-functional
```
Note that as of 2019-07-08, running this command at the project root will fail ([see issue #725](https://github.com/mozilla/fxa/issues/725)). Instead, run the command in the server that needs to be tested.
To run a specific test or tests whose name matches part of a search string:
```
node tests/intern.js --suites=all --grep="Test string to search for"
npm run test-functional -- --grep="Test name"
```
To run a single test:
--where 'Test name' is not the file name but the description/name of the test(s).
```
npm run test-functional -- "--grep=Test name"
```
--where 'Test name' is not the file name but the description/name of the test.
```
node tests/intern.js --grep="Test name"
```
## run the above command from the fxa-content-server directory
---
### Node debugging
@ -285,16 +264,15 @@ In the case of Firefox Accounts, the `pm2` process manager complicates setup a b
- Using Google Chrome, go to `chrome://inspect`, then click the process to connect to devtools.
- VSCode requires setting up a `.vscode/launch.json` file; see the [VSCode docs](https://code.visualstudio.com/docs/nodejs/nodejs-debugging) for details.
Alternatively if you want to be able to debug any of several servers that is configured with a `start-dev-debug` script you can start `pm2` using the `debug_servers.json` file:
Alternatively if you want to be able to debug any of several servers that is configured with a `start-dev-debug` script you can run this from the base fxa directory:
```bash
pm2 kill
pm2 start debug_servers.json
npm start debug
```
##### Default Debug Ports
If you're using `npm run start-dev-debug` or `pm2` with the `debug_server.json`, the following ports are used for `--inspect`:
If you're using `npm start debug`, the following ports are used for `--inspect`:
| Port | Service |
| ---- | --------------- |
@ -393,7 +371,7 @@ npm install maildev -g
```bash
npm start
./pm2 stop 'auth-server local mail helper'
./pm2 stop inbox
```
Once services have started, you can start MailDev on port 9999. You might have to start MailDev with sudo permissions.
@ -406,10 +384,6 @@ All emails sent can be viewed from [http://localhost:1080](http://localhost:1080
---
### Other tasks
- [Updating dependencies and `npm-shrinkwrap.json` files](https://mozilla.github.io/application-services/docs/accounts/local-development.html#updating-npm-shrinkwrap).
### Documentation
The [Firefox Ecosystem Platform](https://mozilla.github.io/ecosystem-platform/) serves as a documentation hub for Firefox Accounts, Services, Synced Client Integrations, and Subscription Platform.

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

3
_dev/README.md Normal file
Просмотреть файл

@ -0,0 +1,3 @@
# \_dev
This directory contains files to support local development that aren't needed in production, especially things that would otherwise clutter up the root directory.

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

@ -0,0 +1,66 @@
{
"apps": [
{
"name": "mysql",
"script": "_scripts/mysql.sh",
"max_restarts": "1",
"min_uptime": "2m",
"kill_timeout": 20000
},
{
"name": "redis",
"script": "_scripts/redis.sh",
"env": {
"PORT": "6379"
},
"max_restarts": "1",
"min_uptime": "2m",
"kill_timeout": 20000
},
{
"name": "memcache",
"script": "_scripts/memcached.sh",
"max_restarts": "1",
"min_uptime": "2m",
"kill_timeout": 20000
},
{
"name": "sns",
"script": "_scripts/goaws.sh",
"max_restarts": "1",
"min_uptime": "2m",
"autorestart": false,
"kill_timeout": 20000
},
{
"name": "pubsub",
"script": "_scripts/pubsub.sh",
"max_restarts": "1",
"min_uptime": "2m",
"kill_timeout": 20000
},
{
"name": "firestore",
"script": "_scripts/firestore.sh",
"max_restarts": "1",
"min_uptime": "2m",
"kill_timeout": 20000
},
{
"name": "sync",
"script": "_scripts/syncserver.sh",
"max_restarts": "1",
"min_uptime": "2m",
"autorestart": false,
"kill_timeout": 20000
},
{
"name": "pushbox",
"script": "_scripts/pushbox.sh",
"max_restarts": "1",
"min_uptime": "2m",
"args": "3306 root@mydb:3306",
"kill_timeout": 20000
}
]
}

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

@ -1,68 +1,14 @@
{
"apps": [
{
"name": "MySQL server PORT 3306",
"script": "_scripts/mysql.sh",
"name": "email",
"script": "_scripts/fxa-email-service.sh",
"max_restarts": "1",
"min_uptime": "2m",
"kill_timeout": 20000
},
{
"name": "redis PORT 6379",
"script": "_scripts/redis.sh",
"env": {
"PORT": "6379"
},
"max_restarts": "1",
"min_uptime": "2m",
"kill_timeout": 20000
},
{
"name": "memcached PORT 11211",
"script": "_scripts/memcached.sh",
"max_restarts": "1",
"min_uptime": "2m",
"kill_timeout": 20000
},
{
"name": "Fake SQS/SNS PORT 4100",
"script": "_scripts/goaws.sh",
"max_restarts": "1",
"min_uptime": "2m",
"autorestart": false,
"kill_timeout": 20000
},
{
"name": "google-pubsub-emulator PORT 8085",
"script": "_scripts/pubsub.sh",
"max_restarts": "1",
"min_uptime": "2m",
"kill_timeout": 20000
},
{
"name": "google-firestore-emulator PORT 9090",
"script": "_scripts/firestore.sh",
"max_restarts": "1",
"min_uptime": "2m",
"kill_timeout": 20000
},
{
"name": "sync server PORT 5000",
"script": "_scripts/syncserver.sh",
"max_restarts": "1",
"min_uptime": "2m",
"autorestart": false,
"kill_timeout": 20000
},
{
"name": "email-service PORT 8001",
"script": "_scripts/fxa_email_service.sh",
"max_restarts": "1",
"min_uptime": "2m",
"kill_timeout": 20000
},
{
"name": "auth-server local mail helper",
"name": "inbox",
"script": "test/mail_helper.js",
"cwd": "packages/fxa-auth-server",
"env": {
@ -72,8 +18,8 @@
"min_uptime": "2m"
},
{
"name": "auth-server db mysql PORT 8000",
"script": "../../_scripts/start_after_mysql.sh",
"name": "auth-db",
"script": "../../_scripts/start-after-mysql.sh",
"cwd": "packages/fxa-auth-db-mysql",
"env": {
"NODE_ENV": "dev"
@ -82,8 +28,8 @@
"min_uptime": "2m"
},
{
"name": "auth-server key server PORT 9000",
"script": "../../_scripts/start_after_mysql_debug.sh",
"name": "auth",
"script": "../../_scripts/start-after-mysql-debug.sh",
"cwd": "packages/fxa-auth-server",
"env": {
"DB": "mysql",
@ -98,7 +44,7 @@
"min_uptime": "2m"
},
{
"name": "content-server PORT 3030",
"name": "content",
"script": "npm",
"args": ["run", "start-dev-debug"],
"cwd": "packages/fxa-content-server",
@ -109,8 +55,8 @@
"min_uptime": "2m"
},
{
"name": "profile-server PORT 1111",
"script": "../../_scripts/start_after_mysql.sh",
"name": "profile",
"script": "../../_scripts/start-after-mysql.sh",
"cwd": "packages/fxa-profile-server",
"max_restarts": "1",
"env": {
@ -121,7 +67,7 @@
"min_uptime": "2m"
},
{
"name": "Fortress PORT 9292",
"name": "fortress",
"script": "server.js",
"cwd": "packages/fortress",
"max_restarts": "1",
@ -132,7 +78,7 @@
"min_uptime": "2m"
},
{
"name": "123done PORT 8080",
"name": "123done",
"script": "server.js",
"cwd": "packages/123done",
"max_restarts": "1",
@ -143,7 +89,7 @@
"min_uptime": "2m"
},
{
"name": "321done UNTRUSTED PORT 10139",
"name": "321done",
"script": "server.js",
"cwd": "packages/123done",
"max_restarts": "1",
@ -154,7 +100,7 @@
"min_uptime": "2m"
},
{
"name": "browserid-verifier PORT 5050",
"name": "browserid",
"script": "server.js",
"cwd": "packages/browserid-verifier",
"env": {
@ -166,7 +112,7 @@
"min_uptime": "2m"
},
{
"name": "payments server PORT 3031",
"name": "payments",
"cwd": "packages/fxa-payments-server",
"script": "npm",
"args": ["run", "start-dev-debug"],
@ -179,7 +125,7 @@
}
},
{
"name": "support admin panel PORT 7100",
"name": "support",
"cwd": "packages/fxa-support-panel",
"script": "npm",
"args": ["run", "start-dev"],
@ -192,7 +138,7 @@
},
{
"name": "event-broker",
"script": "../../_scripts/start_after_mysql_debug.sh",
"script": "../../_scripts/start-after-mysql-debug.sh",
"cwd": "packages/fxa-event-broker",
"max_restarts": "1",
"env": {
@ -200,14 +146,6 @@
"WORKER_HOST": "0.0.0.0"
},
"min_uptime": "2m"
},
{
"name": "pushbox PORT 8002",
"script": "_scripts/pushbox.sh",
"max_restarts": "1",
"min_uptime": "2m",
"args": "3306 root@mydb:3306",
"kill_timeout": 20000
}
]
}

15
_scripts/check-mysql.sh Executable file
Просмотреть файл

@ -0,0 +1,15 @@
#!/bin/bash -e
PORT=${1:-3306}
RETRY=60
for i in $(eval echo "{1..$RETRY}"); do
if echo PING | nc localhost "$PORT" | grep -q 'mysql'; then
exit 0
else
if [ "$i" -lt $RETRY ]; then
sleep 1
fi
fi
done
exit 1

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

@ -24,9 +24,9 @@ PORTS=(
occupied=()
for port in ${PORTS[@]}; do
if echo PING | nc localhost $port >/dev/null; then
occupied=("${occupied[@]}" $port)
for port in "${PORTS[@]}"; do
if echo PING | nc localhost "$port" >/dev/null; then
occupied=("${occupied[@]}" "$port")
fi
done

14
_scripts/check-url.sh Executable file
Просмотреть файл

@ -0,0 +1,14 @@
#!/bin/bash -e
RETRY=30
for i in $(eval echo "{1..$RETRY}"); do
if [ "$(curl -s -o /dev/null --silent -w "%{http_code}" http://$1)" == "${2:-200}" ]; then
exit 0
else
if [ "$i" -lt $RETRY ]; then
sleep 1
fi
fi
done
exit 1

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

@ -1,55 +0,0 @@
#!/usr/bin/env bash
set -ex
node_version="$(node -v | cut -f 1 -d '.' | cut -f 2 -d 'v')"
if [ "$node_version" -ne "12" ]; then
echo "install node 12 to continue installation"
echo "http://nodejs.org/"
exit 1
fi
if [[ ! $(which rustup) ]]; then
curl https://sh.rustup.rs -sSf | sh -s -- -y
export PATH=$PATH:$HOME/.cargo/bin/
fi
if [[ $(which docker) && $(docker --version) ]]; then
docker=y
else
docker=n
fi
os="$(uname -a | cut -f 1 -d ' ')"
if [ "$os" = "Darwin" ]; then
if [ "$docker" = "n" ]; then
echo "install docker to continue installation"
echo "https://docs.docker.com/docker-for-mac/install/"
exit 1
fi
if [[ $(which brew) && $(brew --version) ]]; then
if [[ $(brew ls --versions gmp) ]]; then
echo "gmp is installed"
else
brew install gmp
fi
if [[ $(brew ls --versions graphicsmagick) ]]; then
echo "graphicsmagick is installed"
else
brew install graphicsmagick
fi
else
echo "install homebrew to continue installation"
echo "https://brew.sh/"
exit 1
fi
elif [ "$os" = "Linux" ]; then
if [ "$docker" = "n" ]; then
echo "install docker to continue installation using the steps below:"
echo "sudo apt-get install docker.io"
echo "sudo groupadd docker"
echo "sudo gpasswd -a $USER docker"
echo "sudo service docker restart"
fi
fi

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

@ -1,17 +0,0 @@
#!/bin/bash -ex
function check_mysql() {
PORT=${1:-3306}
RETRY=120
for i in $(eval echo "{1..$RETRY}"); do
if echo PING | nc localhost $PORT | grep -q 'mysql'; then
return 0
else
if [ $i -lt $RETRY ]; then
sleep 1
fi
fi
done
return 1
}

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

@ -19,4 +19,4 @@ docker run --rm --name=firestore \
-p 9090:9090 \
jdlk7/firestore-emulator &
while :; do read; done
while :; do read -r; done

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

@ -1,4 +1,4 @@
#!/bin/sh -ex
#!/bin/bash -ex
# This docker image doesn't react to SIGINTs (Ctrl+C) which is used by
# pm2 to kill processes.
@ -21,4 +21,4 @@ docker run --rm --name fxa_email_service \
-e RUST_BACKTRACE=1 \
-p 8001:8001 mozilla/fxa-email-service &
while :; do read; done
while :; do read -r; done

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

@ -1,10 +1,8 @@
#!/bin/sh
set -e
#!/bin/bash -e
echo "Branch: $CIRCLE_BRANCH Pull request: $CIRCLE_PULL_REQUEST"
if [ "$CIRCLE_BRANCH" != "master" -o "$CIRCLE_PULL_REQUEST" != "" ]; then
if [ "$CIRCLE_BRANCH" != "master" ] || [ "$CIRCLE_PULL_REQUEST" != "" ]; then
echo "Not building docs."
exit 0
fi
@ -26,11 +24,11 @@ npm run build-storybook
cd ../..
git clone --branch gh-pages git@github.com:mozilla/fxa.git docs-build
cd docs-build
rm -rf *
rm -rf ./*
mv ../packages/fxa-email-service/target/doc fxa-email-service
mv ../packages/fxa-payments-server/storybook-static fxa-payments-server
CHANGES=`git status --porcelain`
CHANGES=$(git status --porcelain)
if [ "$CHANGES" = "" ]; then
echo "Docs are unchanged, not deploying to GitHub Pages."

15
_scripts/install-all.sh Executable file
Просмотреть файл

@ -0,0 +1,15 @@
#!/bin/bash -e
if [ "${SKIP_PACKAGES}" != "true" ]; then
# Set ulimit, need it for npm
ulimit -S -n 2048 || echo "Setting ulimit failed"
if [ "${CI}" = "true" ]; then
# it seems the filesystem on circleci can't handle full concurrency
npx lerna exec --concurrency 6 --ignore fxa-amplitude-send -- npm ci
else
npx lerna bootstrap
fi
ln -sf node_modules/.bin/pm2 pm2
fi

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

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

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

@ -1,17 +0,0 @@
#!/bin/sh -ex
docker pull memcached
docker pull mozilla/syncserver
docker pull mozilla/pushbox
docker pull pafortin/goaws
docker pull redis
docker pull mysql/mysql-server:5.6
docker pull jdlk7/firestore-emulator
docker pull knarz/pubsub-emulator

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

@ -1,14 +0,0 @@
#!/bin/sh -ex
_scripts/check.sh
# Set ulimit, need it for npm
ulimit -S -n 2048 || echo "Setting ulimit failed"
if [ "${CI}" = "true" ]; then
# it seems the filesystem on circleci can't handle full concurrency
npx lerna exec --concurrency 6 --ignore fxa-amplitude-send -- npm ci
else
npx lerna bootstrap --ignore fxa-amplitude-send
fi
ln -sf node_modules/.bin/pm2 pm2

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

@ -1 +1,3 @@
#!/bin/bash -ex
docker run --rm -p 11211:11211 --name memcache memcached

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

@ -22,4 +22,4 @@ docker run --rm --name=mydb \
-p 3306:3306 \
mysql/mysql-server:5.6 &
while :; do read; done
while :; do read -r; done

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

@ -19,4 +19,4 @@ docker run --rm --name=pubsub \
-p 8085:8085 \
knarz/pubsub-emulator:latest &
while :; do read; done
while :; do read -r; done

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

@ -1,4 +1,4 @@
#!/bin/sh -ex
#!/bin/bash -ex
# This docker image doesn't react to SIGINTs (Ctrl+C) which is used by
# pm2 to kill processes.
@ -22,4 +22,4 @@ docker run --rm --name pushbox_db \
-e MYSQL_PASSWORD=test \
mysql/mysql-server:5.6 &
while :; do read; done
while :; do read -r; done

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

@ -1,6 +1,4 @@
#!/bin/sh -ex
sleep 3 # Give 3 secs to the mysql server to start
. _scripts/check_mysql.sh
#!/bin/bash -ex
# This docker image doesn't react to SIGINTs (Ctrl+C) which is used by
# pm2 to kill processes.
@ -17,19 +15,15 @@ function on_singint() {
MYSQL_HOST_PORT=${1:-4306}
MYSQL_URI=${2:-test:test@pushbox_db:3306} #3306 because -p is only for the host.
check_mysql $MYSQL_HOST_PORT
mysqlStarted=$?
"${0%/*}/check-mysql.sh" "$MYSQL_HOST_PORT"
if [ "$mysqlStarted" ]; then
trap on_singint INT
trap on_singint INT
docker run --rm --name pushbox \
-p 8002:8002 \
-e ROCKET_PORT=8002 \
-e ROCKET_SERVER_TOKEN=Correct_Horse_Battery_Staple_1 \
-e ROCKET_DATABASE_URL=mysql://"$MYSQL_URI"/pushbox \
mozilla/pushbox &
docker run --rm --name pushbox \
-p 8002:8002 \
-e ROCKET_PORT=8002 \
-e ROCKET_SERVER_TOKEN=Correct_Horse_Battery_Staple_1 \
-e ROCKET_DATABASE_URL=mysql://$MYSQL_URI/pushbox \
mozilla/pushbox &
while :; do read; done
fi
while :; do read -r; done

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

@ -0,0 +1,3 @@
#!/bin/bash -ex
"${0%/*}/check-mysql.sh"
npm run start-dev-debug

5
_scripts/start-after-mysql.sh Executable file
Просмотреть файл

@ -0,0 +1,5 @@
#!/bin/bash -ex
"${0%/*}/check-mysql.sh"
npm start

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

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

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

@ -1,9 +0,0 @@
#!/bin/bash -ex
. ../../_scripts/check_mysql.sh
check_mysql
mysqlStarted=$?
if [ "$mysqlStarted" ]; then
npm run start-dev-debug
fi

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

@ -1,13 +1,15 @@
#!/bin/sh -ex
#!/bin/bash -ex
DOCKER_OS="`docker info --format '{{.OperatingSystem}}'`"
DOCKER_OS="$(docker info --format '{{.OperatingSystem}}')"
if [ "$DOCKER_OS" = 'Docker for Windows' -o "$DOCKER_OS" = 'Docker for Mac' -o "$DOCKER_OS" = 'Docker Desktop' ]; then
if [ "$DOCKER_OS" = 'Docker for Windows' ] || [ "$DOCKER_OS" = 'Docker for Mac' ] || [ "$DOCKER_OS" = 'Docker Desktop' ]; then
HOST_ADDR='host.docker.internal'
else
HOST_ADDR='127.0.0.1'
fi
"${0%/*}/check-url.sh" "http://$HOST_ADDR:3030/.well-known/fxa-client-configuration"
docker run --rm --name syncserver \
-p 5000:5000 \
-e SYNCSERVER_PUBLIC_URL=http://127.0.0.1:5000 \

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

@ -3,7 +3,7 @@
echo ""
echo "Usage:"
echo " Checkout HEAD of master of https://github.com/mozilla/fxa, and from"
echo " ./fxa, run ./_scripts/upload_assets_to_cdn.sh."
echo " ./fxa, run ./_scripts/upload-assets-to-cdn.sh."
echo ""
echo "Your current branch is $(git branch --show-current)"
echo ""

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

@ -2,5 +2,10 @@
"packages": [
"packages/*"
],
"version": "independent"
"version": "independent",
"command": {
"bootstrap": {
"ignore": "fxa-amplitude-send"
}
}
}

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

@ -1,213 +0,0 @@
{
"apps": [
{
"name": "MySQL server PORT 3306",
"script": "_scripts/mysql.sh",
"max_restarts": "1",
"min_uptime": "2m",
"kill_timeout": 20000
},
{
"name": "redis PORT 6379",
"script": "_scripts/redis.sh",
"env": {
"PORT": "6379"
},
"max_restarts": "1",
"min_uptime": "2m",
"kill_timeout": 20000
},
{
"name": "memcached PORT 11211",
"script": "_scripts/memcached.sh",
"max_restarts": "1",
"min_uptime": "2m",
"kill_timeout": 20000
},
{
"name": "Fake SQS/SNS PORT 4100",
"script": "_scripts/goaws.sh",
"max_restarts": "1",
"min_uptime": "2m",
"autorestart": false,
"kill_timeout": 20000
},
{
"name": "google-pubsub-emulator PORT 8085",
"script": "_scripts/pubsub.sh",
"max_restarts": "1",
"min_uptime": "2m",
"kill_timeout": 20000
},
{
"name": "google-firestore-emulator PORT 9090",
"script": "_scripts/firestore.sh",
"max_restarts": "1",
"min_uptime": "2m",
"kill_timeout": 20000
},
{
"name": "sync server PORT 5000",
"script": "_scripts/syncserver.sh",
"max_restarts": "1",
"min_uptime": "2m",
"autorestart": false,
"kill_timeout": 20000
},
{
"name": "email-service PORT 8001",
"script": "_scripts/fxa_email_service.sh",
"max_restarts": "1",
"min_uptime": "2m",
"kill_timeout": 20000
},
{
"name": "auth-server local mail helper",
"script": "test/mail_helper.js",
"cwd": "packages/fxa-auth-server",
"env": {
"NODE_ENV": "dev"
},
"max_restarts": "1",
"min_uptime": "2m"
},
{
"name": "auth-server db mysql PORT 8000",
"script": "../../_scripts/start_after_mysql.sh",
"cwd": "packages/fxa-auth-db-mysql",
"env": {
"NODE_ENV": "dev"
},
"max_restarts": "2",
"min_uptime": "2m"
},
{
"name": "auth-server key server PORT 9000",
"script": "../../_scripts/start_after_mysql.sh",
"cwd": "packages/fxa-auth-server",
"env": {
"DB": "mysql",
"NODE_ENV": "dev",
"IP_ADDRESS": "0.0.0.0",
"SIGNIN_UNBLOCK_FORCED_EMAILS": "^block.*@restmail\\.net$",
"SIGNIN_CONFIRMATION_ENABLED": "true",
"SIGNIN_CONFIRMATION_FORCE_EMAIL_REGEX": "^sync.*@restmail\\.net$",
"CONFIG_FILES": "config/secrets.json"
},
"max_restarts": "1",
"min_uptime": "2m"
},
{
"name": "content-server PORT 3030",
"script": "node_modules/.bin/grunt",
"args": ["server"],
"cwd": "packages/fxa-content-server",
"env": {
"NODE_ENV": "development"
},
"max_restarts": "1",
"min_uptime": "2m"
},
{
"name": "profile-server PORT 1111",
"script": "../../_scripts/start_after_mysql.sh",
"cwd": "packages/fxa-profile-server",
"max_restarts": "1",
"env": {
"NODE_ENV": "development",
"HOST": "0.0.0.0",
"DB": "mysql"
},
"min_uptime": "2m"
},
{
"name": "Fortress PORT 9292",
"script": "server.js",
"cwd": "packages/fortress",
"max_restarts": "1",
"env": {
"CONFIG_FORTRESS": "./config-local.json",
"NODE_ENV": "dev"
},
"min_uptime": "2m"
},
{
"name": "123done PORT 8080",
"script": "server.js",
"cwd": "packages/123done",
"max_restarts": "1",
"env": {
"CONFIG_123DONE": "./config-local.json",
"NODE_ENV": "dev"
},
"min_uptime": "2m"
},
{
"name": "321done UNTRUSTED PORT 10139",
"script": "server.js",
"cwd": "packages/123done",
"max_restarts": "1",
"env": {
"CONFIG_123DONE": "./config-local-untrusted.json",
"NODE_ENV": "dev"
},
"min_uptime": "2m"
},
{
"name": "browserid-verifier PORT 5050",
"script": "server.js",
"cwd": "packages/browserid-verifier",
"env": {
"PORT": "5050",
"IP_ADDRESS": "0.0.0.0",
"FORCE_INSECURE_LOOKUP_OVER_HTTP": "true"
},
"max_restarts": "1",
"min_uptime": "2m"
},
{
"name": "payments server PORT 3031",
"cwd": "packages/fxa-payments-server",
"script": "npm",
"args": ["run", "start-dev"],
"max_restarts": "1",
"min_uptime": "2m",
"env": {
"LOGGING_FORMAT": "pretty",
"NODE_ENV": "development",
"CONFIG_FILES": "server/config/secrets.json"
}
},
{
"name": "support admin panel PORT 7100",
"cwd": "packages/fxa-support-panel",
"script": "npm",
"args": ["run", "start-dev"],
"max_restarts": "1",
"min_uptime": "2m",
"env": {
"LOGGING_FORMAT": "pretty",
"NODE_ENV": "development"
}
},
{
"name": "event-broker",
"script": "../../_scripts/start_after_mysql.sh",
"cwd": "packages/fxa-event-broker",
"max_restarts": "1",
"env": {
"NODE_ENV": "development",
"WORKER_HOST": "0.0.0.0"
},
"min_uptime": "2m"
},
{
"name": "pushbox PORT 8002",
"script": "_scripts/pushbox.sh",
"max_restarts": "1",
"min_uptime": "2m",
"args": "3306 root@mydb:3306",
"kill_timeout": 20000
}
]
}

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

@ -58,6 +58,187 @@
"regenerator-runtime": "^0.13.4"
}
},
"@dannycoates/nps": {
"version": "5.9.12",
"resolved": "https://registry.npmjs.org/@dannycoates/nps/-/nps-5.9.12.tgz",
"integrity": "sha512-ZZORX0VCLA0WuFOzbJKhdgzmNLAuteIC+6trauK/Tr+/fBthtW5yH9DCN+KLTgU+wulAgJkFbSSCc7V4YVVihg==",
"requires": {
"arrify": "^1.0.1",
"chalk": "^2.0.1",
"common-tags": "^1.4.0",
"find-up": "^2.1.0",
"js-yaml": "^3.9.0",
"lodash": "^4.17.4",
"manage-path": "^2.0.0",
"prefix-matches": "^1.0.1",
"readline-sync": "^1.4.7",
"spawn-command-with-kill": "^1.0.0",
"type-detect": "^4.0.3",
"yargs": "14.2.0"
},
"dependencies": {
"ansi-regex": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg=="
},
"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"
}
},
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA=="
},
"find-up": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
"integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
"requires": {
"locate-path": "^2.0.0"
}
},
"is-fullwidth-code-point": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8="
},
"locate-path": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz",
"integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=",
"requires": {
"p-locate": "^2.0.0",
"path-exists": "^3.0.0"
}
},
"p-limit": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz",
"integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==",
"requires": {
"p-try": "^1.0.0"
}
},
"p-locate": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz",
"integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=",
"requires": {
"p-limit": "^1.1.0"
}
},
"p-try": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz",
"integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M="
},
"path-exists": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU="
},
"string-width": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
"integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
"requires": {
"emoji-regex": "^7.0.1",
"is-fullwidth-code-point": "^2.0.0",
"strip-ansi": "^5.1.0"
}
},
"strip-ansi": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
"requires": {
"ansi-regex": "^4.1.0"
}
},
"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"
}
},
"yargs": {
"version": "14.2.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-14.2.0.tgz",
"integrity": "sha512-/is78VKbKs70bVZH7w4YaZea6xcJWOAwkhbR0CFuZBmYtfTYF0xjGJF43AYd8g2Uii1yJwmS5GR2vBmrc32sbg==",
"requires": {
"cliui": "^5.0.0",
"decamelize": "^1.2.0",
"find-up": "^3.0.0",
"get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
"require-main-filename": "^2.0.0",
"set-blocking": "^2.0.0",
"string-width": "^3.0.0",
"which-module": "^2.0.0",
"y18n": "^4.0.0",
"yargs-parser": "^15.0.0"
},
"dependencies": {
"find-up": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
"requires": {
"locate-path": "^3.0.0"
}
},
"locate-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
"requires": {
"p-locate": "^3.0.0",
"path-exists": "^3.0.0"
}
},
"p-limit": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
"requires": {
"p-try": "^2.0.0"
}
},
"p-locate": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
"requires": {
"p-limit": "^2.0.0"
}
},
"p-try": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
}
}
}
}
},
"@evocateur/libnpmaccess": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/@evocateur/libnpmaccess/-/libnpmaccess-3.1.2.tgz",
@ -2641,6 +2822,11 @@
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag=="
},
"common-tags": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.0.tgz",
"integrity": "sha512-6P6g0uetGpW/sdyUy/iQQCbFF0kWVMSIVSyYz7Zgjcgh8mgw8PQzDNZeyZ5DQ2gM7LBoZPHmnjz8rUthkBG5tw=="
},
"compare-func": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/compare-func/-/compare-func-1.3.2.tgz",
@ -4668,6 +4854,30 @@
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="
},
"event-stream": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz",
"integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=",
"requires": {
"duplexer": "~0.1.1",
"from": "~0",
"map-stream": "~0.1.0",
"pause-stream": "0.0.11",
"split": "0.3",
"stream-combiner": "~0.0.4",
"through": "~2.3.1"
},
"dependencies": {
"split": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz",
"integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=",
"requires": {
"through": "2"
}
}
}
},
"eventemitter2": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-5.0.1.tgz",
@ -5041,6 +5251,11 @@
"map-cache": "^0.2.2"
}
},
"from": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz",
"integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4="
},
"from2": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz",
@ -6302,6 +6517,11 @@
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
"integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8="
},
"is-object": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz",
"integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA="
},
"is-observable": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-observable/-/is-observable-1.1.0.tgz",
@ -7098,6 +7318,11 @@
"ssri": "^6.0.0"
}
},
"manage-path": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/manage-path/-/manage-path-2.0.0.tgz",
"integrity": "sha1-9M+EV7km7u4qg7FzUBQUvHbrlZc="
},
"map-cache": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz",
@ -7108,6 +7333,11 @@
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz",
"integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0="
},
"map-stream": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz",
"integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ="
},
"map-visit": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz",
@ -7998,6 +8228,14 @@
"pinkie-promise": "^2.0.0"
}
},
"pause-stream": {
"version": "0.0.11",
"resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz",
"integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=",
"requires": {
"through": "~2.3"
}
},
"performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
@ -8235,6 +8473,15 @@
"resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
"integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs="
},
"prefix-matches": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/prefix-matches/-/prefix-matches-1.0.1.tgz",
"integrity": "sha1-AuNM4n8zr0jmi7/OKqwqAEvCt2w=",
"requires": {
"is-object": "^1.0.1",
"starts-with": "^1.0.2"
}
},
"prelude-ls": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
@ -8358,6 +8605,14 @@
"resolved": "https://registry.npmjs.org/ps-list/-/ps-list-6.3.0.tgz",
"integrity": "sha512-qau0czUSB0fzSlBOQt0bo+I2v6R+xiQdj78e1BR/Qjfl5OHWJ/urXi8+ilw1eHe+5hSeDI1wrwVTgDp2wst4oA=="
},
"ps-tree": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/ps-tree/-/ps-tree-1.2.0.tgz",
"integrity": "sha512-0VnamPPYHl4uaU/nSFeZZpR21QAWRz+sRv4iW9+v/GS/J5U5iZB5BNN6J0RMoOvdx2gWM2+ZFMIm58q24e4UYA==",
"requires": {
"event-stream": "=3.3.4"
}
},
"psl": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.7.0.tgz",
@ -8520,6 +8775,11 @@
"picomatch": "^2.0.7"
}
},
"readline-sync": {
"version": "1.4.10",
"resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz",
"integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw=="
},
"rechoir": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
@ -9180,6 +9440,20 @@
"resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz",
"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="
},
"spawn-command-with-kill": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/spawn-command-with-kill/-/spawn-command-with-kill-1.0.2.tgz",
"integrity": "sha512-EPzhF/ZO19xzZ1RCyrNorAal5o5FoZoXqHeybQm4vyfMmNbOU5cvfKQsTuspcBVilL5QDmybYpwkj9/GgaEd8Q==",
"requires": {
"ps-tree": "^1.2.0",
"spawn-command": "^0.0.2-1"
}
},
"spdx-correct": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz",
@ -9261,6 +9535,11 @@
"figgy-pudding": "^3.5.1"
}
},
"starts-with": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/starts-with/-/starts-with-1.0.2.tgz",
"integrity": "sha1-Fnk6cp2J1M89T7LtovkIrjV/GW8="
},
"static-extend": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
@ -9285,6 +9564,14 @@
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
},
"stream-combiner": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz",
"integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=",
"requires": {
"duplexer": "~0.1.1"
}
},
"stream-each": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz",
@ -9691,6 +9978,11 @@
"prelude-ls": "~1.1.2"
}
},
"type-detect": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g=="
},
"type-fest": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",

20
package-scripts.js Normal file
Просмотреть файл

@ -0,0 +1,20 @@
module.exports = {
scripts: {
default: "nps help",
start: {
default:
"pm2 start _dev/pm2/infrastructure.json _dev/pm2/services.json && echo \"Use 'npm stop' to stop all the servers\"",
infrastructure: "pm2 start _dev/pm2/infrastructure.json",
services: "pm2 start _dev/pm2/services.json",
firefox: "./packages/fxa-dev-launcher/bin/fxa-dev-launcher &"
},
stop: {
default: "pm2 kill",
services: "pm2 stop _dev/pm2/services.json"
},
restart: {
default: "pm2 restart all",
services: "pm2 restart _dev/pm2/services.json"
}
}
};

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

@ -4,13 +4,11 @@
"description": "Firefox Accounts monorepo",
"scripts": {
"authors": "git shortlog -s | cut -c8- | sort -f > AUTHORS",
"postinstall": "_scripts/install_all.sh",
"npm-ci-all": "lerna exec --parallel --ignore fxa-amplitude-send -- npm ci",
"postinstall": "_scripts/install-all.sh",
"audit": "lerna run audit --parallel",
"start": "_scripts/check_ports.sh && pm2 start mysql_servers.json && echo \"Use 'npm stop' to stop all the servers\"",
"stop": "pm2 kill",
"firefox": "./packages/fxa-dev-launcher/bin/fxa-dev-launcher",
"start-firefox": "npm run firefox",
"start": "nps --prefix=start",
"stop": "nps --prefix=stop",
"restart": "nps --prefix=restart",
"adb-reverse": "./_scripts/adb-reverse.sh",
"test": "_scripts/test-package.sh",
"config-fxios": "node _scripts/config-fxios.js",
@ -27,6 +25,7 @@
"author": "Mozilla (https://mozilla.org/)",
"license": "MPL-2.0",
"dependencies": {
"@dannycoates/nps": "^5.9.12",
"diffparser": "^2.0.1",
"husky": "^4.2.3",
"lerna": "^3.20.2",
@ -73,7 +72,7 @@
},
"lint-staged": {
"*.js": [
"eslint -c .eslintrc",
"eslint -c _dev/.eslintrc",
"prettier --write"
],
"*.{ts,tsx}": [

4
packages/fxa-auth-server/.vscode/tasks.json поставляемый
Просмотреть файл

@ -33,12 +33,12 @@
{
"label": "Stop PM2 Auth Server",
"type": "shell",
"command": "pm2 stop 'auth-server key server PORT 9000'"
"command": "pm2 stop auth"
},
{
"label": "Start PM2 Auth Server",
"type": "shell",
"command": "pm2 start 'auth-server key server PORT 9000'"
"command": "pm2 start auth"
}
]
}

885
packages/fxa-auth-server/package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -130,6 +130,7 @@
"mkdirp": "0.5.1",
"mocha": "5.2.0",
"nock": "10.0.2",
"nodemon": "^2.0.3",
"npm-run-all": "4.1.5",
"nyc": "^14.1.1",
"prettier": "^1.18.2",

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

@ -12,10 +12,10 @@ function check() {
# * $2 [optional] - expected status code of a response from this endpoint. Defaults to 200.
RETRY=12
for i in $(eval echo "{1..$RETRY}"); do
if [ $(curl -s -o /dev/null --silent -w "%{http_code}" http://$1) == "${2:-200}" ]; then
if [ "$(curl -s -o /dev/null --silent -w "%{http_code}" http://$1)" == "${2:-200}" ]; then
return
else
if [ $i -lt $RETRY ]; then
if [ "$i" -lt $RETRY ]; then
sleep 10
fi
fi
@ -30,12 +30,12 @@ function test_suite() {
for i in $(seq $numGroups)
do
node tests/intern.js --suites=${suite} --groupsCount=${numGroups} --groupNum=${i} --firefoxBinary=./firefox/firefox || \
node tests/intern.js --suites=${suite} --groupsCount=${numGroups} --groupNum=${i} --firefoxBinary=./firefox/firefox --grep="$(<rerun.txt)"
node tests/intern.js --suites="${suite}" --groupsCount=${numGroups} --groupNum="${i}" --firefoxBinary=./firefox/firefox || \
node tests/intern.js --suites="${suite}" --groupsCount=${numGroups} --groupNum="${i}" --firefoxBinary=./firefox/firefox --grep="$(<rerun.txt)"
done
}
cd $DIR/..
cd "$DIR/.."
mkdir -p config
cp ../version.json ./
@ -44,13 +44,14 @@ cp ../version.json config
npm run lint
cd ../../
npx pm2 start circleci_servers.json
npx pm2 start .circleci/pm2.json
cd packages/fxa-content-server
mozinstall /firefox.tar.bz2
# ensure email-service is ready
check 127.0.0.1:8001/__heartbeat__
# ensure payments-server is ready
check 127.0.0.1:3031/__lbheartbeat__
test_suite circle

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

@ -1,101 +0,0 @@
#!/bin/bash -ex
function check() {
# Real startup of the servers takes longer than `pm start`.
# In order to check their urls, we have to wait for them (2 minutes) and periodically
# check if their endpoints are available.
# Function takes following parameters:
# * $1 - an url of an endpoint to check
# * $2 [optional] - expected status code of a response from this endpoint. Defaults to 200.
RETRY=12
for i in $(eval echo "{1..$RETRY}"); do
if [ $(curl -s -o /dev/null --silent -w "%{http_code}" http://$1) == "${2:-200}" ]; then
return
else
if [ $i -lt $RETRY ]; then
sleep 10
fi
fi
done
exit 1
}
function check_redis() {
RETRY=12
for i in $(eval echo "{1..$RETRY}"); do
if echo PING | nc localhost 6379 | grep -q 'PONG'; then
return
else
if [ $i -lt $RETRY ]; then
sleep 10
fi
fi
done
exit 1
}
function check_memcached() {
RETRY=12
for i in $(eval echo "{1..$RETRY}"); do
if echo stats | nc localhost 11211 | grep -q 'STAT'; then
return
else
if [ $i -lt $RETRY ]; then
sleep 10
fi
fi
done
exit 1
}
function check_mysql() {
RETRY=12
for i in $(eval echo "{1..$RETRY}"); do
if echo PING | nc localhost 3306 | grep -q 'mysql'; then
return
else
if [ $i -lt $RETRY ]; then
sleep 10
fi
fi
done
exit 1
}
# content
check 127.0.0.1:3030
check 127.0.0.1:1114
check 127.0.0.1:10140 400
# auth
check 127.0.0.1:9000
check 127.0.0.1:9001 404
# oauth
# check 127.0.0.1:9010
# 123done and 321done untrusted apps
check 127.0.0.1:8080
check 127.0.0.1:10139
# profile server
check 127.0.0.1:1111
check 127.0.0.1:1112 404
check 127.0.0.1:5050 405
# sync server
# address of the endpoint have to be the same as a public_url in settings
check 127.0.0.1:5000
# auth-db
check localhost:8000
# redis server
check_redis
# memcached
check_memcached

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

@ -1,7 +0,0 @@
#!/bin/bash -ex
. test/curl.sh
##additional tests to be performed in mysql mode
# mysql
check_mysql