99 أسطر
2.4 KiB
Markdown
99 أسطر
2.4 KiB
Markdown
# What is an Application?
|
||
|
||
When working with the Ghaymah CLI, an **Application** is the central resource you’ll interact with.
|
||
It’s not just source code it’s a deployable unit wrapped in a container, ready to run anywhere.
|
||
|
||
Think of an Application as the thing you **create, launch, update, and monitor** through the CLI.
|
||
Everything else like containers, configs, and logs revolves around it.
|
||
|
||
> **Note:** A **Project must be created first** before you can initialize or launch an Application.
|
||
> The Project acts as the parent workspace that organizes your Applications and related resources.
|
||
|
||
---
|
||
|
||
## Basic Usage
|
||
|
||
```bash
|
||
gy resource app [command]
|
||
```
|
||
|
||
Aliases: app, a
|
||
|
||
> **Tip:** You can use -h or --help to see all available options.
|
||
|
||
```bash
|
||
gy resource app --help
|
||
```
|
||
|
||
## creating an application
|
||
|
||
### step 1: Initialize the Application
|
||
|
||
Run the following command to create a new application:
|
||
|
||
```bash
|
||
gy resource app init -p project_id
|
||
```
|
||
|
||
>If you don’t know your project ID or haven’t created a project yet, see the [Projects](Project.md) documentation.
|
||
|
||
#### Flags
|
||
|
||
| Flag | what does it do | comment |
|
||
| ------------- | ------------------------- | ------------------------------------ |
|
||
| -p project_id | specifies the project id | required |
|
||
| -n name | Sets the application name | Optional, defaults to directory name |
|
||
|
||
### Step 2: deploying from a Dockerfile
|
||
|
||
To deploy using a **Dockerfile**, ensure that:
|
||
|
||
- A `Dockerfile` exists in the project directory.
|
||
- All necessary files referenced by the `Dockerfile` are present in the same directory.
|
||
|
||
Once these requirements are met, deploy the application with:
|
||
|
||
```bash
|
||
gy resource app launch
|
||
```
|
||
|
||
## Configuring the .ghaymah.json
|
||
|
||
Example `.ghaymah.json`
|
||
|
||
```json
|
||
{
|
||
"id": "ac2d8eb7-ff49-4b8d-9a8e-92cd3aae22a6",
|
||
"name": "nginx",
|
||
"projectId": "b887e332-3ecd-4187-bdfb-17d8a437833e",
|
||
"ports": [
|
||
{
|
||
"expose": true,
|
||
"number": 80
|
||
}
|
||
],
|
||
"publicAccess": {
|
||
"enabled": true,
|
||
"domain": "auto"
|
||
},
|
||
"resourceTier": "t1",
|
||
"dockerFileName": "Dockerfile"
|
||
}
|
||
```
|
||
|
||
### Changing values
|
||
|
||
You can change **name**, exposed port, and **dockerFileName** freely.
|
||
>you can only have one port per application.
|
||
>
|
||
### Adding environment variables
|
||
|
||
Add an `env` object to the top-level JSON.Example:
|
||
|
||
```json
|
||
"env": {
|
||
"foo": "bar",
|
||
"port": 8080
|
||
}
|
||
```
|