Skip to content

Commit

Permalink
Cleaning Up Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
manifestinteractive committed May 14, 2023
1 parent c38896f commit 77f2632
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 56 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
github: sfccdevops
patreon: peter_schmalfeldt
custom: https://www.paypal.me/manifestinteractive
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ Getting Setup

> Download the source code and follow these instructions to get setup:
[![Download](https://img.shields.io/badge/Download-blue.svg?logo=github&style=for-the-badge)](https://github.com/sfccdevops/sandbox-launchd/releases/latest)
[![Download](https://img.shields.io/badge/Download-121212.svg?logo=github&style=for-the-badge)](https://github.com/sfccdevops/sandbox-launchd/releases/latest)

### Installation Steps

1. [Install SFCC-CI](docs/install-sfcc-ci.md)
2. [Create API Client](docs/create-api-client.md)
Expand All @@ -34,16 +36,18 @@ Getting Setup
5. [Fetch Sandbox UUID](docs/fetch-sandbox-uuid.md)
6. [Install Launch Agents](docs/install-launch-agents.md)

[![Get Started](https://img.shields.io/badge/First_Step-1aa0db.svg?logo=github&style=for-the-badge)](docs/install-sfcc-ci.md)

### Extra Goodies

If you happen to use [Alfred](https://www.alfredapp.com) on your computer, we are also releasing a [Custom Workflow](./Sandbox.alfredworkflow) that allows you to Start & Stop your Sandbox, as well as use your mobile device to trigger your workflow remotely.
If you happen to use [Alfred](https://www.alfredapp.com) on your computer, we are also releasing a [Custom Workflow](https://github.com/sfccdevops/sandbox-launchd/raw/main/Sandbox.alfredworkflow) that allows you to Start & Stop your Sandbox, and use your mobile device to trigger your workflow remotely.

[![Alfred Workflow](https://img.shields.io/badge/Alfred_Workflow-5C1F87.svg?logo=alfred&logoColor=white&style=for-the-badge)](docs/alfred-workflow.md)

Contributing
---

> Interested in making this tool better? Fork this Repository and we'll gladly accept Pull Requests.
> Are you interested in making this tool better? Fork this Repository, and we'll gladly accept Pull Requests.
[![Contribution Guide](https://img.shields.io/badge/Contribution_Guide-EEEEEE.svg?logo=github&logoColor=black&style=for-the-badge)](https://github.com/sfccdevops/sandbox-launchd/blob/develop/.github/CONTRIBUTING.md)

Expand All @@ -55,4 +59,4 @@ About the Author
Disclaimer
---

> The trademarks and product names of Salesforce®, including the mark Salesforce®, are the property of Salesforce.com. SFCC DevOps is not affiliated with Salesforce.com, nor does Salesforce.com sponsor or endorse the SFCC DevOps products or website. The use of the Salesforce® trademark on this project does not indicate an endorsement, recommendation, or business relationship between Salesforce.com and SFCC DevOps.
> The trademarks and product names of Salesforce®, including the mark Salesforce®, are the property of Salesforce.com. SFCC DevOps is not affiliated with Salesforce.com, nor does Salesforce.com sponsor or endorse the SFCC DevOps products or website. The use of the Salesforce® trademark on this project does not indicate an endorsement, recommendation, or business relationship between Salesforce.com and SFCC DevOps.
16 changes: 8 additions & 8 deletions bin/boot-shutdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

function shutdown()
{
# Send Shutdown Signal to Sandbox in Background
~/.sfccdevops/sdx-stop
exit 0
# Send Shutdown Signal to Sandbox in Background
~/.sfccdevops/sdx-stop
exit 0
}

function startup()
{
# Send Startup Signal to Sandbox in Background
~/.sfccdevops/sdx-start
# Send Startup Signal to Sandbox in Background
~/.sfccdevops/sdx-start

tail -f /dev/null &
wait $!
tail -f /dev/null &
wait $!
}

trap shutdown SIGTERM
trap shutdown SIGKILL

startup;
startup;
8 changes: 5 additions & 3 deletions docs/adding-environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
Adding Environment Variables
===

> We'll need the following Environmental Variables to be set before things will work.
> We'll need the following Environmental Variables to be set before things will work.
Add these under the existing `export` in your `~/.zshrc`
Add the following under the existing exports listed in your `~/.zshrc`

```bash
# SFCC CI Variables
# SFCC-CI Variables
export SFCC_OAUTH_CLIENT_ID="1a2b3c4d-5e6f-7g8h-9i0j-1k2l3m4n5o6p"
export SFCC_OAUTH_CLIENT_SECRET="my^super*secret+password"
export SFCC_SANDBOX_ID=""
```

### What do these do?

* `SFCC_OAUTH_CLIENT_ID` - This is your "API Client" that was generated earlier
* `SFCC_OAUTH_CLIENT_SECRET` - This is the password you entered earlier
* `SFCC_SANDBOX_ID` - We'll be getting this in a few steps
Expand Down
6 changes: 3 additions & 3 deletions docs/alfred-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Alfred Workflow
Installation
---

[![Download Workflow](https://img.shields.io/badge/Download_Workflow-5C1F87.svg?logo=alfred&logoColor=white&style=for-the-badge)](../Sandbox.alfredworkflow)
[![Download Workflow](https://img.shields.io/badge/Download_Workflow-5C1F87.svg?logo=alfred&logoColor=white&style=for-the-badge)](https://github.com/sfccdevops/sandbox-launchd/raw/main/Sandbox.alfredworkflow)

### Usage

Expand All @@ -22,12 +22,12 @@ Installation

1. Open Alfred
2. Click Remote Icon in Left Column
3. Click the `[+]` button at bottom of list to add a New Remote
3. Click the `[+]` button at the bottom of the list to add a New Remote
4. Select: `Workflows` > `Sandbox` > `Sandbox`
5. You can now manage your sandbox from your phone ;)

`*` **NOTE:** You will need a Powerpack license for this. It's 100% worth it ;)

---

[![README](https://img.shields.io/badge/README-121212.svg?logo=github&style=for-the-badge)](../README)
[![README](https://img.shields.io/badge/README-121212.svg?logo=github&style=for-the-badge)](../README.md)
22 changes: 12 additions & 10 deletions docs/create-api-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,32 @@
Create API Client
===

If you have not already created your API Client ID, you'll need to do that to use this tool:
> If you have not already created your API Client ID, you'll need to do that to use this tool.
Sorry in advance for this one. It's a beast, but you only have to do it once ;)

1. Visit the [API Client](https://account.demandware.com/dw/account/APIAdmin) Tab on your SFCC [Account Manager](https://account.demandware.com/dw/account/Home) `*`
2. Click `Add API Client` button in top right
3. For `Display Name` enter something that identifies your sandbox, e.g. `ods-jane-doe`
4. For `Description` write something helpful, e.g. `ODS API User for Jane Doe`
2. Click `Add API Client` button in the top right
3. For `Display Name`, enter something that identifies your Sandbox, e.g., `ods-jane-doe`
4. For `Description`, write something helpful, e.g., `ODS API User for Jane Doe`
5. Enter a secure password for `Password` ( this is your `SFCC_OAUTH_CLIENT_SECRET` )
6. For `Access Control` check the `Enabled` checkbox
6. For `Access Control`, check the `Enabled` checkbox
7. Click the `Add` button on `Organizations`
8. Select the checkbox next to your Organization name
8. Select the checkbox next to your Organization's name
9. Click the `Add` button to Assign the Organization
10. Click the `Add` button on `Roles`
11. Select the checkbox for `Sandbox API User`
12. Click the `Add` button to Assign the Role
13. Click the Filter Icon to the right of `No role scope defined`
13. Click the Filter Icon to the right of the `No role scope defined`
14. Select your Organization from the list
15. Choose your Sandbox from the select list
16. Click the `Add` button to add your Sandbox as a Sandbox API User
17. Set `Token Endpoint Auth Method` to `client_secret_post`
18. Set `Access Token Format` to `UUID - Deprecated. JWT recommended`
19. You an leave everything else with default settings
19. You can leave everything else with default settings
20. Press `Save`

After Saving, you will be taken back to the list of API Clients ID's. Find the one you just created and open it. At the top of the page you will see your `API Client`
After Saving, you will be returned to the API Clients ID list. Find the one you just created and open it. At the top of the page, you will see your `API Client`.

*Screenshot:*

Expand All @@ -44,4 +46,4 @@ After Saving, you will be taken back to the list of API Clients ID's. Find the

---

[![Previous Step](https://img.shields.io/badge/Previous-121212.svg?logo=github&style=for-the-badge)](./install-sfcc-ci.md)   [![Next Step](https://img.shields.io/badge/Next_Step-1aa0db.svg?logo=github&style=for-the-badge)](./adding-environment-variables.md)
[![Previous Step](https://img.shields.io/badge/Previous-121212.svg?logo=github&style=for-the-badge)](./install-sfcc-ci.md)   [![Next Step](https://img.shields.io/badge/Next_Step-1aa0db.svg?logo=github&style=for-the-badge)](./adding-environment-variables.md)
6 changes: 3 additions & 3 deletions docs/fetch-sandbox-uuid.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ Fetch Sandbox UUID

> Now that we've verified everything is working with SFCC-CI, we can get our Sandbox UUID.
Let's get a list of sandboxes our API Client ID has permission to access:

```bash
# Verify we can see a list of sandboxes
sfcc-ci sandbox:list
```

Using the table that was generated in the command above, look for your sandbox number in the `instance` column. For example, if your sandbox starts with `abcd-001` your `instance` will be `001`.
Using the table generated in the command above, look for your sandbox number in the `instance` column. For example, if your sandbox starts with `abcd-001` your `instance` will be `001`.

Copy the `id` from the `id` column for your sandbox.

Now we can paste our Sandbox UUID as the value for `SFCC_SANDBOX_ID` in our `~./zshrc` file.

```bash
# UUID of Sandbox
export SFCC_SANDBOX_ID="9p8o7n6m-5l4k-3j2i-1h0g-9f8e7d6c5b4a"
```

Expand Down
Binary file modified docs/img/create-client-id.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/img/security-background-items.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/img/security-login-items.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 10 additions & 7 deletions docs/install-launch-agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,35 @@ Install Launch Agents

> All we have left to do now is install the Launch Agents to handle starting & stopping your sandbox.
Make sure you are in the root of this project, and run the installer:

```bash
# Run Installer
./install
```

Security Overview
---

> Your companies IT Department might want to know a few things about what this tool is doing.
> Your IT Department might want to know a few things about what this tool is doing.
### Overview

**NOTE:** This tool does not require a superuser or root level access to install.
**NOTE:** This tool does not require a superuser or root-level access to install.

Our [./install](../install) script does the following:

1. Uses [Homebrew](https://brew.sh) to install [sleepwatcher](https://formulae.brew.sh/formula/sleepwatcher) to add event listeners for Awake & Sleep states
2. Adds [sdx-start](../bin/sdx-start) bash script to start a Sandbox after a computer boots or wakes up
3. Adds [sdx-stop](../bin/sdx-stop) bash script to stop a Sandbox when computer shuts down or goes to sleep
2. Adds [sdx-start](../bin/sdx-start) bash script to start a Sandbox after the computer boots or wakes up
3. Adds [sdx-stop](../bin/sdx-stop) bash script to stop a Sandbox when the computer shuts down or goes to sleep
4. Adds [boot-shutdown](../bin/boot-shutdown) bash script to call above scripts on shutdown and boot
5. Adds [com.sfccdevops.sleepwatcher.plist](../launchd/com.sfccdevops.sleepwatcher.plist) Launch Agent for Sleepwatcher events
6. Adds [com.sfccdevops.sandbox.plist](../launchd/com.sfccdevops.sandbox.plist) Launch Agent for Boot and Shutdown events

### Installation Prompts

After running the installer, you will see a notice for a new Background Items entry for [boot-shutdown](../bin/boot-shutdown). This was registered by the [com.sfccdevops.sandbox.plist](../launchd/com.sfccdevops.sandbox.plist) launch agent when we requested to be notified when the computer started up, or is about to shut down.
After running the installer, you will see a notice for a new `Background Items Added` entry for [boot-shutdown](../bin/boot-shutdown). This was registered by the [com.sfccdevops.sandbox.plist](../launchd/com.sfccdevops.sandbox.plist) Launch Agent when we requested to be notified as the computer started or was about to shut down.

Clicking this notice will open the Login Items, where our [boot-shutdown](../bin/boot-shutdown) script is listed.

![background-items](./img/security-background-items.png "background-items")

Expand All @@ -42,4 +45,4 @@ Clicking this notice will open the Login Items, where you will see our [boot-shu

---

[![Previous Step](https://img.shields.io/badge/Previous-121212.svg?logo=github&style=for-the-badge)](./fetch-sandbox-uuid.md)   [![Next Step](https://img.shields.io/badge/All_Done-1aa0db.svg?logo=github&style=for-the-badge)](../README)
[![Previous Step](https://img.shields.io/badge/Previous-121212.svg?logo=github&style=for-the-badge)](./fetch-sandbox-uuid.md)   [![Next Step](https://img.shields.io/badge/All_Done-1aa0db.svg?logo=github&style=for-the-badge)](../README.md)
13 changes: 10 additions & 3 deletions docs/install-sfcc-ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@
Install SFCC-CI
===

> In order to connect to our sandbox, we'll need to install Salesforce's SFCC CI tool.
> We'll need to install Salesforce's SFCC-CI tool to connect to our sandbox.
Install Salesforce Commerce Cloud CLI Globally

```bash
# Install Salesforce Commerce Cloud CLI Globally
npm install -g sfcc-ci
```

Now we can check that it was installed correctly and verify we get the help message:

```bash
sfcc-ci --help
```

---

[![Previous Step](https://img.shields.io/badge/README-121212.svg?logo=github&style=for-the-badge)](../README)   [![Next Step](https://img.shields.io/badge/Next_Step-1aa0db.svg?logo=github&style=for-the-badge)](./create-api-client.md)
[![Previous Step](https://img.shields.io/badge/README-121212.svg?logo=github&style=for-the-badge)](../README.md)   [![Next Step](https://img.shields.io/badge/Next_Step-1aa0db.svg?logo=github&style=for-the-badge)](./create-api-client.md)
13 changes: 3 additions & 10 deletions docs/test-sfcc-ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,15 @@
Test SFCC-CI
===

> We should be ready to test out that we have SFCC-CI installed correctly.
> We should be ready to test that we have SFCC-CI installed correctly.
Let's up a new terminal window and run the following commands:
Let's check that our API Client Authentication information was entered correctly:

```bash
# Login with API Client Data we just entered
sfcc-ci client:auth
```

This command should output:

```text
Authentication succeeded
```

If it didn't, head back through the first few steps and make sure you setup everything correctly.
If you did not get a response of `Authentication succeeded`, head back through the first few steps and ensure you set up everything correctly.

---

Expand Down
8 changes: 4 additions & 4 deletions launchd/com.sfccdevops.sandbox.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>Debug</key>
<true/>
<true/>
<key>Label</key>
<string>com.sfccdevops.sandbox</string>
<key>ProgramArguments</key>
Expand All @@ -13,9 +13,9 @@
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>LaunchOnlyOnce</key>
<true/>
<false/>
<key>LaunchOnlyOnce</key>
<true/>
<key>StandardOutPath</key>
<string>~/.sfccdevops/sandbox.log</string>
<key>StandardErrorPath</key>
Expand Down
2 changes: 1 addition & 1 deletion launchd/com.sfccdevops.sleepwatcher.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>Debug</key>
<true/>
<true/>
<key>Label</key>
<string>com.sfccdevops.sleepwatcher</string>
<key>ProgramArguments</key>
Expand Down

0 comments on commit 77f2632

Please sign in to comment.