-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Cloud CLI documentation #2086
Cloud CLI documentation #2086
Changes from all commits
75eef50
2eab61b
7c752ba
9df4fbc
9a4ab42
f3f9f80
14c9eeb
f7a5552
4e11ec4
dfc36ec
29099e9
65d6d9c
c095ba7
2bd72da
efcccbe
cc7feb1
89c1dd9
87cb5d3
23372b1
23398a9
bd479fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
sidebar_label: 'Cloud CLI' | ||
displayed_sidebar: cloudSidebar | ||
sidebar_position: 3 | ||
--- | ||
|
||
# Command Line Interface (CLI) | ||
|
||
Strapi Cloud comes with a Command Line Interface (CLI) which allows you to log in and out, and to deploy a local project without it having to be hosted on a remote git repository. The CLI works with both the `yarn` and `npm` package managers. | ||
|
||
The Cloud CLI is designed as a CLI-only experience, meaning that users who wish to use Strapi Cloud to deploy their project with the CLI will have to mostly stick to using the CLI (e.g. if you login with the CLI you must logout with the CLI as well, your project deployed with the CLI can only be redeployed with the CLI etc.). | ||
|
||
:::note | ||
It is recommended to install Strapi locally only, which requires prefixing all of the following `strapi` commands with the package manager used for the project setup (e.g `npm run strapi help` or `yarn strapi help`) or a dedicated node package executor (e.g. `npx strapi help`). | ||
::: | ||
|
||
## strapi login | ||
|
||
**Alias:** `strapi cloud:login` | ||
|
||
Log in Strapi Cloud. | ||
|
||
```bash | ||
strapi login | ||
``` | ||
|
||
This command automatically opens a browser window to first ask you to confirm that the codes displayed in both the browser window and the terminal are the same. Then you will be able to log into Strapi Cloud via Google, GitHub or GitLab. Once the browser window confirms successful login, it can be safely closed. | ||
|
||
If the browser window doesn't automatically open, the terminal will display a clickable link as well as the code to enter manually. | ||
|
||
## strapi deploy | ||
|
||
**Alias:** `strapi cloud:deploy` | ||
|
||
Deploy a new local project (< 100MB) in Strapi Cloud. | ||
|
||
```bash | ||
strapi deploy | ||
``` | ||
|
||
This command must be used after the `login` one. It deploys a local Strapi project on Strapi Cloud, without having to host it on a remote git repository beforehand. The terminal will inform you when the project is successfully deployed on Strapi Cloud. | ||
|
||
Once the project is first deployed on Strapi Cloud with the CLI, the `deploy` command can be reused to trigger a new deployment of the same project. | ||
|
||
:::caution | ||
The `deploy` command can only be used by new users who have never created a Strapi Cloud project, and for which the free trial is still available. Once a project is deployed with the CLI, it isn't possible to deploy another project on the same Strapi Cloud account with the CLI. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ️ It's only true for the first version of the CLI. 🤞 |
||
::: | ||
|
||
:::note | ||
Once you deployed your project, if you visit the Strapi Cloud dashboard, you may see some limitations as well as impacts due to creating a Strapi Cloud project that is not in a remote repository and which was deployed with the CLI. | ||
|
||
- Some areas in the dashboard that are usually reserved to display information about the git provider will be blank. | ||
- Some buttons, such as the **Trigger deploy** button, will be greyed out and unclickable since you can only redeploy your project using the CLI. | ||
- Options such as environment variables, and features like the logs, are not available for CLI-created projects. <!-- to be confirmed --> | ||
::: | ||
|
||
## strapi logout | ||
|
||
**Alias:** `strapi cloud:logout` | ||
|
||
Log out of Strapi Cloud. | ||
|
||
```bash | ||
strapi logout | ||
``` | ||
|
||
This command logs you out of Strapi Cloud. Once the `logout` command is run, the terminal will display a confirmation message that you were successfully logged out, and you will not be able to use the `deploy` command anymore. |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,80 @@ | ||||||
--- | ||||||
title: with Cloud CLI | ||||||
displayed_sidebar: cloudSidebar | ||||||
description: Learn how to deploy your Strapi application via the CLI. | ||||||
canonicalUrl: https://docs.strapi.io/cloud/getting-started/deployment-cli.html | ||||||
sidebar_position: 2 | ||||||
--- | ||||||
|
||||||
# Project deployment with the Command Line Interface (CLI) | ||||||
|
||||||
This is a step-by-step guide for deploying your project on Strapi Cloud for the first time, using the Command Line Interface. | ||||||
|
||||||
:::prerequisites | ||||||
Before you can deploy your Strapi application on Strapi Cloud using the Command Line Interface, you need to have the following prerequisites: | ||||||
|
||||||
- Be a first-time Strapi Cloud user: you must never have deployed a project with Strapi Cloud before, and your free trial must still be available. | ||||||
- Have a Google, GitHub or GitLab account. | ||||||
- Have an already created Strapi project (see [Installing from CLI in the Developer Documentation](/dev-docs/installation/cli)), stored locally. The project must be less than 100MB. | ||||||
- Have available storage in your hard drive where the temporary folder of your operating system is stored. | ||||||
::: | ||||||
|
||||||
## Logging in to Strapi Cloud | ||||||
|
||||||
1. Open your terminal. | ||||||
|
||||||
2. Navigate to the folder of your Strapi project, stored locally on your computer. | ||||||
|
||||||
3. Enter the following command to log into Strapi Cloud: | ||||||
|
||||||
<Tabs groupId="yarn-npm"> | ||||||
<TabItem value="yarn" label="Yarn"> | ||||||
|
||||||
```bash | ||||||
yarn strapi login | ||||||
``` | ||||||
|
||||||
</TabItem> | ||||||
<TabItem value="npm" label="NPM"> | ||||||
|
||||||
```bash | ||||||
npx run strapi login | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
``` | ||||||
|
||||||
</TabItem> | ||||||
</Tabs> | ||||||
|
||||||
4. In the browser window that opens automatically, confirm that the code displayed is the same as the one written in the terminal message. | ||||||
|
||||||
5. Still in the browser window, choose whether to login via Google, GitHub or GitLab. The window should confirm the successful login soon after. | ||||||
|
||||||
## Deploying your project | ||||||
|
||||||
1. From your terminal, still from the folder of your Strapi project, enter the following command to deploy the project: | ||||||
|
||||||
<Tabs groupId="yarn-npm"> | ||||||
<TabItem value="yarn" label="Yarn"> | ||||||
|
||||||
```bash | ||||||
yarn strapi deploy | ||||||
``` | ||||||
|
||||||
</TabItem> | ||||||
<TabItem value="npm" label="NPM"> | ||||||
|
||||||
```bash | ||||||
npx run strapi deploy | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Double-checked with Alex for the commands :) |
||||||
``` | ||||||
|
||||||
</TabItem> | ||||||
</Tabs> | ||||||
|
||||||
2. Follow the progression bar in the terminal until confirmation that the project was successfully deployed with Strapi Cloud. | ||||||
|
||||||
## ⏩ What to do next? | ||||||
|
||||||
Now that you have deployed your project via the Command Line Interface, we encourage you to explore the following ideas to have an even more complete Strapi Cloud experience: | ||||||
|
||||||
- Fill in your [billing information](/cloud/account/account-billing) to prevent your project from being suspended at the end of the trial period. | ||||||
- Visit the Cloud dashboard to follow [insightful metrics and information](/cloud/projects/overview) on your Strapi project. | ||||||
- Check out the full [Command Line Interface documentation](/cloud/cli/cloud-cli) to learn about the other commands available. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
title: Project deployment | ||
displayed_sidebar: cloudSidebar | ||
description: Learn how to deploy your Strapi application on Strapi Cloud, via the Cloud dashboard or the CLI. | ||
canonicalUrl: https://docs.strapi.io/cloud/getting-started/deployment-options.html | ||
sidebar_position: 2 | ||
--- | ||
|
||
# Project deployment with Strapi Cloud | ||
|
||
You have 2 options to deploy your project with Strapi Cloud: | ||
|
||
- either with the user interface (UI), meaning that you will perform all the actions directly on the Strapi Cloud dashboard, | ||
- or using the Cloud Comment Line Interface (CLI), meaning that you will only interact with a terminal. | ||
|
||
The guides below will guide you through all the steps for each of the deployment options. | ||
|
||
<CustomDocCardsWrapper> | ||
<CustomDocCard emoji="🖼️" title="Via the Cloud dashboard" description="Step-by-step guide to create and deploy a project via the user interface." link="/cloud/getting-started/deployment" /> | ||
<CustomDocCard emoji="💻" title="Via the CLI" description="Step-by-step guide to create and deploy a project with the Cloud Command Line Interface." link="/cloud/getting-started/deployment-cli" /> | ||
</CustomDocCardsWrapper> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,8 @@ The above installation guide only covers the basic installation option using the | |
- `--typescript`/`--ts`: Create a project in [TypeScript](/dev-docs/typescript). | ||
- `--no-run`: Prevent Strapi from automatically starting the server (useful in combination with `--quickstart`). | ||
|
||
- `--skip-cloud`: Automatically answers "Skip" to the Login/Signup question, which prevents the installation script from login into Strapi Cloud (useful in combination with `--quickstart`). | ||
|
||
For more information on available flags, see our [CLI documentation](/dev-docs/cli). | ||
|
||
Strapi also offers a starters CLI to create a project with a pre-made frontend application (see [our dedicated blog post](https://strapi.io/blog/announcing-the-strapi-starter-cli)). | ||
|
@@ -89,6 +91,36 @@ Experimental Strapi versions are released every Tuesday through Saturday at midn | |
Please use these experimental builds at your own risk. It is not recommended to use them in production. | ||
::: | ||
|
||
### Skipping the Strapi Cloud login step | ||
|
||
When the installation script runs, the terminal will first ask you if you want to login/signup. Choosing `Login/signup` will create a free, 14-day trial [Strapi Cloud](/cloud/intro#what-is-strapi-cloud) project as described in the [Quick Start Guide](/dev-docs/quick-start). | ||
|
||
If you prefer skipping this Strapi Cloud login part, use the arrow keys to select `Skip`. The script will resume and create a local project. To deploy this project and host it online, you could later choose to: | ||
- host it yourself by pushing the project's code to a repository (e.g., on GitHub) before following a [3rd-party deployment guide](/dev-docs/deployment), | ||
- or use the [Cloud CLI](/cloud/cli/cloud-cli) commands to login to Strapi Cloud and deploy your project there. | ||
|
||
If you want to host your project yourself and are not already familiar with GitHub, the following togglable content should get you started👇. | ||
|
||
<details> | ||
<summary>Steps required to push your Strapi project code to GitHub:</summary> | ||
|
||
1. In the terminal, ensure you are still in the folder that hosts the Strapi project you created. | ||
2. Run the `git init` command to initialize git for this folder. | ||
3. Run the `git add .` command to add all modified files to the git index. | ||
4. Run the `git commit -m "Initial commit"` command to create a commit with all the added changes. | ||
5. Log in to your GitHub account and [create a new repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/quickstart-for-repositories). Give the new repository a name, for instance `my-first-strapi-project`, and remember this name. | ||
6. Go back to the terminal and push your local repository to GitHub: | ||
|
||
a. Run a command similar to the following: `git remote add origin [email protected]:yourname/my-first-strapi-project.git`, ensuring you replace `yourname` by your own GitHub profile name, and `my-first-strapi-project` by the actual name you used at step 4. | ||
|
||
b. Run the `git push --set-upstream origin main` command to finally push the commit to your GitHub repository. | ||
|
||
Additional information about using git with the command line interface can be found in the [official GitHub documentation](https://docs.github.com/en/migrations/importing-source-code/using-the-command-line-to-import-source-code/adding-locally-hosted-code-to-github#adding-a-local-repository-to-github-using-git). | ||
|
||
</details> | ||
|
||
|
||
|
||
## Running Strapi | ||
|
||
To start the Strapi application, run the following command in the project folder: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ It's only true for the first version of the CLI. We will need to change this line once we release the next iteration 🤞