Skip to content

Commit ae208fd

Browse files
authored
Start replacing fly auth token with more limited tokens (#1741)
* start replacing `fly auth token` with more limited tokens * address review feedback
1 parent 85309d0 commit ae208fd

File tree

6 files changed

+21
-19
lines changed

6 files changed

+21
-19
lines changed

blueprints/review-apps-guide.html.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Review apps are a great way to preview new features, changes, and bug fixes. Thi
1717

1818
If you've worked with GitHub Actions before and want to jump right in, here are the steps to take:
1919

20-
1. Create a new repository secret on your GitHub repository called `FLY_API_TOKEN` and provide it with the returned value of `fly auth token`
20+
1. Create a new repository secret on your GitHub repository called `FLY_API_TOKEN` and provide it with the returned value of `fly tokens org <ORG NAME>`
2121
1. Create a new workflow in your project at `.github/workflows/fly-review.yml` and add the following [YAML code](https://gist.github.com/anniebabannie/3cb800f2a890a6f3ed3167c09a0234dd).
2222
1. Commit and push the changes containing your GitHub workflow.
2323

@@ -37,10 +37,10 @@ For more details about each step, follow the guide below.
3737
Your GitHub Action will need a Fly API token to deploy and manage new review apps on Fly.io. You can get this token using the following [flyctl](/docs/flyctl/install/) command:
3838

3939
```cmd
40-
fly auth token
40+
fly tokens org <ORG NAME>
4141
```
4242

43-
This token is specific to a single Fly.io account and is valid for applications belonging the that account.
43+
This token is specific to a single Fly.io organization and is valid for applications belonging the that organization.
4444

4545
Next, let's save our API token as a secret in our GitHub repository. Visit the Settings tab in your repository, then Secrets and variables → Actions. Alternatively, you can visit `https://github.com/<username or org>/<repository>/settings/secrets/actions`. There, create a new **Repository Secret** called `FLY_API_TOKEN` with the value of your token.
4646

django/advanced-guides/staging-environments-with-github-actions.html.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ repository page and open:
3232
next, create a new secret called `FLY_API_TOKEN` with a value from:
3333

3434
```cmd
35-
fly auth token
35+
fly tokens org <ORG NAME>
3636
```
37+
3738
<section class="callout">
38-
It's also possible to create a new token on the [dashboard](https://fly.io/user/personal_access_tokens).
39+
It's also possible to create a token from the organization dashboard, under the "Tokens" tab.
3940
</section>
4041

4142
Now, we're ready to add a new flow. This is how we can define it in the

laravel/advanced-guides/github-actions.html.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Laravel GitHub Actions: CICD"
33
layout: framework_docs
4-
objective: Configure continuous integration and development on your Laravel Fly App through GitHub.
4+
objective: Configure continuous integration and development on your Laravel Fly App through GitHub.
55
order: 3
66
---
77

@@ -20,7 +20,7 @@ In this section, you'll create a new Laravel application, configure and deploy i
2020
composer create-project laravel/laravel fly-laravel
2121
cd fly-laravel
2222
23-
# Auto generate your `fly.toml` configuration file:
23+
# Auto generate your `fly.toml` configuration file:
2424
# Add in the ams region with --region
2525
# Auto deploy using --now while your at it!
2626
flyctl launch --region ams --now
@@ -43,11 +43,11 @@ git remote add origin [email protected]:<username>/<repository-name>.git
4343

4444
## GitHub CI Action: Auto Deploy to Fly.io
4545

46-
Once you have your Laravel application set up with a github repository, you can configure some GitHub Actions to auto deploy your changes.
46+
Once you have your Laravel application set up with a github repository, you can configure some GitHub Actions to auto deploy your changes.
4747

4848
In this guide, you'll be using `Fly.io`'s very own [GitHub action template here](https://github.com/superfly/flyctl-actions) to help deploy your application.
4949

50-
1) Generate a `Fly token` with `fly auth token`
50+
1) Generate a `Fly token` with `fly tokens deploy`
5151

5252
2) Then save your newly generated `FLY_API_TOKEN` in your github repository either through the GitHub Console or GitHub CLI:
5353

@@ -110,4 +110,4 @@ git commit -m "Configure auto-deploy through GitHub Actions"
110110
git push
111111
```
112112

113-
5) Visit the Actions tab of your repository and see how your deployment fares!
113+
5) Visit the Actions tab of your repository and see how your deployment fares!

machines/api/working-with-machines-api.html.markerb

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ For local development, you might set them as follows, assuming you have flyctl i
4646

4747
```bash
4848
$ export FLY_API_HOSTNAME="https://api.machines.dev" # set to http://_api.internal:4280 when using WireGuard
49-
$ export FLY_API_TOKEN=$(fly auth token)
49+
$ export FLY_API_TOKEN=$(fly tokens deploy)
5050
```
5151

52-
The `fly auth token` command returns the token currently in use by `flyctl`. You can also create a new auth token in the Tokens section of the Fly.io dashboard.
52+
The `fly tokens deploy` command creates a token capable of managing the application in your current directory. See `fly tokens create --help` for information on other types of tokens you can generate.
5353

5454
To set an access token as an environment variable on Fly Machines, use a [secret](/docs/apps/secrets/); for example:
5555

5656
```cmd
57-
fly secrets set FLY_API_TOKEN=$(fly auth token)
57+
fly secrets set FLY_API_TOKEN=$(fly tokens deploy)
5858
```
5959

6060
## Response Codes

monitoring/exporting-logs.html.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Export logs
33
layout: docs
44
objective: Aggregate your logs to a service of your choice.
55
nav: firecracker
6-
redirect_from:
6+
redirect_from:
77
- /docs/going-to-production/monitoring/exporting-logs/
88
- /docs/metrics-and-logs/exporting-logs/
99
---
@@ -38,8 +38,9 @@ fly launch --no-deploy --image ghcr.io/superfly/fly-log-shipper:latest
3838

3939
# Set some secrets. The secret / env var you set
4040
# determines which "sinks" are configured
41-
fly secrets set ORG=personal
42-
fly secrets set ACCESS_TOKEN=$(fly auth token)
41+
ORG=personal
42+
fly secrets set ORG=$ORG
43+
fly secrets set ACCESS_TOKEN=$(fly tokens create readonly $ORG)
4344
fly secrets set LOGTAIL_TOKEN=<token provided by logtail source>
4445
```
4546

rails/advanced-guides/machine.html.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ ENV PATH="$FLYCTL_INSTALL/bin:$PATH"
7373

7474
A good place to put these lines is immediately before the `# Deploy your application` comment.
7575

76-
Next we need to make our Fly token available to our application:
76+
Next we need to make a Fly token available to our application:
7777

7878
```cmd
79-
fly secrets set FLY_API_TOKEN=$(fly auth token)
79+
fly secrets set FLY_API_TOKEN=$(fly tokens deploy)
8080
```
8181

8282
## Add a controller
@@ -144,7 +144,7 @@ Overall the tasks to be performed by this job:
144144
* Specify a machine configuration. For simplicity we will use the
145145
same Fly application name and the same Fly image as our Rails
146146
application. The server command will be `curl` specifying the
147-
URL that was passed as an argument to the job.
147+
URL that was passed as an argument to the job.
148148
* Start a machine using this configuration, and
149149
check for errors, and log the results.
150150
* Query the status of the machine every 10 seconds for a maximum

0 commit comments

Comments
 (0)