Skip to content

Commit

Permalink
merge devel -> master (#196)
Browse files Browse the repository at this point in the history
* Fix typo

* Fix popover example

* Add literature on testing

* Add example tests

* Add running instructions

* Add comments about dashboard permission (#188)

* Add few lines on permissions

* Update image link url

* Add link to code

* Fix grammar

* update and extend the managed platford docs (#194)

* Add mocking docs

* Add link to mock documentation

* Added apostrophe

* Added react testing to TOC

* update import order to put React at the top (#198)
  • Loading branch information
jshimko authored Jun 9, 2017
1 parent a4eded1 commit 644fcd0
Show file tree
Hide file tree
Showing 9 changed files with 324 additions and 43 deletions.
2 changes: 2 additions & 0 deletions admin/dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ You'll find a selection of dashboard features, broken down into two sections, Ac
- Orders - Review and process orders. For more info, visit the [Orders](https://docs.reactioncommerce.com/reaction-docs/master/orders) section.
- Accounts - Add, edit, and remove permissions for each of your shop members.

![Account Permission Screen](/assets/admin-dashboard-account-permission-screen.png)

## Settings
- Settings - Configure your shop's name, address, payment methods, and other settings.
- Catalog - Enable or disable your product catalog view.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions developer/architecture/permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ Reaction.registerPackage({
}]
});
```
At the point where Packages are published in the app, each registry item permissions are collected and put on the
package registry [(source)](https://github.com/reactioncommerce/reaction/blob/master/server/publications/collections/packages.js#L31-L56).
Based on these permissions, we can enable or disable functionality depending on user roles.
## Owner
Expand Down Expand Up @@ -167,3 +170,25 @@ Helpers in template in templates:
```
`/client/modules/core/helpers/permissions.js` exports the `hasPermission` helper.
## Reaction.Apps()
This core helper method gets all package apps that match the filter passed in. You can use this as in the example below to
get all enabled packages for payments.
```js
Reaction.Apps({
provides: "paymentMethod",
enabled: true
});
```
You can also pass in an `audience` field to filter returned apps based on assigned roles for the user.
[(source)](https://github.com/reactioncommerce/reaction/blob/master/client/modules/core/helpers/apps.js#L106-L127)
```js
Reaction.Apps({
provides: "settings",
enabled: true,
audience: Roles.getRolesForUser(Meteor.userId(), Reaction.getShopId())
})
```
2 changes: 1 addition & 1 deletion developer/components/dropDownMenu.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MyReactComponent extends Component {
selectLabel="Public"
value="private"
/>
</Menu>
</DropDownMenu>
)
}
};
Expand Down
7 changes: 1 addition & 6 deletions developer/components/popover.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ class MyReactComponent extends Component {

render() {
return (

<Popover
buttonElement={
<
}
>
<Popover>
{"My Popover"}
</Popover>
)
Expand Down
164 changes: 129 additions & 35 deletions developer/deploying/launchdock.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,57 @@
# Managed
# Managed Platform

Reaction Commerce offers managed deployments for Reaction. The `reaction-cli` incorporates functionality for any team to deploy Reaction to multiple environments.
Reaction Commerce offers managed deployments for Reaction. The `reaction-cli` incorporates functionality for any team to deploy Reaction to multiple environments. [Contact us](https://reactioncommerce.com/#get-a-demo) to get a demo or request an invite.

`Launchdock` is the name of our registration gateway for the managed platform.

## reaction register
## Register/Login

As a user of the Reaction managed platform, you'll receive an email with a `Launchdock` registration token.
As a user of the Reaction managed platform, you'll receive an email with a `Launchdock` registration token. You will be asked for this token when you register with `reaction-cli`.

**Register as a platform user**

```sh
# Register with invite token
reaction register

# or if you've already registered, login with your username and password
reaction login
```

## Apps

### Deployment

There are two ways you can deploy your apps with Launchdock. The first is by using a prebuilt image that is hosted somewhere like [Docker Hub](https://hub.docker.com/) and the second is by pushing your custom code to our build servers where they will create a custom Docker image and deploy it. Below are examples of both scenarios.

**Deploy with a prebuilt Docker image**

```sh
# Create and configure your new app deployment
reaction apps create \
--name <appname> \
--no-remote \
-e REACTION_USER="yourname" \
-e REACTION_AUTH="P@s5w0rd" \
-e REACTION_EMAIL="[email protected]" \
--registry path/to/reaction.json \
--settings path/to/settings.json

# Deploy your pre-built image
reaction deploy --name <appname> --image myorg/myapp:v1.1.0

# To deploy an updated version of your image,
# simply run the command again with your new image tag
reaction deploy --name <appname> --image myorg/myapp:v1.1.1
```

**Set up an SSH key pair to securely communicate with Launchdock**
**Deploy a custom build**

Custom builds are pushed to Launchdock using git. It's essentially the same as doing a `git push` to Github. The only difference from the commands above is you omit the `--no-remote` flag and you don't need to specify an `--image` because you'll be building a custom image. That said, there are a few more setup steps required to push custom code.

First, you will need to set up an SSH key to securely communicate with Launchdock.

Set up an SSH key pair:

```sh
# https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
Expand All @@ -35,53 +71,111 @@ ssh-add -K ~/.ssh/<private key created above>
reaction keys add ~/.ssh/<keyname>.pub
```

## reaction create

**Create an app from a prebuilt image**
Then from your Reaction project directory:

```sh
reaction apps create --name <appname> --image myorg/myapp:v1.0.0
# This adds a git remote called 'launchdock-<appname>' to your project
reaction apps create \
--name <appname> \
-e REACTION_USER="yourname" \
-e REACTION_AUTH="P@s5w0rd" \
-e REACTION_EMAIL="[email protected]" \
--registry path/to/reaction.json \
--settings path/to/settings.json

# Push your custom code and start a new build
reaction deploy --name <appname>

# To deploy an updated version of your pre-built image
reaction deploy --name <appname> --image myorg/myapp:v1.1.0
# To build/deploy an updated version of your code,
# commit changes to your current branch
git commit -m "updated some code"
# and run the deploy command again
reaction deploy --name <appname>
```

**Or run a custom build**
### Configuration

**Environment Variables**

```sh
# (Must be in a Reaction project dir. This adds a git remote called 'launchdock-<appname>' to your project)
reaction apps create --name <appname>
# Push your custom code and start a build
reaction deploy --name <appname>
# set/update environment variables
# (this triggers a redeploy of your app)
reaction env set \
--app <appname> \
-e SOME_API_KEY="ec89jmur3jim8e34" \
-e SOME_OTHER_THING="dj8dr34ju3r@#$" \
-e MAIL_URL="smtp://USERNAME:PASSWORD@NEW_HOST:PORT"

# unset environment variables
# (this triggers a redeploy of your app)
reaction env unset --app <appname> -e SOME_API_KEY -e SOME_OTHER_THING

# list your currently set environment variables
reaction env list --app <appname>
```

## reaction deploy
**Domains**

```sh
# Push your custom code and start a build
reaction deploy --name <appname>
# add a custom domain for your app
# (first, update your DNS to point your domain at your app's default URL)
reaction domains add --app <appname> -d mycoolshop.com

# remove a custom domain from your app
reaction domains remove --app <appname> -d mycoolshop.com

# list your apps and their domains
reaction apps list
```

**Example deployment**
## Basic Example

An example deployment with a custom smtp server and preconfigured settings deploying the latest Reaction image from Docker Hub.
Below is an example deployment using the latest official Reaction image from [Docker Hub](https://hub.docker.com/) and only setting the minimum required settings.

```sh
reaction apps create --name demo
reaction env set \
--app demo \
-e REACTION_EMAIL="[email protected]" \
-e REACTION_USER="Administrator" \
-e REACTION_AUTH="PaSSw0Rd" \
-e MAIL_URL="smtp://USERNAME:PASSWORD@HOST:PORT"
# create the app
reaction apps create \
--name simple-demo \
--no-remote \
-e REACTION_USER="yourname" \
-e REACTION_AUTH="P@s5w0rd" \
-e REACTION_EMAIL="[email protected]"

# deploy a Docker image
reaction deploy --app simple-demo --image reactioncommerce/reaction:latest

# open your app in your browser
reaction open simple-demo
```

## Full Example

reaction deploy \
--name demo \
--image reactioncommerce/reaction:latest \
--registry ../config/reaction.json \
--settings ../config/settings.json
Below is a more complete example that sets up a SMTP mail server URL (for app emails), imports [Reaction registry](https://docs.reactioncommerce.com/reaction-docs/master/registry) settings and [Meteor settings](https://docs.meteor.com/api/core.html#Meteor-settings), and deploys the latest official Reaction image. Then we update the app with an API key environment variable. And finally, we add a custom domain to the app and open it in our browser.

reaction domains add -a demo -d demo.yourdomain.com
reaction open -n demo
```sh
# create the app
reaction apps create \
--name full-demo \
--no-remote \
-e REACTION_USER="yourname" \
-e REACTION_AUTH="P@s5w0rd" \
-e REACTION_EMAIL="[email protected]" \
-e MAIL_URL="smtp://USERNAME:PASSWORD@NEW_HOST:PORT" \
--registry private/settings/reaction.json \
--settings settings/settings.json

# deploy a Docker image
reaction deploy --app full-demo --image reactioncommerce/reaction:latest

# set/update an environment variable
reaction env set --app full-demo -e SOME_API_KEY="<secret API key>"

# add a custom domain
reaction domains add --app full-demo --domain mycoolshop.com

# list your apps to confirm your configuration, URL's, etc.
reaction apps list

# open your app in your browser
reaction open full-demo
```
3 changes: 2 additions & 1 deletion developer/styleguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ A couple of notable Reaction specific style rules:
* Well spaced function
* 160 character line length
* `import` order
* npm packages
* React npm packages (`React`, `prop-types`, etc...)
* other npm packages
* meteor core packages
* meteor (Atmosphere) packages
* local app files
Expand Down
Loading

0 comments on commit 644fcd0

Please sign in to comment.