diff --git a/SUMMARY.md b/SUMMARY.md index 963115e..aa75069 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -75,7 +75,7 @@ * [Overview](deployment/overview.md) * [Create an Application](deployment/create-an-application.md) * [Generate API Key & Secret](deployment/generate-api-key-and-secret.md) -* [Deploying the application using CLI](deployment/deploying-the-application-using-cli.md) +* [Creating and Deploying the application using CLI](deployment/creating-deploying-the-application-using-cli.md) * [Editing environment variables](deployment/editing-environment-variables.md) *** diff --git a/deployment/deploying-the-application-using-cli.md b/deployment/creating-deploying-the-application-using-cli.md similarity index 59% rename from deployment/deploying-the-application-using-cli.md rename to deployment/creating-deploying-the-application-using-cli.md index 4062399..b612f3d 100644 --- a/deployment/deploying-the-application-using-cli.md +++ b/deployment/creating-deploying-the-application-using-cli.md @@ -1,13 +1,22 @@ -# Deploying the application using CLI +# AdminJS Cloud CLI for creating and deploying the application AdminJS Cloud Hosting comes with a CLI tool which you can use locally or inside your CI/CD to deploy your application. +## Requierments + +Before you will make installation and configuration steps make sure you met all the requirements below. + +- Node.js >=18 (we recommend latest LTS version) +- yarn installed globally (`npm install --global yarn`) + ## Installation {% code overflow="wrap" %} + ```bash -$ npm i -g @adminjs/cloud-cli +$ yarn global add @adminjs/cloud-cli ``` + {% endcode %} ## Configuration @@ -23,6 +32,7 @@ include string[] A list of files/directories you wish to deploy. ### Example {% code title="adminjs-cloud.json" %} + ```json { "include": [ @@ -36,6 +46,7 @@ include string[] A list of files/directories you wish to deploy. ] } ``` + {% endcode %} ### Starting the application @@ -43,6 +54,7 @@ include string[] A list of files/directories you wish to deploy. Currently, AdminJS Cloud Hosting requires `start` script to be present in your `package.json` file. This is the command you use to start your application: {% code title="package.json" %} + ```json { ..., @@ -52,16 +64,36 @@ Currently, AdminJS Cloud Hosting requires `start` script to be present in your ` } } ``` + {% endcode %} In the future, we plan to extend application's configuration so that you can provide a custom start command. ## Commands -As of version `1.1.0` the CLI only allows you to deploy your application. +As of version `1.2.0` the CLI only allows you to create and deploy your application. To use `@adminjs/cloud-cli` you must first request an application in [Pricing](https://adminjs.co/pricing) page and generate an API Key & API Secret. +### #create + +The `create` command allows you to create basic AdminJS application with basic authentication. The CLI generates only code for running it, you have to use commands `yarn && yarn build && yarn start` to check if setup is complete succesfully, if you follow all the steps correctly. + +#### Parameters + +``` +name string required The name of your application +database string required The connection string to database eg. `postgres://adminjs:adminjs@localhost:5432/adminjs` +apiKey string required Your API Key +apiSecret string required Your API Secret +config string optional Path to your configuration file (relative to PWD) +``` + +#### Usage + +```bash +$ adminjs-cloud create --name= --database= --apiKey= --apiSecret= +``` ### #deploy The `deploy` command allows you to deploy your source code. The CLI assumes your code is already built and whatever files you choose to `include` in your configuration file are enough to start your application.