-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from appvia/update-readme
Update readme, add sample app definition
- Loading branch information
Showing
3 changed files
with
70 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,55 @@ | ||
# wf-example-app | ||
An example app to demonstrate using Wayfinder for PR previews and deployment | ||
|
||
To use this example, generate an access token in your workspace and add as a secret: | ||
An example app to demonstrate using Wayfinder for ephemeral PR previews and deploying to a | ||
long-lived environment on merge. | ||
|
||
The main branch of this repository deploys to https://ui-prod-wfexam9lvp.demo.wayfinder.run/ | ||
|
||
## Using the example | ||
|
||
### 1. Create the app in Wayfinder | ||
|
||
Create an application in your workspace in Wayfinder. To get going quickly, edit the manifests in | ||
the app folder, then apply to your workspace: | ||
|
||
``` | ||
wf use workspace wsp1 | ||
wf apply -f ./app | ||
``` | ||
|
||
### 2. Create an access token to permit GitHub access to your workspace | ||
|
||
Create an access token in your workspace and add as a GitHub secret for your repository: | ||
``` | ||
wf use workspace ws1 | ||
wf create workspaceaccesstoken wf-example-app-ghactions --reset-token --show-token | gh secret set WAYFINDER_TOKEN -R appvia/wf-example-app -a actions | ||
wf create workspaceaccesstoken wf-example-app-ghactions --show-token | gh secret set WAYFINDER_TOKEN -R appvia/wf-example-app -a actions | ||
``` | ||
|
||
Permission the token: | ||
* Add cluster.deployment on an existing cluster to host the PR environments (e.g. demo-envs) - note the name of the cluster | ||
* Add workspace.appdeployer and workspace.appmanager roles | ||
### 3. Create a cluster to host your PR previews and live environments | ||
|
||
If you don't already have a cluster in your workspace that you wish to use, create a cluster | ||
choosing an appropriate plan. | ||
|
||
Note the name of the cluster, we'll need it below. | ||
|
||
### 4. Permission the access token to use this cluster | ||
|
||
Configure other variables, adjust the values as appropriate for your app, environment, and PR preview cluster: | ||
* Add workspace.appdeployer and workspace.appmanager roles - this allows the token to create | ||
ephemeral environments and deploy to them. | ||
* Add cluster.deployment on the cluster you wish to host the PR preview environments. This allows | ||
the token to deploy to any environment on the PR preview cluster. | ||
* Add namespace.deployment on the cluster namespace you wish to host the long-lived 'prod' | ||
environment (not needed if using the same cluster as above) | ||
* Add cluster.deployment.readonly on the cluster you wish to host the long-lived 'prod' environment | ||
(not needed if using the same cluster as above) | ||
|
||
### 5. Configure supporting variables in GitHub for the workflows: | ||
|
||
Adjusting as needed for your application, create variables for the workflow: | ||
``` | ||
gh variable set WAYFINDER_WORKSPACE -r appvia/wf-example-app --body ws1 | ||
gh variable set WAYFINDER_SERVER -r appvia/wf-example-app --body https://api-wayfinder.myorg.io | ||
gh variable set APP_NAME -r appvia/wf-example-app --body wfexampleapp | ||
gh variable set APP_COMPONENT_NAME -r appvia/wf-example-app --body ui | ||
gh variable set PR_PREVIEW_CLUSTER -r appvia/wf-example-app --body demo-envs | ||
gh variable set LIVE_ENV_NAME -r appvia/wf-example-app --body prod | ||
``` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: app.appvia.io/v2beta1 | ||
kind: Application | ||
metadata: | ||
name: wfexampleapp | ||
spec: | ||
cloud: azure | ||
name: wfexampleapp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: app.appvia.io/v2beta1 | ||
kind: AppComponent | ||
metadata: | ||
name: wfexampleapp-ui | ||
spec: | ||
application: wfexampleapp | ||
container: | ||
containers: | ||
- image: ghcr.io/appvia/wf-example-app/wfexample | ||
name: container-1 | ||
ports: | ||
- containerPort: 8080 | ||
name: ui | ||
protocol: TCP | ||
expose: | ||
container: container-1 | ||
port: 8080 | ||
replicas: 1 | ||
tls: true | ||
key: ui | ||
name: ui | ||
type: Container |