зеркало из https://github.com/mozilla/fxa.git
58f184f306
[skip ci] Because: * We want to properly name cache vs. databases. * We want to add the GraphQL API to the list of services. This commit: * Renames the database resources to cache resources. * Adds the GraphQL API to the list of services. |
||
---|---|---|
.. | ||
ansible | ||
scripts | ||
static | ||
.eslintrc.json | ||
.nsprc | ||
.prettierignore | ||
Procfile | ||
README.md | ||
backstage.yaml | ||
config-local-untrusted.json | ||
config-local.json | ||
config-stage-untrusted.json | ||
config.js | ||
config.json | ||
oauth.js | ||
package.json | ||
pm2.config.js | ||
server.js | ||
version.js |
README.md
A demo of Firefox Accounts OAuth
Running locally
- Complete prerequisites for running FxA
- Create a
secrets.json
file in 123done root folder and specify theclient_secret
value. - Run the server:
yarn start
- Visit it in your browser:
http://localhost:8080/
- Hack and reload! (web resources don't require a server restart)
Ansible Deployment
See fxa-dev 123done Ansible configuration for details.
Heroku Deployment
Before you begin
- This process is to deploy an existing FxA-integrated Heroku application. Separate steps are required to create a new Heroku app integrated with FxA, including updating the client URL redirect values in the FxA OAuth database.
- Unless your tests require the untrusted 123Done app, you may just need to deploy the 123Done trusted app to stage and prod (i.e. deploy two instead of all four apps).
Instructions
- Sign up for Heroku at https://sso.heroku.com/login
- Note: You must be part of the Mozilla SSO
heroku-members
access group, otherwise you'll get a message "Unable to locate an identity provider. Please check your email address."- File a bug like this one: https://bugzilla.mozilla.org/show_bug.cgi?id=1830343
- You can see who is a Curator with add permissions here: https://people.mozilla.org/a/heroku-members/.
- There are some additional one-time steps to complete as referenced in the Access Group invitation email.
- Install heroku cli and login
heroku login
- Ensure access to 123Done apps
- Search for and have a
mozillacorporation
member grant access (view, deploy, operate, manage) to following apps:production-123done
production-123done-untrusted
stage-123done
stage-123done-untrusted
- You'll get an invitation email for each app.
- Why are there four apps?
- There is a trusted and an untrusted OAuth RP app for each environment to test trusted and untrusted OAuth flows.
- Clone each app on the command line that you need to deploy with the provided instructions in the invitation email.
- E.g.
heroku git:clone -a stage-123done
- Note: While app config for stage is in the 123Done package in our FxA monorepo, prod config is in environment variables in the Heroku dashboard to avoid exposing the OAuth client secret.
- Deploy app
- In the
fxa
repo, checkout branchorigin/heroku-updates
and create and checkout a local branch of the same name.- This branch contains different root level
package.json
commands and/or (dev)dependencies that reduce the size of the Heroku deploy slug. There are limits to the size that can be deployed. - The main differences are the
install
run script and to avoid thecheck-package-manager.sh
script, since the command usesnpm
instead ofyarn
.- Note: Heroku is compatible with
yarn
, but at the time of writing, onlynpm
worked correctly.
- Note: Heroku is compatible with
- This branch contains different root level
- Rebase
train-XXX
branchgit rebase origin/train-XXX
XXX
is the train for the environment you want to deploy in.
- Create a remote for your local repository for each app you want to deploy.
- E.g.
heroku git:remote -a stage-123done
- E.g.
- Deploy
git push <heroku remote origin> heroku-updates:main -f
- Force push is needed here because of the commit with changes to
package.json
<heroku remote origin>
is the git remote linked to the version of the heroku app you're deploying, i.e. stage/production and trusted/untrusted.- N.B. There may have been breaking changes to the
fxa
rootpackage.json
since the last 123Done deploy. Confer with the team, but if needed, the rootpackage.json
can be modified and the last commit amended. Then retry the command.
- Force push is needed here because of the commit with changes to
- Push changes to back to FxA repo
git push origin heroku-updates -f
Testing
This package does not currently have a test suite.
Run npm test
to lint the code.