Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Actions language edit #177

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

Automating these tasks is called CI/CD or continuous integration and continuous deployment.
- CI refers to testing changes to code you push to the main branch to ensure it fits in with the existing system and everything still works.
- CD refers to deploying every push to the main branch to your production (live) site.
- CD refers to deploying every push to the main branch of your production (live) site.

GitHub provides a tool for automating workflows called GitHub Actions. It provides a virtual machine in which you can run scripts to check out your code, compile it, deploy alongside FusionAuth and other services, run tests, and manage deployment.

Expand All @@ -54,11 +54,11 @@

## A Simple Example Using GitHub Actions

There is a minimal but complete CI/CD example in this <a href={frontmatter.url}>repository</a>. An overview of the set-up is shown below.
There is a minimal but complete CI/CD example in this <a href={frontmatter.url}>repository</a>. An overview of the setup is shown below.

<OverviewDiagram />

In GitHub, click <InlineUIElement>Fork</InlineUIElement> and add the repository to your GitHub account. Then run `git clone https://github.com/<your_username>/fusionauth-example-github-actions.git` in a terminal to download it. Remember to replace `<your_username>` with your actual GitHub username.
In GitHub, click <InlineUIElement>Fork</InlineUIElement> and add the repository to your GitHub account. Then run `git clone https://github.com/<your_username>/fusionauth-example-github-actions.git` in a terminal to download it. Remember to replace `<your_username>` with your GitHub username.

Below is the repository structure.

Expand Down Expand Up @@ -151,7 +151,7 @@

If you browse to FusionAuth again, you'll see that the user you created is still there.

The FusionAuth application is separate from the FusionAuth database. In this case, the database is stored in a Docker volume. When the upgrade scripts run, the data should not be broken, and upgrading FusionAuth should be unnoticeable. However, mistakes can happen, as well as database crashes, and you should backup both the FusionAuth database and your application database daily. The rest of this article will show you how to automate login tests to check that your system still works after upgrading FusionAuth or your app. If something breaks, you can restore the old version of the database and begin debugging.
The FusionAuth application is separate from the FusionAuth database. In this case, the database is stored in a Docker volume. When the upgrade scripts run, the data should not be broken, and upgrading FusionAuth should be unnoticeable. However, mistakes can happen, as well as database crashes, and you should back up both the FusionAuth database and your application database daily. The rest of this article will show you how to automate login tests to check that your system still works after upgrading FusionAuth or your app. If something breaks, you can restore the old version of the database and begin debugging.

Check failure on line 154 in astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'. Raw Output: {"message": "[Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'.", "location": {"path": "astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx", "range": {"start": {"line": 154, "column": 5}}}, "severity": "ERROR"}

Check failure on line 154 in astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'. Raw Output: {"message": "[Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'.", "location": {"path": "astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx", "range": {"start": {"line": 154, "column": 49}}}, "severity": "ERROR"}

Check failure on line 154 in astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'. Raw Output: {"message": "[Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'.", "location": {"path": "astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx", "range": {"start": {"line": 154, "column": 202}}}, "severity": "ERROR"}

Check failure on line 154 in astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'. Raw Output: {"message": "[Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'.", "location": {"path": "astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx", "range": {"start": {"line": 154, "column": 328}}}, "severity": "ERROR"}

Check failure on line 154 in astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'. Raw Output: {"message": "[Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'.", "location": {"path": "astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx", "range": {"start": {"line": 154, "column": 506}}}, "severity": "ERROR"}

For more details on upgrading FusionAuth, including non-silent upgrades, please read this [article](/docs/get-started/download-and-install/docker#upgrading).

Expand Down Expand Up @@ -232,7 +232,7 @@
By default, GitHub prevents action workflows from running on forked repositories. To grant permission for the workflow to execute, navigate to the Actions tab on your forked repository and click on the <InlineUIElement>I understand my workflows, go ahead and enable them</InlineUIElement> button on the repository.
</Aside>

In this example we'll trigger the execution of the test by listening to push events on the main branch. Open the file `.github/workflows/test.yaml` in your IDE. The fifth line in the file specifies the branch name that triggers the execution of the action when commits are pushed to it. It currently reads as follows.
In this example, we'll trigger the execution of the test by listening to push events on the main branch. Open the file `.github/workflows/test.yaml` in your IDE. The fifth line in the file specifies the branch name that triggers the execution of the action when commits are pushed to it. It currently reads as follows.

```yaml
- main_RENAME_THIS_TO_ENABLE_TEST
Expand Down Expand Up @@ -293,7 +293,7 @@
- Actions, which are existing tasks in GitHub like checking out a repository or installing Node.js.
- Custom commands, which run code directly in the machine's terminal.

This script starts by checking out your repository then installing FusionAuth and Node.js using the respective actions.
This script starts by checking out your repository, and then installs FusionAuth and Node.js using the respective actions.

Check failure on line 296 in astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'. Raw Output: {"message": "[Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'.", "location": {"path": "astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx", "range": {"start": {"line": 296, "column": 71}}}, "severity": "ERROR"}

```yaml
steps:
Expand Down Expand Up @@ -330,9 +330,9 @@
working-directory: ./app
```

Using the `fusionauth-github-action` is the preferred method to start FusionAuth in the workflow. If you want to start FusionAuth with Docker compose instead of the action you can use the commented out configuration in the `.github/workflows/test.yaml` file (for example if you need customizations such as to use a custom password hashing plugin).
Using the `fusionauth-github-action` is the preferred method to start FusionAuth in the workflow. If you want to start FusionAuth with Docker compose instead of the action, you can use the commented-out configuration in the `.github/workflows/test.yaml` file (for example, if you need customizations to use a custom password hashing plugin).

Check failure on line 333 in astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'. Raw Output: {"message": "[Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'.", "location": {"path": "astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx", "range": {"start": {"line": 333, "column": 71}}}, "severity": "ERROR"}

In the commented out workflow configuration the `services` section specifies that the action requires Docker where FusionAuth will run.
In the commented-out workflow configuration, the `services` section specifies that the action requires Docker where FusionAuth will run.

Check failure on line 335 in astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'. Raw Output: {"message": "[Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'.", "location": {"path": "astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx", "range": {"start": {"line": 335, "column": 117}}}, "severity": "ERROR"}

```yaml
services:
Expand All @@ -344,7 +344,7 @@
- 9011:9011
```

Then FusionAuth will be started using `docker-compose` as shown below.
Then FusionAuth is started using `docker-compose`.

Check failure on line 347 in astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'. Raw Output: {"message": "[Vale.Terms] Use 'fusionauth' instead of 'FusionAuth'.", "location": {"path": "astro/src/content/docs/get-started/run-in-the-cloud/github-actions.mdx", "range": {"start": {"line": 347, "column": 6}}}, "severity": "ERROR"}

```yaml
- name: Start FusionAuth in Docker
Expand Down Expand Up @@ -428,7 +428,7 @@

Each environment should correspond to a single branch in GitHub, and have its own set of secrets: passwords, URLs, and database values.

In this guide's sample application action, you set the action event to be triggered when pushing to the main branch (which corresponds to the production environment). You'll need to add other events and scripts to run tests, but not deploy, for all other environments and pull-request events. For example, you would probably want a push to the test branch to run tests, and deploy the new release to the test environment.
In this guide's sample application action, you set the action event to be triggered when pushing to the main branch (which corresponds to the production environment). You'll need to add other events and scripts to run tests, but not deploy, for all other environments and pull-request events. For example, you would probably want a push to the test branch to run tests and deploy the new release to the test environment.

This application also used two `.env` files to store secrets that your app and FusionAuth use. In reality, you should never do this, as it allows anyone to access your private database with your password kept publicly on GitHub.

Expand All @@ -449,11 +449,11 @@

- Configure your server to run Docker and the programming framework that your app uses.
- Keep secrets safe and private in environment variables on each server, even from your developers.
- Backup your FusionAuth and app database frequently, and test that you can restore them successfully.
- Back up your FusionAuth and app database frequently, and test that you can restore them successfully.
- Write Playwright tests that check your app can log in with FusionAuth and any other essential functionality, including new features that you are releasing.
- Write a GitHub action workflow that runs these tests when receiving a pull request or pushing code to a branch.
- Write a GitHub Actions workflow that runs these tests when receiving a pull request or pushing code to a branch.
- Add secrets in GitHub that allow it to access your deployment environment.
- Add a deployment step to your GitHub action workflow that sends your new release to the server and starts it.
- Add a deployment step to your GitHub Actions workflow that sends your new release to the server and starts it.
- Add a final step in the workflow to test that your Playwright tests work on the deployed server.
- If your tests are successful, switch your public URL over to the latest release.

Expand Down
Loading