This commit is contained in:
Danny Coates 2019-03-29 18:22:03 -07:00
Родитель 0beeac5b42
Коммит 52e5d10a43
33 изменённых файлов: 8917 добавлений и 380 удалений

8
.circleci/build-test-deploy.sh Executable file
Просмотреть файл

@ -0,0 +1,8 @@
#!/bin/bash -ex
MODULE=$(basename $(pwd))
DIR=$(dirname "$0")
$DIR/build.sh $MODULE
$DIR/test.sh $MODULE $1
$DIR/deploy.sh $MODULE

25
.circleci/build.sh Executable file
Просмотреть файл

@ -0,0 +1,25 @@
#!/bin/bash -ex
MODULE=$1
DIR=$(dirname "$0")
if grep -e "$MODULE" -e 'all' $DIR/../packages/test.list; then
docker -v
if [[ -d config ]]; then
cp $DIR/../packages/version.json config
fi
if [ "${MODULE}" == 'fxa-oauth-server' ]; then
cp $DIR/../packages/version.json fxa-oauth-server/config
docker build -f Dockerfile-oauth-build -t ${MODULE}:build .
elif [[ -e Dockerfile ]]; then
docker build -f Dockerfile -t ${MODULE}:build .
# docker run --rm -it ${MODULE}:build npm ls --production
elif [[ -e Dockerfile-build ]]; then
docker build -f Dockerfile-build -t ${MODULE}:build .
# docker run --rm -it ${MODULE}:build npm ls --production
fi
# docker save -o "../${MODULE}.tar" ${MODULE}:build
else
exit 0;
fi

313
.circleci/config.yml Normal file
Просмотреть файл

@ -0,0 +1,313 @@
version: 2.1
executors:
nodejs:
docker:
- image: circleci/node:10
commands:
npm-install:
parameters:
module:
type: string
default: "dependencies"
steps:
- restore_cache:
keys:
- v2-<< parameters.module >>-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v2-<< parameters.module >>-
- run: npm ci
- save_cache:
paths:
- node_modules
key: v2-<< parameters.module >>-{{ checksum "package.json" }}
jobs:
install:
executor: nodejs
steps:
- checkout
- npm-install
- run:
name: Create version.json
command: >
printf '{"version":{"hash":"%s","version":"%s","source":"https://github.com/%s/%s","build":"%s"}}\n'
"$CIRCLE_SHA1"
"$CIRCLE_TAG"
"$CIRCLE_PROJECT_USERNAME"
"$CIRCLE_PROJECT_REPONAME"
"$CIRCLE_BUILD_URL"
| tee packages/version.json
- run: node .circleci/modules-to-test.js | tee packages/test.list
- store_artifacts:
path: packages/version.json
- persist_to_workspace:
root: ~/.
paths:
- project/*
build-module:
executor: nodejs
parameters:
module:
type: string
test:
type: string
default: test
db:
type: boolean
default: false
working_directory: ~/project/packages/<< parameters.module >>
steps:
- attach_workspace:
at: ~/.
- setup_remote_docker
- when:
condition: << parameters.db >>
steps:
- run:
name: Start mysql
command: docker pull mysql/mysql-server:5.6 && docker run -d --name=mydb -e MYSQL_ALLOW_EMPTY_PASSWORD=true -e MYSQL_ROOT_HOST=% -p 3306:3306 mysql/mysql-server:5.6
- run:
name: Start memcached
command: docker pull memcached && docker run -d --name memcached -p 11211:11211 memcached
- run:
name: Start redis
command: docker pull redis && docker run -d --name redis-server -p 6379:6379 redis
- run: ../../.circleci/build-test-deploy.sh << parameters.test >>
deploy-module:
executor: nodejs
parameters:
module:
type: string
working_directory: ~/project/packages/<< parameters.module >>
steps:
- attach_workspace:
at: ~/.
- setup_remote_docker
- run: ../../.circleci/build.sh << parameters.module >>
- run: ../../.circleci/deploy.sh << parameters.module >>
fxa-oauth-server:
executor: nodejs
working_directory: ~/project/packages/fxa-auth-server
steps:
- attach_workspace:
at: ~/.
- setup_remote_docker
- run:
name: Start mysql
command: docker pull mysql/mysql-server:5.6 && docker run -d --name=mydb -e MYSQL_ALLOW_EMPTY_PASSWORD=true -e MYSQL_ROOT_HOST=% -p 3306:3306 mysql/mysql-server:5.6
- run: ../../.circleci/build.sh fxa-oauth-server
- run: ../../.circleci/test.sh fxa-oauth-server
- run: ../../.circleci/deploy.sh fxa-oauth-server
install-content-server:
executor: nodejs
working_directory: ~/project/packages/fxa-content-server
steps:
- attach_workspace:
at: ~/.
- setup_remote_docker
- run: ../../.circleci/install-content-server.sh
- persist_to_workspace:
root: ~/.
paths:
- project/*
test-content-server:
parallelism: 3
docker:
- image: circleci/node:10-stretch-browsers
- image: redis
- image: memcached
- image: pafortin/goaws
working_directory: ~/project/packages/fxa-content-server
steps:
- attach_workspace:
at: ~/
- run: ../../.circleci/test-content-server.sh
# run pairing tests on one node
- deploy:
command: ../../.circleci/test-content-server.sh pairing
- setup_remote_docker
- deploy:
command: ../../.circleci/build.sh fxa-content-server
- deploy:
command: ../../.circleci/deploy.sh fxa-content-server
- store_artifacts:
path: ~/.pm2/logs
destination: logs
fxa-shared:
docker:
- image: circleci/node:10
- image: redis
working_directory: ~/project/packages/fxa-shared
steps:
- attach_workspace:
at: ~/
- npm-install:
module: fxa-shared
- run: rm ~/project/package.json
- run: npm run lint
- run: npm test
js-client:
docker:
- image: circleci/node:8
working_directory: ~/project/packages/fxa-js-client
steps:
- attach_workspace:
at: ~/
- run: ../../.circleci/test-js-client.sh
workflows:
test:
jobs:
- install
- build-module:
name: 123done
module: 123done
requires:
- install
- build-module:
name: browserid-verifier
module: browserid-verifier
requires:
- install
- build-module:
name: fxa-auth-db-mysql
module: fxa-auth-db-mysql
db: true
requires:
- install
- build-module:
name: fxa-auth-server
module: fxa-auth-server
db: true
test: test-ci
requires:
- install
- build-module:
name: fxa-basket-proxy
module: fxa-basket-proxy
requires:
- install
- build-module:
name: fxa-customs-server
module: fxa-customs-server
db: true
requires:
- install
- build-module:
name: fxa-email-service
module: fxa-email-service
requires:
- install
- build-module:
name: fxa-oauth-console
module: fxa-oauth-console
requires:
- install
- build-module:
name: fxa-profile-server
module: fxa-profile-server
requires:
- install
- install-content-server:
requires:
- install
- test-content-server:
requires:
- install-content-server
- fxa-shared:
requires:
- install
- js-client:
requires:
- install
- fxa-oauth-server:
requires:
- install
deploy-tag:
jobs:
- install:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- deploy-module:
name: 123done
module: 123done
requires:
- install
- deploy-module:
name: browserid-verifier
module: browserid-verifier
requires:
- install
- deploy-module:
name: fxa-auth-db-mysql
module: fxa-auth-db-mysql
requires:
- install
- deploy-module:
name: fxa-auth-server
module: fxa-auth-server
requires:
- install
- deploy-module:
name: fxa-basket-proxy
module: fxa-basket-proxy
requires:
- install
- deploy-module:
name: fxa-customs-server
module: fxa-customs-server
requires:
- install
- deploy-module:
name: fxa-email-service
module: fxa-email-service
requires:
- install
- deploy-module:
name: fxa-oauth-console
module: fxa-oauth-console
requires:
- install
- deploy-module:
name: fxa-profile-server
module: fxa-profile-server
requires:
- install
- deploy-module:
name: fxa-content-server
module: fxa-content-server
requires:
- install
- fxa-oauth-server:
requires:
- install

28
.circleci/deploy.sh Executable file
Просмотреть файл

@ -0,0 +1,28 @@
#!/bin/bash -ex
MODULE=$1
DIR=$(dirname "$0")
if grep -e "$MODULE" -e 'all' $DIR/../packages/test.list; then
if [ "${CIRCLE_BRANCH}" == "master" ]; then
DOCKER_TAG="latest"
fi
if [[ "${CIRCLE_BRANCH}" == feature* ]] || [[ "${CIRCLE_BRANCH}" == dockerpush* ]]; then
DOCKER_TAG="${CIRCLE_BRANCH}"
fi
if [ -n "${CIRCLE_TAG}" ]; then
DOCKER_TAG="$CIRCLE_TAG"
fi
if [ -n "${DOCKER_TAG}" ] && [ -n "${DOCKER_PASS}" ] && [ -n "${DOCKER_USER}"] && [ -n "${DOCKERHUB_REPO}"]; then
echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
echo ${DOCKERHUB_REPO}:${DOCKER_TAG}
docker tag ${MODULE}:build ${DOCKERHUB_REPO}:${DOCKER_TAG}
docker images
docker push ${DOCKERHUB_REPO}:${DOCKER_TAG}
fi
else
exit 0;
fi

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

@ -0,0 +1,15 @@
#!/bin/bash -ex
DIR=$(dirname "$0")
if grep -e "fxa-content-server" -e 'all' $DIR/../packages/test.list; then
sudo apt-get install -y graphicsmagick
mkdir -p config
cp ../version.json ./
cp ../version.json config
cd $DIR/..
CIRCLECI=false npm install
npx pm2 kill
else
exit 0;
fi

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

@ -0,0 +1,75 @@
const parseDiff = require('diffparser');
const fetch = require('node-fetch');
const { moduleDependencies } = require('../package.json').fxa;
const fs = require('fs')
const path = require('path')
process.on('unhandledRejection', e => {
console.error(e)
process.exit(1)
});
const testable = fs.readdirSync(path.resolve(__dirname, '..', 'packages'), { withFileTypes: true }).filter(de => de.isDirectory()).map(de => de.name)
function moduleName(path) {
const parts = path.split('/');
return parts.length > 2 && testable.includes(parts[1]) ? parts[1] : 'root';
}
async function getModules(org, repo, prNumber) {
try {
const response = await fetch(`https://patch-diff.githubusercontent.com/raw/${org}/${repo}/pull/${prNumber}.diff`);
const diff = parseDiff(await response.text());
const modules = new Set()
for (const { to, from } of diff) {
[to, from]
.filter(n => n !== '/dev/null')
.forEach(n => modules.add(moduleName(n)))
}
return modules;
} catch (e) {
console.error(e)
return new Set(['all']);
}
}
function modulesToTest(changed) {
const toTest = new Set(changed);
let size;
do {
size = toTest.size;
for (const [mod, deps] of Object.entries(moduleDependencies)) {
for (const m of toTest) {
if (deps.includes(m)) {
toTest.add(mod);
}
}
}
} while (size < toTest.size)
return toTest;
}
async function main() {
const env = process.env;
const branch = env.CIRCLE_BRANCH;
const org = env.CIRCLE_PROJECT_USERNAME;
const repo = env.CIRCLE_PROJECT_REPONAME;
const pr = env.CIRCLE_PULL_REQUEST;
if (pr) {
const prNumber = /\d+$/.exec(pr)[0];
const toTest = Array.from(modulesToTest(await getModules(org, repo, prNumber))).filter(m => m !== 'root');
for (const mod of toTest) {
console.log(mod)
}
}
else if (branch === 'master') {
console.log('all')
}
else {
//TODO diff master..branch
console.log('all')
}
}
main();

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

@ -0,0 +1,61 @@
#!/bin/bash -lex
MODULE=$(basename $(pwd))
PAIRING=$1
DIR=$(dirname "$0")
# copied from ../test/curl.sh
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
}
if grep -e "$MODULE" -e 'all' $DIR/../packages/test.list; then
sudo apt-get install -y python-setuptools python-dev build-essential graphicsmagick &> /dev/null
sudo easy_install pip &> /dev/null
sudo pip install mozdownload mozinstall &> /dev/null
if [[ ! $(which rustup) ]]; then
curl https://sh.rustup.rs -sSf | sh -s -- -y
PATH=$PATH:$HOME/.cargo/bin
fi
cd ../../
npx pm2 delete servers.json && npx pm2 start servers.json
# ensure email-service is ready
check 127.0.0.1:8001/__heartbeat__
cd packages/fxa-content-server
mozdownload --version 58.0 --destination firefox.tar.bz2
if [ -n "${PAIRING}" ]; then
wget https://s3-us-west-2.amazonaws.com/fxa-dev-bucket/fenix-pair/desktop/7f10c7614e9fa46-target.tar.bz2
mozinstall 7f10c7614e9fa46-target.tar.bz2
node tests/intern.js --suites=pairing --firefoxBinary=./firefox/firefox
mozinstall firefox.tar.bz2
node tests/intern.js --suites=travis --firefoxBinary=./firefox/firefox
# node tests/intern.js --suites=server --firefoxBinary=./firefox/firefox
else
mozinstall firefox.tar.bz2
node ./tests/intern.js --suites=circle --firefoxBinary=./firefox/firefox
fi
else
exit 0;
fi

15
.circleci/test-js-client.sh Executable file
Просмотреть файл

@ -0,0 +1,15 @@
#!/bin/bash -ex
MODULE=$(basename $(pwd))
DIR=$(dirname "$0")
if grep -e "$MODULE" -e 'all' $DIR/../packages/test.list; then
sudo apt-get install -y default-jre
# for some reason js-client tests fail if we cache node_modules
npm install
npx grunt sjcl
npm test
# TODO ./tests/ci/travis-auth-server-test.sh
else
exit 0;
fi

17
.circleci/test.sh Executable file
Просмотреть файл

@ -0,0 +1,17 @@
#!/bin/bash -ex
MODULE=$1
TEST=$2
DIR=$(dirname "$0")
if grep -e "$MODULE" -e 'all' $DIR/../packages/test.list; then
if [ "${MODULE}" == 'fxa-oauth-server' ]; then
docker build -f Dockerfile-oauth-test -t ${MODULE}:test .
docker run --net="host" -e DB="mysql" ${MODULE}:test npm run test-oauth
elif [[ -e Dockerfile-test ]]; then
docker build -f Dockerfile-test -t ${MODULE}:test .
docker run --net="host" ${MODULE}:test npm run ${TEST:-test}
fi
else
exit 0;
fi

7
.gitignore поставляемый
Просмотреть файл

@ -1,6 +1,3 @@
fxa-*
123done
browserid-verifier
loop-server
syncserver
selenium-*
@ -8,11 +5,7 @@ selenium-*
servers_android.json
node_modules
package-lock.json
pm2
dump.rdb
*.log
.vagrant
local_config.yaml

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

@ -1,60 +0,0 @@
language: node_js
node_js:
- "10"
dist: trusty
sudo: required
os:
- linux
addons:
apt_packages:
- graphicsmagick
- python-virtualenv
- libgmp3-dev
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- docker-ce
env:
matrix:
- TRAVIS_NODE_VERSION="10"
matrix:
allow_failures:
- os: osx
- fast_finish: true
before_install:
- npm i -g npm@6
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then brew install graphicsmagick; fi
install:
- PATH="`npm bin`:`npm bin -g`:$PATH"
- npm install -g npm@6
- node --version
- npm --version
- curl -sSf https://sh.rustup.rs | sh -s -- -y --verbose
- PATH=$PATH:$HOME/.cargo/bin
- rustup install nightly-2018-06-23
- rustc --version
cache:
directories:
- $HOME/.cargo
- $HOME/.rustup
script:
- npm config set spin false
- npm install
- ./test/curl.sh
- pm2 kill
- pm2 start mysql_servers.json
- ./test/mysql.sh
after_failure:
- pm2 status

8
CODE_OF_CONDUCT.md Normal file
Просмотреть файл

@ -0,0 +1,8 @@
# Community Participation Guidelines
This repository is governed by Mozilla's code of conduct and etiquette guidelines.
For more details, please read the
[Mozilla Community Participation Guidelines](https://www.mozilla.org/about/governance/policies/participation/).
## How to Report
For more information on how to report violations of the Community Participation Guidelines, please read our '[How to Report](https://www.mozilla.org/about/governance/policies/participation/reporting/)' page.

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

@ -1,7 +1,6 @@
## fxa-local-dev [![Build Status](https://travis-ci.org/mozilla/fxa-local-dev.svg?branch=master)](https://travis-ci.org/mozilla/fxa-local-dev) ![](https://img.shields.io/badge/tested_on-OS%20X%20and_Ubuntu-brightgreen.svg)
> An easy way to contribute to Firefox Accounts. If you have issues please ask in `#fxa` on Mozilla IRC.
## Firefox Accounts
> ⚠️ **NOTE: Do not use this project in production, this is only for local development.**
The Firefox Accounts (fxa) monorepo
### Getting Started
@ -10,13 +9,13 @@
2. Clone this repository.
```sh
git clone https://github.com/mozilla/fxa-local-dev.git
git clone https://github.com/mozilla/fxa.git
```
3. Run:
```sh
cd fxa-local-dev
cd fxa
npm install
```
@ -55,9 +54,9 @@ When you want to [fetch the latest changes](_scripts/update_all.sh) to all serve
*******
### Workflow
> This is an example workflow for **fxa-local-dev**.
> This is an example workflow for **fxa**.
After installing **fxa-local-dev** the servers should automatically start up. Use `./pm2 status` command to check the status of the servers:
After installing **fxa** the servers should automatically start up. Use `./pm2 status` command to check the status of the servers:
![](http://i.imgur.com/eqL8FiZ.png)
@ -106,7 +105,7 @@ sudo easy_install pip && sudo pip install virtualenv
sudo apt-get install build-essential git-core libgmp3-dev graphicsmagick python-virtualenv
python-dev docker-ce
```
Docker commands require sudo, to avoid it, follow steps below:
Docker commands require sudo, to avoid it, follow steps below:
1. Add the docker group if it doesn't already exist
```
sudo groupadd docker
@ -122,22 +121,7 @@ sudo service docker restart
#### Installing Node.js
> NOTE: If you are experienced with Node.js: Use [nvm](https://github.com/creationix/nvm) to force node 8
just for `fxa-local-dev` using `nvm use 8`. (Install it first with `nvm install 8`)
##### Ubuntu / Debian:
```
# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_8.x | bash -
apt-get install -y nodejs
```
> NOTE: Node 8 and greater require C++11, that [does not come by default on Ubuntu 12](https://github.com/nodesource/distributions/blob/master/OLDER_DISTROS.md).
See https://nodejs.org
#### Installing Java
@ -178,8 +162,6 @@ Available options:
**Use `npm test` - all functional tests**
**Use `npm run test-oauth` - only OAuth functional tests**
*******
### Android debugging
@ -235,7 +217,7 @@ After the script you need to rebuild *firefox-ios*.
### Running with MailDev
If you want to inspect emails, you can run fxa-local-dev with [MailDev](https://www.npmjs.com/package/maildev).
If you want to inspect emails, you can run fxa with [MailDev](https://www.npmjs.com/package/maildev).
#### Install
```bash

52
Vagrantfile поставляемый
Просмотреть файл

@ -1,52 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
VAGRANTFILE_API_VERSION = "2"
localConfigPath = "local_config.yaml"
if File.exists?localConfigPath then
settings = YAML::load(File.read(localConfigPath))
else
settings = Hash.new
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.ssh.forward_agent = true
config.ssh.insert_key = false
config.vm.provider "virtualbox" do |vb|
vb.memory = settings["memory"] ||= "2048"
vb.cpus = 2
end
config.vm.define "dev", primary: true do |dev|
dev.vm.network "private_network", ip: settings["ip"] ||= "192.168.50.10"
dev.vm.network "forwarded_port", guest: 1111, host: 1111
dev.vm.network "forwarded_port", guest: 1112, host: 1112
dev.vm.network "forwarded_port", guest: 1113, host: 1113
dev.vm.network "forwarded_port", guest: 1114, host: 1114
dev.vm.network "forwarded_port", guest: 3030, host: 3030
dev.vm.network "forwarded_port", guest: 5000, host: 5000
dev.vm.network "forwarded_port", guest: 5050, host: 5050
dev.vm.network "forwarded_port", guest: 8080, host: 8080
dev.vm.network "forwarded_port", guest: 9000, host: 9000
dev.vm.network "forwarded_port", guest: 9010, host: 9010
dev.vm.network "forwarded_port", guest: 9011, host: 9011
dev.vm.network "forwarded_port", guest: 10137, host: 10137
dev.vm.network "forwarded_port", guest: 10139, host: 10139
dev.vm.network "forwarded_port", guest: 10140, host: 10140
end
config.vm.provision "shell", privileged: false, path: "_scripts/vagrant_provision.sh", args: Vagrant::Util::Platform.windows?.to_s.upcase
if settings.has_key?("push.app") then
config.push.define "atlas" do |push|
push.app = settings["push.app"]
push.dir = settings["push.dir"] ||= "."
end
end
end

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

@ -5,5 +5,5 @@ check_mysql
mysqlStarted=$?
if [ "$mysqlStarted" ]; then
node ../fxa-auth-db-mysql/bin/db_patcher.js && node ../fxa-auth-db-mysql/bin/server.js
node ../packages/fxa-auth-db-mysql/bin/db_patcher.js && node ../packages/fxa-auth-db-mysql/bin/server.js
fi

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

@ -3,17 +3,8 @@
set -ex
if [[ ! $(which rustup) ]]; then
curl https://sh.rustup.rs -sSf | sh
curl https://sh.rustup.rs -sSf | sh -s -- -y
export PATH=$PATH:$HOME/.cargo/bin/
exit 1
fi
if [[ $(which node) && $(node --version) ]]; then
node _scripts/check_node_version.js
else
echo "install node to continue installation"
echo "https://nodejs.org"
exit 1
fi
if [[ $(which docker) && $(docker --version) ]]; then

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

@ -1,33 +0,0 @@
const check = require("check-node-version");
check(
{ node: ">= 8", npm: ">= 6" },
(error, results) => {
if (error) {
console.error(error);
return;
}
if (results.isSatisfied) {
console.log("Node and nvm version ok");
return;
}
console.error("Some package version(s) failed!");
for (const packageName of Object.keys(results.versions)) {
if (!results.versions[packageName].isSatisfied) {
if(packageName === 'npm')
console.error(`Npm version must be > 6 . Run the following command to upgrade npm "npm i -g npm@6"`);
else if(packageName === 'node')
console.error(`Node version must be > 8`);
if(process.platform === 'darwin')
console.log("Use this if you do not rely on other node.js programs on your system: Find the latest Node 8 LTS .pkg download at nodejs.org/en/download/ and install it.")
else
console.error(`Missing ${packageName}.`);
process.exit(1);
}
}
}
);

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

@ -3,7 +3,6 @@
var path = require('path');
var r = require('replace-in-file');
var Promise = require('bluebird');
var ios_path = process.env.FIREFOX_IOS_HOME;

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

@ -29,12 +29,12 @@ servers.apps.forEach((app) => {
return;
}
if(app.cwd === 'fxa-auth-server/fxa-oauth-server') {
if(app.cwd === 'packages/fxa-auth-server/fxa-oauth-server') {
app.env.DB = 'mysql';
app.script = '_scripts/oauth_mysql.sh';
}
if(app.cwd === 'fxa-profile-server' && app.script === 'bin/server.js'){
if(app.cwd === 'packages/fxa-profile-server' && app.script === 'bin/server.js'){
app.env.DB = 'mysql';
app.script = '_scripts/profile_mysql.sh';
}

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

@ -4,47 +4,24 @@ _scripts/check.sh
# Set ulimit, need it for npm
ulimit -S -n 2048 || echo "Setting ulimit failed"
# Clone all the projects
git clone https://github.com/mozilla/fxa-content-server.git &
git clone https://github.com/mozilla/fxa-content-server-l10n.git &
git clone https://github.com/mozilla/fxa-js-client.git &
git clone https://github.com/mozilla/fxa-auth-server.git &
git clone https://github.com/mozilla/fxa-auth-db-mysql.git &
git clone https://github.com/mozilla/fxa-email-service.git &
git clone https://github.com/mozilla/fxa-customs-server.git &
git clone https://github.com/mozilla/browserid-verifier.git &
git clone https://github.com/mozilla/fxa-oauth-console.git &
git clone https://github.com/mozilla/fxa-profile-server.git &
git clone https://github.com/mozilla/fxa-basket-proxy.git &
git clone https://github.com/mozilla/123done.git -b oauth &
wait
# Install and Setup all the projects
cd packages
cd fxa-content-server; npm ci; cp server/config/local.json-dist server/config/local.json; cd ..
cd fxa-auth-server; npm ci; node ./scripts/gen_keys.js; node ./scripts/gen_vapid_keys.js; node ./fxa-oauth-server/scripts/gen_keys; cd ..
cd fxa-auth-db-mysql; npm ci; cd ..
cd fxa-auth-server; npm link ../fxa-auth-db-mysql; cd ..
# cd fxa-auth-server; npm link ../fxa-auth-db-mysql; cd ..
PATH=$PATH:$HOME/.cargo/bin
cd fxa-email-service; cargo build --bin fxa_email_send; cd ..
cd browserid-verifier; npm ci; cd ..
cd fxa-auth-server/fxa-oauth-server; npm ci; cd ../..
# cd fxa-auth-server/fxa-oauth-server; npm ci; cd ../..
cd fxa-profile-server; npm ci; mkdir -p var/public/; cd ..
@ -53,6 +30,14 @@ cd fxa-basket-proxy; npm ci; cd ..
# 123done does not have an npm-shrinkwrap.json file and cannot use `npm ci`
cd 123done; npm i; cd ..
cd fxa-shared; npm ci; cd ..
cd fxa-geodb; npm i; cd ..
cd fxa-email-event-proxy; npm ci; cd ..
cd ..
docker network create fxa-net || true
docker pull memcached

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

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

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

@ -1,5 +1,9 @@
#!/bin/sh -ex
_scripts/install_all.sh
pm2 delete servers.json && pm2 start servers.json
echo "Use './pm2 kill' to stop all the servers"
if [ "${CIRCLECI}" = "true" ]; then
exit 0
else
_scripts/install_all.sh
pm2 delete servers.json && pm2 start servers.json
echo "Use './pm2 kill' to stop all the servers"
fi

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

@ -5,5 +5,5 @@ check_mysql
mysqlStarted=$?
if [ "$mysqlStarted" ]; then
node ../fxa-profile-server/bin/server.js
node ../packages/fxa-profile-server/bin/server.js
fi

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

@ -1,7 +1,6 @@
var fs = require('fs');
var path = require('path');
var execSync = require('child_process').execSync;
var _ = require('lodash');
var chalk = require('chalk');
var internalIp = require('internal-ip');
var ip = internalIp.v4();
@ -10,7 +9,7 @@ function createConfig () {
var servers = require('../servers.json');
function findConfig(name) {
return _.findIndex(servers.apps, function(obj) {
return servers.apps.findIndex(servers.apps, function(obj) {
return obj.name === name;
});
}

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

@ -2,26 +2,11 @@
# Update all projects
git pull https://github.com/mozilla/fxa-local-dev.git master
(cd fxa-content-server && git checkout master && git pull origin master && npm ci && cd ..) || echo "fxa-content-server update failed"
(cd fxa-auth-server && git checkout master && git pull origin master && npm ci && cd ..) || echo "fxa-auth-server update failed"
(cd fxa-auth-db-mysql && git checkout master && git pull origin master && npm ci && cd ..) || echo "fxa-auth-db-mysql update failed"
(cd fxa-email-service && git checkout master && git pull origin master && npm ci && cd ..) || echo "fxa-email-service update failed"
(cd browserid-verifier && git checkout master && git pull origin master && npm ci && cd ..)|| echo "browserid update failed"
(cd fxa-profile-server && git checkout master && git pull origin master && npm ci && cd ..) || echo "fxa-profile-server update failed"
(cd fxa-basket-proxy && git checkout master && git pull origin master && npm ci && cd ..) || echo "fxa-basket-proxy update failed"
git pull
# Migration
docker network create fxa-net || true # Don't error out in case the network already exists
(cd 123done && git checkout -- . && git checkout oauth && git pull origin oauth && npm ci && cd ..) || echo "123done update failed"
docker pull mozilla/syncserver || echo "syncserver update failed"
docker pull mozilla/channelserver || echo "channelserver update failed"

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

@ -1,38 +0,0 @@
#!/bin/bash -e
echo "Adding Java and Node.js repositories"
sudo add-apt-repository -y ppa:webupd8team/java &>> ~/provision.log
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - &>> \
~/provision.log
echo "Installing dependencies"
sudo apt-get install -y build-essential git-core libgmp3-dev graphicsmagick \
redis-server python-virtualenv python-dev &>> ~/provision.log
echo "Installing Node.js"
sudo apt-get install -y nodejs &>> ~/provision.log
echo "Checking npm version"
CURRENT_VERSION=$(npm -v | awk '{print $1}')
INSTALL_VERSION=$(npm view npm@2 version | tail -1 | cut -d "'" -f2 |
awk '{print $1}')
if [[ $CURRENT_VERSION < $INSTALL_VERSION ]]; then
echo "Updating npm from $CURRENT_VERSION to $INSTALL_VERSION"
sudo npm install npm@$INSTALL_VERSION -g &>> ~/provision.log
else
echo "Npm is already at the desired version ($INSTALL_VERSION)"
fi
echo "Accepting Oracle licence and installing Java 8"
echo debconf shared/accepted-oracle-license-v1-1 select true |
sudo debconf-set-selections &>> ~/provision.log
echo debconf shared/accepted-oracle-license-v1-1 seen true |
sudo debconf-set-selections &>> ~/provision.log
sudo apt-get install -y oracle-java8-installer &>> ~/provision.log
if [ "$1" != "TRUE" ]; then
echo "Installing development environment"
cd /vagrant; npm install
else
echo "You need to manually install development environment"
fi

6
lerna.json Normal file
Просмотреть файл

@ -0,0 +1,6 @@
{
"packages": [
"packages/*"
],
"version": "independent"
}

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

@ -1,7 +0,0 @@
---
ip: "192.168.50.10"
memory: 2048
#push.app:
#push.dir:

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

@ -9,7 +9,7 @@
{
"name": "auth-server db mysql PORT 8000",
"script": "_scripts/auth_mysql.sh",
"cwd": "fxa-auth-db-mysql",
"cwd": "packages/fxa-auth-db-mysql",
"env": {
"NODE_ENV": "dev"
},
@ -19,7 +19,7 @@
{
"name": "auth-server local mail helper",
"script": "test/mail_helper.js",
"cwd": "fxa-auth-server",
"cwd": "packages/fxa-auth-server",
"env": {
"NODE_ENV": "dev"
},
@ -29,7 +29,7 @@
{
"name": "auth-server key server PORT 9000",
"script": "bin/key_server.js",
"cwd": "fxa-auth-server",
"cwd": "packages/fxa-auth-server",
"env": {
"NODE_ENV": "dev",
"IP_ADDRESS": "0.0.0.0",
@ -46,7 +46,7 @@
"args": [
"server"
],
"cwd": "fxa-content-server",
"cwd": "packages/fxa-content-server",
"env": {
"NODE_ENV": "development"
},
@ -56,21 +56,21 @@
{
"name": "fxa-basket-proxy PORT 1114",
"script": "./bin/basket-proxy-server.js",
"cwd": "fxa-basket-proxy",
"cwd": "packages/fxa-basket-proxy",
"max_restarts": "1",
"min_uptime": "2m"
},
{
"name": "fxa-basket-proxy fake basket server PORT 10140",
"script": "./bin/fake-basket-server.js",
"cwd": "fxa-basket-proxy",
"cwd": "packages/fxa-basket-proxy",
"max_restarts": "1",
"min_uptime": "2m"
},
{
"name": "oauth-server PORT 9010",
"script": "_scripts/oauth_mysql.sh",
"cwd": "fxa-auth-server/fxa-oauth-server",
"cwd": "packages/fxa-auth-server/fxa-oauth-server",
"env": {
"NODE_ENV": "dev",
"HOST": "0.0.0.0",
@ -82,7 +82,7 @@
{
"name": "profile-server PORT 1111",
"script": "_scripts/profile_mysql.sh",
"cwd": "fxa-profile-server",
"cwd": "packages/fxa-profile-server",
"max_restarts": "1",
"env": {
"NODE_ENV": "development",
@ -94,7 +94,7 @@
{
"name": "profile-server static dev PORT 1112",
"script": "bin/_static.js",
"cwd": "fxa-profile-server",
"cwd": "packages/fxa-profile-server",
"max_restarts": "1",
"env": {
"NODE_ENV": "development"
@ -104,7 +104,7 @@
{
"name": "profile-server worker PORT 1113",
"script": "bin/worker.js",
"cwd": "fxa-profile-server",
"cwd": "packages/fxa-profile-server",
"max_restarts": "1",
"env": {
"NODE_ENV": "development",
@ -115,7 +115,7 @@
{
"name": "123done PORT 8080",
"script": "server.js",
"cwd": "123done",
"cwd": "packages/123done",
"max_restarts": "1",
"env": {
"CONFIG_123DONE": "./config-local.json",
@ -126,7 +126,7 @@
{
"name": "321done UNTRUSTED PORT 10139",
"script": "server.js",
"cwd": "123done",
"cwd": "packages/123done",
"max_restarts": "1",
"env": {
"CONFIG_123DONE": "./config-local-untrusted.json",
@ -137,7 +137,7 @@
{
"name": "browserid-verifier PORT 5050",
"script": "server.js",
"cwd": "browserid-verifier",
"cwd": "packages/browserid-verifier",
"env": {
"PORT": "5050",
"IP_ADDRESS": "0.0.0.0",
@ -178,7 +178,7 @@
{
"name": "email-service PORT 8001",
"script": "scripts/run_send.sh",
"cwd": "fxa-email-service",
"cwd": "packages/fxa-email-service",
"env": {
"NODE_ENV": "dev"
},

8244
package-lock.json сгенерированный Normal file

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

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

@ -1,42 +1,59 @@
{
"name": "fxa-local-dev",
"version": "1.0.2",
"description": "An easy way to contribute to Firefox Accounts",
"name": "fxa",
"version": "2.0.0",
"description": "Firefox Accounts monorepo",
"scripts": {
"postinstall": "_scripts/postinstall.sh",
"install-extras": "_scripts/install_extras.sh",
"update": "./pm2 kill && _scripts/update_all.sh",
"start": "fxa-dev-launcher",
"start-android": "node _scripts/start-android.js",
"test": "node test/functional.js --suite=full",
"test-core": "node test/functional.js --suite=core",
"test-oauth": "node test/functional.js --suite=oauth",
"test": "lerna run test",
"config-fxios": "node _scripts/config-fxios.js"
},
"homepage": "https://github.com/mozilla/fxa-local-dev",
"homepage": "https://github.com/mozilla/fxa",
"bugs": {
"url": "https://github.com/mozilla/fxa-local-dev/issues"
"url": "https://github.com/mozilla/fxa/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/mozilla/fxa-local-dev"
"url": "https://github.com/mozilla/fxa"
},
"author": "Mozilla (https://mozilla.org/)",
"license": "MPL-2.0",
"dependencies": {
"bluebird": "2.10.2",
"chalk": "1.1.1",
"check-node-version": "3.2.0",
"foxfire": "1.1.0",
"diffparser": "^2.0.1",
"fxa-dev-launcher": "vladikoff/fxa-dev-launcher",
"internal-ip": "1.2.0",
"lodash": "4.17.10",
"minimist": "1.1.1",
"pm2": "3.0.4",
"lerna": "^3.13.1",
"node-fetch": "^2.3.0",
"pm2": "^3.4.1",
"replace-in-file": "0.2.1"
},
"engines": {
"node": ">=10",
"npm": ">=6.4.1"
},
"engines": {
"node": ">=10",
"npm": ">=6.4.1"
},
"fxa": {
"moduleDependencies": {
"fxa-content-server": [
"fxa-auth-server",
"fxa-js-client",
"fxa-shared",
"fxa-profile-server",
"fxa-oauth-server"
],
"fxa-auth-server": [
"fxa-auth-db-mysql",
"fxa-shared"
],
"fxa-js-client": [
"fxa-auth-server"
],
"fxa-profile-server": [
"fxa-auth-server"
]
}
}
}

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

@ -3,7 +3,7 @@
{
"name": "auth-server local mail helper",
"script": "test/mail_helper.js",
"cwd": "fxa-auth-server",
"cwd": "packages/fxa-auth-server",
"env": {
"NODE_ENV": "dev"
},
@ -13,7 +13,7 @@
{
"name": "auth-server db memory PORT 8000",
"script": "node_modules/fxa-auth-db-mysql/bin/mem.js",
"cwd": "fxa-auth-server",
"cwd": "packages/fxa-auth-server",
"env": {
"NODE_ENV": "dev"
},
@ -23,7 +23,7 @@
{
"name": "auth-server key server PORT 9000",
"script": "bin/key_server.js",
"cwd": "fxa-auth-server",
"cwd": "packages/fxa-auth-server",
"env": {
"NODE_ENV": "dev",
"IP_ADDRESS": "0.0.0.0",
@ -38,7 +38,7 @@
"name": "content-server PORT 3030",
"script": "node_modules/.bin/grunt",
"args": ["server"],
"cwd": "fxa-content-server",
"cwd": "packages/fxa-content-server",
"env": {
"NODE_ENV": "development"
},
@ -48,21 +48,21 @@
{
"name": "fxa-basket-proxy PORT 1114",
"script": "./bin/basket-proxy-server.js",
"cwd": "fxa-basket-proxy",
"cwd": "packages/fxa-basket-proxy",
"max_restarts": "1",
"min_uptime": "2m"
},
{
"name": "fxa-basket-proxy fake basket server PORT 10140",
"script": "./bin/fake-basket-server.js",
"cwd": "fxa-basket-proxy",
"cwd": "packages/fxa-basket-proxy",
"max_restarts": "1",
"min_uptime": "2m"
},
{
"name": "oauth-server PORT 9010",
"script": "./bin/server.js",
"cwd": "fxa-auth-server/fxa-oauth-server",
"cwd": "packages/fxa-auth-server/fxa-oauth-server",
"env": {
"NODE_ENV": "dev",
"HOST" : "0.0.0.0"
@ -73,7 +73,7 @@
{
"name": "profile-server PORT 1111",
"script": "bin/server.js",
"cwd": "fxa-profile-server",
"cwd": "packages/fxa-profile-server",
"max_restarts": "1",
"env": {
"NODE_ENV": "development",
@ -84,7 +84,7 @@
{
"name": "profile-server static dev PORT 1112",
"script": "bin/_static.js",
"cwd": "fxa-profile-server",
"cwd": "packages/fxa-profile-server",
"max_restarts": "1",
"env": {
"NODE_ENV": "development"
@ -94,7 +94,7 @@
{
"name": "profile-server worker PORT 1113",
"script": "bin/worker.js",
"cwd": "fxa-profile-server",
"cwd": "packages/fxa-profile-server",
"max_restarts": "1",
"env": {
"NODE_ENV": "development",
@ -105,7 +105,7 @@
{
"name": "123done PORT 8080",
"script": "server.js",
"cwd": "123done",
"cwd": "packages/123done",
"max_restarts": "1",
"env": {
"CONFIG_123DONE": "./config-local.json",
@ -116,7 +116,7 @@
{
"name": "321done UNTRUSTED PORT 10139",
"script": "server.js",
"cwd": "123done",
"cwd": "packages/123done",
"max_restarts": "1",
"env": {
"CONFIG_123DONE": "./config-local-untrusted.json",
@ -127,7 +127,7 @@
{
"name": "browserid-verifier PORT 5050",
"script": "server.js",
"cwd": "browserid-verifier",
"cwd": "packages/browserid-verifier",
"env": {
"PORT": "5050",
"IP_ADDRESS": "0.0.0.0",
@ -168,7 +168,7 @@
{
"name": "email-service PORT 8001",
"script": "scripts/run_send.sh",
"cwd": "fxa-email-service",
"cwd": "packages/fxa-email-service",
"env": {
"NODE_ENV": "dev"
},

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

@ -1,43 +0,0 @@
var argv = require('minimist')(process.argv.slice(2));
var chalk = require('chalk');
var suiteType = 'tests/intern_functional_full';
if (argv.suite === 'oauth') {
suiteType = 'tests/intern_functional_oauth';
}
if (argv.suite === 'core') {
suiteType = 'tests/intern_functional';
}
var COMMAND = 'node_modules/.bin/intern-runner';
var WORK_DIR = 'fxa-content-server';
var ARGS = ['config=' + suiteType];
var spawn = require('child_process').spawn;
console.log(chalk.green('Running:', COMMAND, ARGS));
var tests = spawn(COMMAND, ARGS, {
cwd: WORK_DIR
});
tests.stdout.on('data', function (data) {
process.stdout.write(chalk.green(data));
});
tests.stderr.on('data', function (data) {
process.stdout.write(chalk.red(data));
});
tests.on('close', function () {
console.log(chalk.green('Intern tests shut down...'));
});
function exit() {
console.log(chalk.green('Stopping Selenium...'));
selenium.kill();
}
process.on('SIGINT', exit);
process.on('SIGTERM', exit);