|
| 1 | +--- |
| 2 | +title: "How to create your squarecloud.app config file" |
| 3 | +sidebarTitle: "Config file" |
| 4 | +icon: "gear-complex-code" |
| 5 | +description: "Learn how to create your Square Cloud configuration file" |
| 6 | +--- |
| 7 | + |
| 8 | +## Configuration file? What is it? 🤔 |
| 9 | +The configuration file is a file that contains the parameters of your application, such as the main file, memory, version, and other parameters. This file is used to configure and deploy your application on the Square Cloud platform. |
| 10 | + |
| 11 | +## Creating the configuration file |
| 12 | +It's very simple to create the configuration file, just create a file with the name `squarecloud.app` or `squarecloud.config` and put the configuration parameters inside it. |
| 13 | + |
| 14 | +<Steps> |
| 15 | + <Step title="Select extension"> |
| 16 | + The configuration file can have two extensions: **.app** or **.config**. You can choose the extension you prefer. Tip: use **.app** to help promote Square (squarecloud.app). 😂 |
| 17 | + <Info>In **macOS**, we recommend using the **.config** extension.</Info> |
| 18 | + <Warning>Note: **.app** or **.config** is the **file extension**, **not the name**.</Warning> |
| 19 | + |
| 20 | + </Step> |
| 21 | + <Step title="Create file"> |
| 22 | + Create a file with the extension you selected and put the configuration parameters inside it. |
| 23 | + </Step> |
| 24 | +</Steps> |
| 25 | + |
| 26 | +## Configuration parameters |
| 27 | +Below you can see the configuration parameters that you can use in your configuration file. |
| 28 | + |
| 29 | +<Steps> |
| 30 | + <Step title="MAIN [*]" icon="file"> |
| 31 | + The **MAIN** parameter is used to define the main file of your application. |
| 32 | + ```systemd Example: |
| 33 | + MAIN=index.js |
| 34 | + ``` |
| 35 | + ```systemd Also, support subdirectories. |
| 36 | + MAIN=src/loaders/index.js |
| 37 | + ``` |
| 38 | + <Info>This parameter has maximum of **32 characters**.</Info> |
| 39 | + <Info>This configuration is **IGNORED** if you use START parameter.</Info> |
| 40 | + </Step> |
| 41 | + <Step title="MEMORY [*]" icon="memory"> |
| 42 | + The **MEMORY** parameter is used to define the amount of memory that your application will use on the Square Cloud platform. |
| 43 | + ```systemd |
| 44 | + MEMORY=256 |
| 45 | + ``` |
| 46 | + <Info>The value is in megabytes (MB).</Info> |
| 47 | + <Note>The minimum memory for a bot is **512MB** and for a website is **512MB**.</Note> |
| 48 | + </Step> |
| 49 | + <Step title="VERSION [*]" icon="arrow-up-9-1"> |
| 50 | + The **VERSION** parameter is used to define the version of your application. |
| 51 | + ```systemd |
| 52 | + VERSION=recommended |
| 53 | + ``` |
| 54 | + <Info>For each language there is a different version, see the table below.</Info> |
| 55 | + | Language | Version `recommended` | Version `latest` | |
| 56 | + | ------------------------ | ---------------------- | ---------------- | |
| 57 | + | JavaScript [Node.js] | 20.9.0 (LTS - 2023) | 21.1.0 | |
| 58 | + | Python | 3.11.6 | 3.12 | |
| 59 | + | Java | JDK 17 | JDK 18 | |
| 60 | + | Elixir | 1.15.4 | 1.15.4 | |
| 61 | + | Rust | 1.76.0 | 1.76.0 | |
| 62 | + | PHP | 8.2.10 | 8.2.10 | |
| 63 | + | Go | 1.21.3 | 1.21.3 | |
| 64 | + | HTML/CSS | Build 07-29-23 | Build 07-29-23 | |
| 65 | + |
| 66 | + <Tip>We recommend using the `recommended` version as our team has performed extensive testing on all recommended versions.</Tip> |
| 67 | + </Step> |
| 68 | + <Step title="DISPLAY_NAME [*]" icon="text"> |
| 69 | + The **DISPLAY_NAME** parameter is used to define the name of your application. |
| 70 | + ```systemd Example: |
| 71 | + DISPLAY_NAME=Admin BOT |
| 72 | + ``` |
| 73 | + <Info>This parameter has maximum of **32 characters**.</Info> |
| 74 | + </Step> |
| 75 | + <Step title="DESCRIPTION" icon="text"> |
| 76 | + The **DESCRIPTION** parameter is used to define the description of your application. |
| 77 | + ```systemd Example: |
| 78 | + DESCRIPTION=This bot is designed to help you with your daily tasks. |
| 79 | + ``` |
| 80 | + <Info>This parameter has maximum of **280 characters**.</Info> |
| 81 | + </Step> |
| 82 | + <Step title="AUTORESTART" icon="rotate"> |
| 83 | + The **AUTORESTART** parameter is used to define if your application should restart automatically if it crashes. |
| 84 | + ```systemd Example: |
| 85 | + AUTORESTART=true |
| 86 | + ``` |
| 87 | + <Info>By default, this parameter is set to `false`.</Info> |
| 88 | + </Step> |
| 89 | + <Step title="SUBDOMAIN" icon="globe"> |
| 90 | + The **SUBDOMAIN** parameter is used to define the subdomain of your website. |
| 91 | + ```systemd Example: |
| 92 | + SUBDOMAIN=mysite |
| 93 | + ``` |
| 94 | + <Info>This parameter has maximum of **63 characters**.</Info> |
| 95 | + <Note>Website url will be: mysite.squareweb.app</Note> |
| 96 | + </Step> |
| 97 | + <Step title="START" icon="play"> |
| 98 | + The **START** parameter is used to define a custom startup command for your application. |
| 99 | + ```systemd Example: |
| 100 | + START=npm run start |
| 101 | + ``` |
| 102 | + <Info>This parameter has maximum of **128 characters**.</Info> |
| 103 | + <Info>This parameter **ignores** the MAIN parameter, which is used to join Square's standardized initialization commands.</Info> |
| 104 | + </Step> |
| 105 | +</Steps> |
| 106 | + |
| 107 | + |
| 108 | +## Examples of configuration for bots |
| 109 | +We have some examples of configurations for bots, below you can see some examples. |
| 110 | + |
| 111 | +```systemd This example just use required parameters. (minimum configuration) |
| 112 | +MAIN=index.js |
| 113 | +MEMORY=256 |
| 114 | +VERSION=recommended |
| 115 | +DISPLAY_NAME=Robin bot |
| 116 | +``` |
| 117 | + |
| 118 | +```systemd This example is a bot with all parameters. |
| 119 | +MAIN=index.js |
| 120 | +MEMORY=256 |
| 121 | +VERSION=recommended |
| 122 | +DISPLAY_NAME=Robin bot |
| 123 | +DESCRIPTION=Robin is a bot designed to help you with your daily tasks. |
| 124 | +AUTORESTART=true |
| 125 | +``` |
| 126 | + |
| 127 | +```systemd This example use all parameters and CUSTOM STARTUP COMMAND in a bot. |
| 128 | +MAIN=index.js |
| 129 | +MEMORY=512 |
| 130 | +VERSION=recommended |
| 131 | +DISPLAY_NAME=Batman force |
| 132 | +START=npm run start |
| 133 | +``` |
| 134 | + |
| 135 | +## Examples of configuration for websites |
| 136 | +We have some examples of configurations for websites, below you can see some examples. |
| 137 | + |
| 138 | +<Info>Website url will be: mysite.squareweb.app</Info> |
| 139 | +```systemd This example use all parameters and CUSTOM STARTUP COMMAND in a website. |
| 140 | +MAIN=index.js |
| 141 | +MEMORY=512 |
| 142 | +VERSION=recommended |
| 143 | +DISPLAY_NAME=My website! |
| 144 | +DESCRIPTION=My website is very cool! |
| 145 | +SUBDOMAIN=mysite |
| 146 | +START=npm run build && npm run start |
| 147 | +AUTORESTART=true |
| 148 | +``` |
| 149 | + |
| 150 | +<Info>MAIN `next.config.js` used only to system recognize the project as a JavaScript project or TypeScript project (another .ts/.tsx file)</Info> |
| 151 | +```systemd Next.js website example. |
| 152 | +MAIN=next.config.js |
| 153 | +MEMORY=1024 |
| 154 | +VERSION=recommended |
| 155 | +DISPLAY_NAME=Next.js website |
| 156 | +DESCRIPTION=This website is built with Next.js. |
| 157 | +SUBDOMAIN=nextjs |
| 158 | +START=npm run build && npm run start |
| 159 | +AUTORESTART=true |
| 160 | +``` |
| 161 | + |
| 162 | +## Reforcing the limits |
| 163 | +For security and performance reasons, there are limits on the configuration parameters, below you can see the limits of each parameter. |
| 164 | + |
| 165 | +| Parameter | Character limit | |
| 166 | +| ------------- | --------------- | |
| 167 | +| MAIN | 32 characters | |
| 168 | +| DISPLAY_NAME | 32 characters | |
| 169 | +| DESCRIPTION | 280 characters | |
| 170 | +| START | 128 characters | |
| 171 | +| SUBDOMAIN | 63 characters | |
0 commit comments