Skip to content

Commit

Permalink
Add Jifs to show how to deploy plugins to production S3
Browse files Browse the repository at this point in the history
  • Loading branch information
Xantier committed Jul 26, 2023
1 parent 613c472 commit 0d824aa
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 22 additions & 6 deletions content/docs/custom-plugins/deploying/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ OR
roadie plugin:build --package @roadiehq/backstage-plugin-prometheus --host https://static-assets.roadie.so/<my-tenant>/prometheusPlugin
```

> Important! The value for 'host' that is defined during build time needs to match the actual final hosting location where the plugin assets can be found after they have been uploaded.

### Available options for `plugin:build` command:

| Option | Name | Description | Example |
Expand All @@ -44,31 +47,44 @@ roadie plugin:build --package @roadiehq/backstage-plugin-prometheus --host https

### Deploying the plugin to Roadie

Roadie provides a hosting solution which allows you to deploy your developed plugin code to secure Roadie infrastructure. The assets produced by the build process are secured using the same access control methods as the rest of the Roadie application. To be able to do this you need to have access to upload your produced assets to the relevant S3 buckets where Roadie can receive and serve them. To get relevant credentials, contact Roadie via Slack or other support channels.
Roadie provides a hosting solution which allows you to deploy your developed plugin code to secure Roadie infrastructure. The assets produced by the build process are secured using the same access control methods as the rest of the Roadie application. To be able to do this you need to have access to upload your produced assets to the relevant S3 buckets where Roadie can receive and serve them.

> To get relevant credentials, contact Roadie via Slack or other support channels.
Roadie CLI has a built-in command to automatically upload the files to the correct location. This can be configured to be done for example within your CI/CD pipeline. Once the assets are uploaded, they are immediately available to be used on your Roadie instance.

To build a plugin and deploy it to the static assets hosting solution provided by Roadie, you can run the following command:

```bash
export S3_BUCKET_NAME=roadie-static-assets
export S3_BUCKET_PREFIX=<my-tenant>/my_custom_plugin
export S3_BUCKET_PREFIX=<my-tenant>
roadie plugin:build --location ~/Development/my-roadie-plugins/my-custom-plugin-folder/ --host https://static-assets.roadie.so/<my-tenant>/my_custom_plugin --withUpload
```

Where `<my-tenant>` is replaced by your tenant name and `my_custom_plugin` is replaced by the name of your plugin (this is autogenerated from the name defined in the package.json file of the plugin).
Where `<my-tenant>` is replaced by your tenant name and `my_custom_plugin` is replaced by the name of your plugin (this is autogenerated from the name defined in the package.json file of the plugin).

After the plugin has been uploaded to static hosting, you can follow the documentation on [how to register individual plugins to Roadie for the next steps](/docs/custom-plugins/plugin-registration/).


#### Using the Roadie monorepo structure

![A gif displaying how to deploy plugins to S3 using monorepo helpers scripts](deploying_to_s3.gif)

#### Using the Roadie CLI

![A gif displaying how to deploy plugins to S3 using Roadie CLI](deploying_to_s3_cli.gif)


### How do I know which URL to use for the location argument?

If you are building the plugin to be hosted on Roadie, your URL takes the following format:
`https://static-assets.roadie.so/<my-tenant>/myCustomPlugin`
When building the plugin for deployment, the most difficult step is usually identifying the correct value for the `--host` argument. If you are building the plugin to be hosted on Roadie, your URL takes the following format:
`https://static-assets.roadie.so/<my-tenant>/my_custom_plugin`

* Roadie's hosting solution uses a URL `static-assets.roadie.so` to expose these plugins from various origins.
* You should replace the `<my-tenant>` block with your tenant name. You can find this from your roadie URL. E.g. `https://demo.roadie.so` -> Tenant name is `demo`
* The ending (like `myCustomPlugin` above) defines the actual root of the plugin and is usually named after the plugin itself.
* The ending (like `my_custom_plugin` above) defines the actual root of the plugin and is usually named after the plugin itself.

Usually you can identify the value of the host by looking at the output when running Roadie CLI in development mode. The default setting for the produced output folder will be the same as the `scope` value that Roadie CLI outputs.

If you are hosting the plugin yourself, the URL used in the location argument should match the location where the plugin is reachable from.

Expand Down

0 comments on commit 0d824aa

Please sign in to comment.