Skip to content

Commit

Permalink
deploy docs
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotBraem committed Apr 15, 2024
1 parent 5168943 commit ca7b6e4
Show file tree
Hide file tree
Showing 12 changed files with 783 additions and 16 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,14 @@ yarn run dev
```

This will start a gateway at [127.0.0.1:8080](http://127.0.0.1:8080) which will render your local widgets. The entry point for this app is [docs.bos-workspace.testnet/widget/index](http://127.0.0.1:8080/docs.bos-workspace.testnet/widget/index)

## Adding documents

Currently, the process is:

1. Write your document in the [/md](./md/) directory
2. Add the reference in [utils/db](./widget/utils/db.js), this will get picked up by the sidebar
3. Confirm section/subsection matches path after `/md`
4. Push to branch (configure branch in [github adapter](./widget/PR/adapter/github.jsx)) to see updates.

Let's build better!
19 changes: 19 additions & 0 deletions md/getting_started/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Installation 🏗️

You can install `bos-workspace` globally on your machine or within your existing project workspace using npm (or other package manager):

global install:

```cmd
npm -g install bos-workspace
```
or navigate to your project directory and install:

```cmd
npm install bos-workspace
```
To verify `bos-workspace` in installed, you can check for a current version:

```cmd
bos-workspace -V
```
46 changes: 46 additions & 0 deletions md/usage/aliases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# aliases

## Account

The main acount in `bos.config.json`, can be replaced via `overrides`.

pattern: `{CONFIG_ACCOUNT}`

## Overrides

Aliases from bos.config.json are used to replace comments with correct values, useful for widget sources.

Pattern: `${ALIAS_KEY}`

```json
{
"account": "[MAINNET_ACCOUNT_ID]",
"aliases": ["./aliases.mainnet.json"],
"overrides": {
"testnet": {
"account": "[TESTNET_ACCOUNT_ID]",
"aliases": ["./aliases.testnet.json"]
}
}
}
```

with the jsons:

`aliases.mainnet.json`

```json
{
"devs": "devs.near"
}
```

`aliases.testnet.json`

```json
{
"devs": "neardevs.testnet"
}
```

Replace all account and contract references with their network alternatives. If alternatives do not exist, we can add to [mainnet-on-testnet](https://github.com/NEARBuilders/mainnet-on-testnet)
8 changes: 0 additions & 8 deletions md/usage/configure_testnet.md

This file was deleted.

79 changes: 79 additions & 0 deletions md/usage/deploy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Deploy

command: `deploy`

Deploy an app in the workspace

## Usage (CLI)

Deploy the project with the option to specify an app name (must be name of the folder in /apps directory):

```cmd
bos-workspace deploy [app name]
```

[lib/deploy.ts](https://github.com/NEARBuilders/bos-workspace/blob/main/lib/deploy.ts)
// TODO: embed github code block @hyperfiles.near

[UNDER CONSTRUCTION]
[TASK: Implement deploy command](https://github.com/NEARBuilders/bos-workspace/issues/77)
@ittechhunter.near
@bos-workspace.near

## Configuring environments

### Prerequisites

1. Must be upgraded to bos-workspace v1, see the [migration guide](?page=getting_started/migration_guide)
2. Specify testnet [overrides + aliases](?page=usage/aliases) in bos.config.json.


### Mainnet

1. Create `.github/workflow/release-mainnet.yml`

```yml
name: Deploy Components to Mainnet
on:
push:
branches: [main]
jobs:
deploy-mainnet:
uses: NEARBuilders/bos-workspace/.github/workflows/deploy.yml@main
with:
bw-legacy: false
deploy-env: "mainnet"
app-name: "[APP_NAME]"
deploy-account-address: "[DEPLOY_ACCOUNT]"
signer-account-address: "[DEPLOY_ACCOUNT]"
signer-public-key: [PUBLIC_KEY]
secrets:
SIGNER_PRIVATE_KEY: ${{ secrets.SIGNER_PRIVATE_KEY }} // then configure this in your Github/Settings/Actions
```
### Testnet
1. Create `.github/workflow/release-testnet.yml`

```yml
name: Deploy Components to Testnet
on:
push:
branches: [develop]
jobs:
deploy-mainnet:
uses: NEARBuilders/bos-workspace/.github/workflows/deploy.yml@main
with:
bw-legacy: false
build-env: "testnet"
deploy-env: "testnet"
app-name: "[APP_NAME]"
deploy-account-address: "[DEPLOY_ACCOUNT]" // testnet account
signer-account-address: "[DEPLOY_ACCOUNT]"
signer-public-key: [PUBLIC_KEY]
secrets:
SIGNER_PRIVATE_KEY: ${{ secrets.SIGNER_PRIVATE_KEY }} // then configure this in your Github/Settings/Actions
```


Reference: [quickstart](https://github.com/nearbuilders/quickstart)
37 changes: 37 additions & 0 deletions md/usage/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Usage 👷🏽‍♀️

You can use your `bos-workspace` for both single and multi app development by taking advantage of the relationship between `Apps` and `Workspaces`

**App:** 🛠️
- belongs to an Account
- described by a `bos.config.json` where the content is:
```
{
"account": "app.near"
}
```

- path to code: `{projectId}/widget/*`
- cloning: `bos-workspace clone {accountId}` to create an App with `bos.config.json` set up and pull in all of the widgets from that `accountId`
<br><br>

*Sample directory structure*

<img src="sample_app_structure.png" alt="sample app structure" width="75%">
<br><br>

**Workspace:** 🛠️
- able to hold multiple Apps at the same time (similar to a monrepo)
- described by a `bos.workspace.json` where the content is:
```
{
"apps": ["/apps/*"]
}
```
<br>
*Sample directory structure*

<img src="sample_workspace_structure.png" width="75%">
<br><br>

📝 **Note:** App names are not required to end in `.near` or be stored in a directory named `/apps`. Be sure your `bos.config.json` is located at the same level as directories like `/widget` and your `bos.workspace.json` reflects the name of the directory where your apps are located
2 changes: 1 addition & 1 deletion widget/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ return (
<div className="header">
<div className="branding">
<Link to={`/${basePath}`} className="link">
<h3>bos-workspace</h3>
<h3>everything.dev</h3>
</Link>
</div>

Expand Down
Loading

0 comments on commit ca7b6e4

Please sign in to comment.