Skip to content

Commit

Permalink
update CONTRIBUTING.md with a requirement for Docker Compose name p…
Browse files Browse the repository at this point in the history
…roperty (#235)
  • Loading branch information
tigerinus authored Aug 4, 2023
1 parent 9a7e09b commit 9275a66
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Apps/Mongo/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: MongoDB
name: mongodb
services:
mongo:
image: mongo:6.0.6
Expand Down
101 changes: 50 additions & 51 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This document describes how to contribute an app to CasaOS AppStore.

## Submit Process
## Submit Process

App submission should be done via Pull Request. Fork this repository and prepare the app per guidelines below.

Expand Down Expand Up @@ -39,7 +39,9 @@ App-Name

Each directory under [Apps](Apps) correspond to a CasaOS App. The directory should contain at least a `docker-compose.yml` file:

- It should be a valid [Docker Compose file](https://docs.docker.com/compose/compose-file/).
- It should be a valid [Docker Compose file](https://docs.docker.com/compose/compose-file/). Here are some requirements (but not limited to):

- `name` must contain only lower case letters, numbers, underscore "`_`" and hyphen "`-`" (in other words, must match `^[a-z0-9][a-z0-9_-]*$`)

- Image tag should be specific, e.g. `:0.1.2`, instead of `:latest`.

Expand Down Expand Up @@ -132,59 +134,56 @@ Each directory under [Apps](Apps) correspond to a CasaOS App. The directory shou
```
3. Magic Value
**Note**: The features is only working in casaos 0.4.4 and newer version.
For resolves some cases. Casaos provide some magic value to power your application:
- Any environment variable that user to set
- $WEBUI_PORT
##### Environment variable
> for developer
your application can read environment variable that user set, such as `OPENAI_API_KEY` from environment variable. It is store in `/etc/casaos/env`. User can set only once and using anywhere. It can be change by api, after change, all application will re up to inject new env var.

**Note**: change the config didn't change the env var of current container. To set env var, you should use cli to set it.
#### WEBUI_PORT
> for application maintainer

your `docker-compose.yml` can use `WEBUI_PORT` to set webui port. Casaos will assign a available port for your application. You can use it like this:

```yaml
...
ports:
- target: 5230
published: ${WEBUI_PORT}
protocol: tcp
...
x-casaos:
architectures:
- amd64
- arm64
- arm
...
port_map: ${WEBUI_PORT}
```
or
```yaml
...
ports:
- target: 5230
published: ${WEBUI_PORT:-5230}
protocol: tcp
...
x-casaos:
architectures:
- amd64
- arm64
- arm
...
port_map: ${WEBUI_PORT:-5230}
```

**Note**: the WEBUI_PORT only allocated once. It promise the port is available when allocated. If the port be used by other application. It didn't reallocate a new port.
- Environment variable
your application can read environment variable that user set, such as `OPENAI_API_KEY` from environment variable. It is store in `/etc/casaos/env`. User can set only once and using anywhere. It can be change by api, after change, all application will re up to inject new env var.

**Note**: change the config didn't change the env var of current container. To set env var, you should use cli to set it.

- `WEBUI_PORT`

your `docker-compose.yml` can use `WEBUI_PORT` to set webui port. Casaos will assign a available port for your application. You can use it like this:

```yaml
...
ports:
- target: 5230
published: ${WEBUI_PORT}
protocol: tcp
...
x-casaos:
architectures:
- amd64
- arm64
- arm
...
port_map: ${WEBUI_PORT}
```

or

```yaml
...
ports:
- target: 5230
published: ${WEBUI_PORT:-5230}
protocol: tcp
...
x-casaos:
architectures:
- amd64
- arm64
- arm
...
port_map: ${WEBUI_PORT:-5230}
```

**Note**: the WEBUI_PORT only allocated once. It promise the port is available when allocated. If the port be used by other application. It didn't reallocate a new port.

## Requirements for Featured Apps

Expand Down

0 comments on commit 9275a66

Please sign in to comment.