diff --git a/docusaurus/docs/cloud/cli/cloud-cli.md b/docusaurus/docs/cloud/cli/cloud-cli.md new file mode 100644 index 0000000000..2928421b21 --- /dev/null +++ b/docusaurus/docs/cloud/cli/cloud-cli.md @@ -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. +::: + +:::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. +::: + +## 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. \ No newline at end of file diff --git a/docusaurus/docs/cloud/getting-started/deployment-cli.md b/docusaurus/docs/cloud/getting-started/deployment-cli.md new file mode 100644 index 0000000000..b793f1003a --- /dev/null +++ b/docusaurus/docs/cloud/getting-started/deployment-cli.md @@ -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: + + + + +```bash +yarn strapi login +``` + + + + +```bash +npx run strapi login +``` + + + + +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: + + + + +```bash +yarn strapi deploy +``` + + + + +```bash +npx run strapi deploy +``` + + + + +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. \ No newline at end of file diff --git a/docusaurus/docs/cloud/getting-started/deployment-options.md b/docusaurus/docs/cloud/getting-started/deployment-options.md new file mode 100644 index 0000000000..c5b401211d --- /dev/null +++ b/docusaurus/docs/cloud/getting-started/deployment-options.md @@ -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. + + + + + diff --git a/docusaurus/docs/cloud/getting-started/deployment.md b/docusaurus/docs/cloud/getting-started/deployment.md index e0fe8399f9..0be23e2042 100644 --- a/docusaurus/docs/cloud/getting-started/deployment.md +++ b/docusaurus/docs/cloud/getting-started/deployment.md @@ -1,17 +1,17 @@ --- -title: Project creation +title: with Cloud dashboard displayed_sidebar: cloudSidebar description: Learn how to deploy your Strapi application on Strapi Cloud. canonicalUrl: https://docs.strapi.io/cloud/getting-started/deployment.html sidebar_position: 2 --- -# Project creation & deployment +# Project deployment with the Cloud dashboard -This is a step-by-step guide for creating and deploying your first project on Strapi Cloud. +This is a step-by-step guide for deploying your project on Strapi Cloud for the first time, using the Cloud dashboard. :::prerequisites -Before you can deploy your Strapi application on Strapi Cloud, you need to have the following prerequisites: +Before you can deploy your Strapi application on Strapi Cloud using the Cloud dashboard, you need to have the following prerequisites: * Strapi version `4.8.2` or higher * Project database must be compatible with PostgreSQL. Strapi does not support and does not recommend using any external databases, though it's possible to configure one (see [advanced database configuration](/cloud/advanced/database)). @@ -33,7 +33,7 @@ Before you can deploy your Strapi application on Strapi Cloud, you need to have }} /> -## Creating a project +## Deploying a project 1. From the *Projects* page, click the **Create project** button. @@ -45,7 +45,7 @@ Before you can deploy your Strapi application on Strapi Cloud, you need to have }} /> -2. You will be redirected to the first project creation interface. This interface contains 3 steps: choosing a plan, connecting a git repository, and setting up the project. +2. You will be redirected to the first project deployment interface. This interface contains 3 steps: choosing a plan, connecting a remote git repository, and setting up the project. - 4.a. Click on the **Use template** button. If you are creating a project for the first time, you may first have to select GitHub as git provider and then you will see the option to use a template. + 4.a. Click on the **Use template** button. If you are deploying a project for the first time, you may first have to select GitHub as git provider and then you will see the option to use a template. 4.b. In the *Create repository with template* modal, choose: @@ -93,7 +93,7 @@ Before you can deploy your Strapi application on Strapi Cloud, you need to have 4.d. If you have already given Strapi Cloud access to all repositories of your GitHub account, go directly to the next step. If not, you will be redirected to a GitHub modal where you will have to allow Strapi Cloud access to the newly created repository (more information in the [GitHub documentation](https://docs.github.com/en/apps/overview)). - 4.e. Back in the project creation interface, select your *Account* and the *Repository* you just created. + 4.e. Back in the project deployment interface, select your *Account* and the *Repository* you just created. - 4.a. (optional) If you are creating a project for the first time, you may first have to select a git provider: either GitHub or GitLab. If you already created a project with one git provider, you can afterward create another project using another provider by clicking on the **Switch git provider** button and selecting either GitHub or GitLab. + 4.a. (optional) If you are deploying a project for the first time, you may first have to select a git provider: either GitHub or GitLab. If you already deployed a project with one git provider, you can afterward deploy another project using another provider by clicking on the **Switch git provider** button and selecting either GitHub or GitLab. :::tip Connect the GitHub or GitLab account and/or organizations that own the repository or repositories you want to deploy. This can be different from the account that owns the Strapi Cloud account. @@ -115,7 +115,7 @@ Before you can deploy your Strapi application on Strapi Cloud, you need to have 4.b. If you have already given Strapi Cloud access to all repositories of your GitHub or GitLab account, go directly to the next step. If not, you will be redirected to a modal where you will have to allow Strapi Cloud permission to access some or all your repositories on GitHub/GitLab (more information in the [GitHub](https://docs.github.com/en/apps/overview) and [GitLab](https://docs.gitlab.com/ee/integration/oauth_provider.html#view-all-authorized-applications) documentations). - 4.c. Back in the project creation interface, select your *Account* and a *Repository*. + 4.c. Back in the project deployment interface, select your *Account* and a *Repository*. +Steps required to push your Strapi project code to GitHub: + +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 git@github.com: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). + + + + + ## Running Strapi To start the Strapi application, run the following command in the project folder: diff --git a/docusaurus/docs/dev-docs/quick-start.md b/docusaurus/docs/dev-docs/quick-start.md index 3522e7f161..7b940d4d2d 100644 --- a/docusaurus/docs/dev-docs/quick-start.md +++ b/docusaurus/docs/dev-docs/quick-start.md @@ -16,12 +16,10 @@ const summaryStyle = {fontSize: '18px'} Strapi offers a lot of flexibility. Whether you want to go fast and quickly see the final result, or would rather dive deeper into the product, we got you covered. For this tutorial, we'll go for the DIY approach and build a project and data structure from scratch, then deploy your project to Strapi Cloud to add data from there. -*Estimated completion time: 15-20 minutes* +*Estimated completion time: 5-10 minutes* :::prerequisites - -You will also need to [install `git`](https://github.com/git-guides/install-git) and to have a [GitHub](https://github.com) account to deploy your project to Strapi Cloud. ::: ## πŸš€ Part A: Create a new project with Strapi @@ -31,34 +29,53 @@ We will first create a new Strapi project on your machine by running a command i Follow the steps below by clicking on the togglable content to read more instructions.
-Step 1: Run the installation script +Step 1: Run the installation script and create a Strapi Cloud account -### Step 1: Run the installation script +### Step 1: Run the installation script and create a Strapi Cloud account -Run the following command in a terminal: +1. Run the following command in a terminal: - + - + -```bash -npx create-strapi-app@latest my-project --quickstart -``` + ```bash + npx create-strapi-app@latest my-strapi-project --quickstart + ``` - + - + -```bash -yarn create strapi-app my-project --quickstart -``` + ```bash + yarn create strapi-app my-strapi-project --quickstart + ``` + + + + - +2. The terminal will invite you to create a Strapi Cloud account and start a free, 14-day trial. Ensure `Login/Sign up` is selected in the terminal, or use arrow keys to select it, and press Enter. - +3. In the new browser tab that opens, ensure the confirmation code is the same as in the terminal and click **Confirm**. + +4. Still in the browser tab, click **Continue with GitHub**. If you are not already logged in into GitHub with your current browser session, you might be redirected to a GitHub login page. + +5. Once logged in, the browser will display a "Congratulations, you're all set!" message and you can safely close the browser tab and get back to the terminal. + + + +As you will see in the terminal, your project is now building locally and also getting ready to be deployed on Strapi Cloud later. :::info -The `quick start` installation sets up Strapi with a SQLite database. Other databases and installation options are available (see [CLI installation guide](/dev-docs/installation/cli)). +* The `quick start` installation sets up Strapi with a SQLite database. Other databases and installation options are available (see [CLI installation guide](/dev-docs/installation/cli)). +* The folder of your project will include a `.strapi-cloud.json` file used to link the local Strapi project on your machine to the Strapi Cloud project. :::
@@ -98,7 +115,7 @@ The admin panel of a local Strapi project runs at [http://localhost:1337/admin]( First we will build a data structure for your content. This can only be done while in development mode, which is the default mode for projects that are created locally. :::tip TIP -If the server is not already running, in your terminal, `cd` into the `my-project` folder and run `npm run develop` (or `yarn develop`) to launch it. +If the server is not already running, in your terminal, `cd` into the `my-strapi-project` folder and run `npm run develop` (or `yarn develop`) to launch it. ::: The Content-Type Builder helps you create your data structure. When creating an empty project with Strapi, this is where to get the party started! @@ -171,73 +188,55 @@ You have just created a basic data structure for your Strapi project! You can ke ## ☁️ Part C: Deploy to Strapi Cloud -Now that your beautiful first Strapi project is working locally, it's time for the world to see it live! The most straightforward way to host your project is to use Strapi Cloud. Before deploying to Strapi Cloud, you will need to host your Strapi project on an online repository β€” we will use GitHub. +Now that your beautiful first Strapi project is working locally, it's time for the world to see it live! The most straightforward way to host your project is to use Strapi Cloud: Deploying your project on Strapi Cloud is done with a single command! πŸš€ -
-Step 1: Host the code of your Strapi project on GitHub +To deploy your project on Strapi Cloud, in your terminal: +1. If the server for your local Strapi project is running, which should be the case if you followed this tutorial so far, press `Ctrl-C` to stop the server. +2. Ensure you are in the folder of your Strapi project (if needed, run for instance `cd my-strapi-project` to reach this folder), and run the following command: -### Step 1: Host the code of your Strapi project on GitHub + -Create a new GitHub repository and push the code of your Strapi project to this repository. If you're not already familiar with GitHub, the togglable content below should get you started πŸ‘‡ + -
-Steps required to push your Strapi project code to GitHub: + ```sh + yarn strapi deploy + ``` -1. In the terminal, ensure you are still in the `my-project` folder that hosts the Strapi project we created. If you followed this tutorial closely so far, we should still be there. -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 into 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 git@github.com:yourname/my-first-strapi-project.git`, ensuring you replace `yourname` by your actual 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. + ```sh + npm run strapi deploy + ``` -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). + -
+
-
+Within a few moments, your local project will be hosted on Strapi Cloud. πŸš€ -
-Step 2: Create a Strapi Cloud account and a new Strapi Cloud project - - -### Step 2: Create a Strapi Cloud account and a new Strapi Cloud project - -To create a new Strapi Cloud account: +Once it's done, the terminal will provide you a clickable link that starts with `https://cloud.strapi.io/projects`. Click on the link, or copy and paste it in your browser address bar, to visit the page. -1. Navigate to the [Strapi Cloud](https://cloud.strapi.io) login page. -2. Click the **Continue with GitHub** button and log in with the GitHub account where your Strapi project's repository is hosted. - -You should now see the Strapi Cloud dashboard. This is where you manage your Strapi projects hosted on Strapi Cloud. - -We will create a new Strapi Cloud project by importing the local Strapi project you have just pushed to a GitHub repository: +You will see the Strapi Cloud project we've just created, `my-strapi-project`, visible in the Strapi Cloud dashboard. Click the **Visit app** button in the top right corner to access your deployed Strapi project. -1. Click the **+ Create project** button. -2. Select the free trial plan. -3. Scroll down, and in the "Import git repository section", choose the appropriate Account and Repository from the list (for instance, Account: `yourname`, Repository: `my-first-strapi-project`). -4. Scroll down further, and in the "Setup" section, give your project a Display name (for instance `my-first-strapi-project`) and leave the other options unchanged. -5. Click **Create project** at the bottom of the page. - -Your Strapi project should be deployed within minutes. πŸš€ Once it's done, you'll be able to log into your deployed Strapi project by clicking the **Visit app** button in the top right corner. - -
- :::callout πŸ₯³ CONGRATULATIONS! Now your project is hosted on Strapi Cloud and accessible online. You can learn more about Strapi Cloud by reading [its dedicated documentation](/cloud/intro) or proceed to part D to log in into your online Strapi project and add your first data from there. ::: +:::tip +Feel free to play with the Content-Type Builder even further and add more fields to your content-types or create new content-types. Anytime you make such changes, deploy them again on Strapi Cloud, by running the appropriate `deploy` command, and see your hosted project updated within a few minutes. Magical, isn't it? πŸͺ„ +::: + ## πŸ“ Part D: Add content to your Strapi Cloud project with the Content Manager Now that we have created a basic data structure with 2 collection types, "Restaurant" and "Category", and deployed your project to Strapi Cloud, let's use the Cloud to actually add content by creating new entries. @@ -249,7 +248,7 @@ Now that we have created a basic data structure with 2 collection types, "Restau Now that your Strapi Cloud project is created, let's log in into the project: -1. From your [Strapi Cloud dashboard](https://cloud.strapi.io/projects), click the `my-first-strapi-project` project. +1. From your [Strapi Cloud dashboard](https://cloud.strapi.io/projects), click the `my-strapi-project` project. 3. Click the **Visit app** button. 4. In the new page that opens, complete the form to create the first administrator user of this Strapi Cloud project. @@ -441,4 +440,5 @@ Now that you know the basics of creating and publishing content with Strapi, we - πŸ‘‰ learn how to use Strapi's [REST](/dev-docs/api/rest) API to query the content, - πŸ‘‰ learn more about Strapi features by browsing the [User Guide](/user-docs/intro), +- πŸ‘‰ learn more about Strapi Cloud projects by reading the [Cloud Documentation](/cloud/intro), - πŸ‘‰ and [customize your Strapi back end](/dev-docs/backend-customization) and [admin panel](/dev-docs/admin-panel-customization) for advanced use cases. diff --git a/docusaurus/sidebars.js b/docusaurus/sidebars.js index 24a42ebef3..ab5ee9effe 100644 --- a/docusaurus/sidebars.js +++ b/docusaurus/sidebars.js @@ -23,7 +23,14 @@ const sidebars = { label: "πŸš€ Getting Started", items: [ "dev-docs/intro", - "dev-docs/quick-start", + { + type: "doc", + label: "Quick Start Guide", + id: "dev-docs/quick-start", + customProps: { + updated: true, + }, + }, "dev-docs/faq", "dev-docs/usage-information", ], @@ -760,22 +767,38 @@ const sidebars = { label: "Cloud fundamentals", id: "cloud/getting-started/cloud-fundamentals", customProps: { - new: true, + new: false, }, }, { - type: "doc", - id: "cloud/getting-started/deployment", + type: "category", + label: "Project deployment", + link: { type: "doc", id: "cloud/getting-started/deployment-options" }, customProps: { - updated: true, + new: true, }, + items: [ + { + type: "doc", + id: "cloud/getting-started/deployment", + customProps: { + updated: true, + }, + }, + { + type: "doc", + id: "cloud/getting-started/deployment-cli", + customProps: { + new: true, + }, + }, + ], }, - , { type: "doc", id: "cloud/getting-started/usage-billing", customProps: { - updated: true, + updated: false, }, }, "cloud/getting-started/caching", @@ -797,7 +820,7 @@ const sidebars = { label: "Project settings", id: "cloud/projects/settings", customProps: { - updated: true, + updated: false, }, }, "cloud/projects/collaboration", @@ -821,7 +844,22 @@ const sidebars = { id: "cloud/account/account-billing", label: "Account billing details", customProps: { - updated: true, + updated: false, + }, + }, + ], + }, + { + type: "category", + collapsed: false, + label: "Command Line Interface", + items: [ + { + type: "doc", + id: "cloud/cli/cloud-cli", + label: "Strapi Cloud CLI", + customProps: { + new: true, }, }, ], diff --git a/docusaurus/static/img/assets/quick-start-guide/qsg-cloud-login.gif b/docusaurus/static/img/assets/quick-start-guide/qsg-cloud-login.gif new file mode 100644 index 0000000000..0c54c0887c Binary files /dev/null and b/docusaurus/static/img/assets/quick-start-guide/qsg-cloud-login.gif differ diff --git a/docusaurus/static/img/assets/quick-start-guide/qsg-visit-cloud-app.gif b/docusaurus/static/img/assets/quick-start-guide/qsg-visit-cloud-app.gif new file mode 100644 index 0000000000..9181a6f34c Binary files /dev/null and b/docusaurus/static/img/assets/quick-start-guide/qsg-visit-cloud-app.gif differ diff --git a/docusaurus/static/img/assets/quick-start-guide/qsg-visit-cloud-app_DARK.gif b/docusaurus/static/img/assets/quick-start-guide/qsg-visit-cloud-app_DARK.gif new file mode 100644 index 0000000000..9e8da76a4d Binary files /dev/null and b/docusaurus/static/img/assets/quick-start-guide/qsg-visit-cloud-app_DARK.gif differ