2023-03-09 00:45:48 +00:00
# Contributing to CasaOS AppStore
This document describes how to contribute an app to CasaOS AppStore.
2023-11-03 03:17:58 +00:00
**IMPORTANT**: Your PR must be *well tested* on your own CasaOS first. This is the mandatory first step for your submission.
2023-11-03 03:25:29 +00:00
**NOTE**: The legacy `appfile.json` is no longer supported since CasaOS v0.4.4. There is no need to include this file in your PR.
2023-11-03 03:31:20 +00:00
**NOTE**: Do not use `latest` tag for `image` . [What's Wrong With The Docker `:latest` Tag? ](https://github.com/IceWhaleTech/CasaOS-AppStore/issues/167 )
2023-08-04 02:55:55 +00:00
## Submit Process
2023-05-31 12:00:19 +00:00
App submission should be done via Pull Request. Fork this repository and prepare the app per guidelines below.
Once the PR is ready, create and assign your PR to anyone from CasaOS Team or some other contributor you trust.
2023-06-21 03:21:09 +00:00
## Guidelines
2023-05-25 20:38:19 +00:00
### Project Structure
2023-06-21 03:21:09 +00:00
```shell
2023-05-25 20:38:19 +00:00
CasaOS-AppStore
├─ category-list.json # Configuration file for category list
├─ recommend-list.json # Configuration file for recommended apps list
├─ featured-apps.json # TBD
├─ help # Help script for old version app store
├─ Apps # Apps Store files
├─ build # Installation script for Apps Store
└─ psd-source # Icon thumbnail screenshot PSD Templates
```
2023-06-21 03:21:09 +00:00
### A CasaOS App typically includes following files
2023-05-25 20:38:19 +00:00
2023-06-21 03:21:09 +00:00
```shell
2023-05-25 20:38:19 +00:00
App-Name
2023-06-21 03:21:09 +00:00
├─ docker-compose.yml # (Required) A valid Docker Compose file
├─ icon.png # (Required) App icon
├─ screenshot-1.png # (Required) At least one screenshot is needed, to demonstrate the app runs on CasaOS successfully.
├─ screenshot-2.png # (Optional) More screenshots to demonstrate different functionalities is highly recommended.
├─ screenshot-3.png # (Optional) ...
└─ thumbnail.png # (Optional) A thumbnail file is needed only if you want it to be featured in AppStore front. (see specification at bottom)
2023-05-25 20:38:19 +00:00
```
#### A CasaOS App is a Docker Compose app, or a *compose app*
2023-03-09 00:45:48 +00:00
Each directory under [Apps ](Apps ) correspond to a CasaOS App. The directory should contain at least a `docker-compose.yml` file:
2023-08-04 02:55:55 +00:00
- 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_-]*$` )
2023-03-09 00:45:48 +00:00
2023-05-26 00:26:50 +00:00
- Image tag should be specific, e.g. `:0.1.2` , instead of `:latest` .
> [What's Wrong With The Docker `:latest` Tag?](https://github.com/IceWhaleTech/CasaOS-AppStore/issues/167)
2023-03-09 00:45:48 +00:00
- The `name` property is used as the *store App ID* , which should be unique across all apps.
For example, in the [`docker-compose.yml` of Syncthing ](Apps/Syncthing/docker-compose.yml#L1 ), its store App ID is `syncthing` :
```yaml
name: syncthing
services:
syncthing:
2023-11-03 03:28:52 +00:00
image: linuxserver/syncthing:< specific version >
2023-03-09 00:45:48 +00:00
...
```
2023-04-06 20:20:58 +00:00
- Language codes are case sensitive and should be in all lower case, e.g. `en_us` , `zh_cn` .
2023-05-19 14:06:29 +00:00
- There are few system wide variables can be used in `environment` and `volumes` :
```yaml
environment:
2023-05-25 20:38:19 +00:00
PGID: $PGID # Preset Group ID
PUID: $PUID # Preset User ID
TZ: $TZ # Current system timezone
2023-05-19 14:06:29 +00:00
...
volumes:
- type: bind
source: /DATA/AppData/$AppID/config # $AppID = app name, e.g. syncthing
```
2023-03-09 00:45:48 +00:00
- CasaOS specific metadata, also called *store info* , are stored under [extension ](https://docs.docker.com/compose/compose-file/#extension ) property `x-casaos` at two positions.
1. Service level
A `docker-compose.yml` file can contain one or more `services` . Each [service ](https://docs.docker.com/compose/compose-file/#services-top-level-element ) can have its own store info.
For the same example, at the buttom of the `syncthing` service in the [`docker-compose.yml` of Syncthing ](Apps/Syncthing/docker-compose.yml )
```yaml
x-casaos:
2023-05-25 20:38:19 +00:00
envs: # description of each environment variable
2023-03-09 00:45:48 +00:00
...
- container: PUID
description:
2023-04-06 20:20:58 +00:00
en_us: Run Syncthing as specified uid.
2023-05-25 20:38:19 +00:00
ports: # description of each port
2023-03-09 00:45:48 +00:00
- container: "8384"
description:
2023-04-06 20:20:58 +00:00
en_us: WebUI HTTP Port
2023-03-09 00:45:48 +00:00
...
2023-05-25 20:38:19 +00:00
volumes: # description of each volume
2023-03-09 00:45:48 +00:00
- container: /config
description:
2023-04-06 20:20:58 +00:00
en_us: Syncthing config directory.
2023-03-09 00:45:48 +00:00
- container: /DATA
description:
2023-04-06 20:20:58 +00:00
en_us: Syncthing Accessible Directory.
```
2023-08-03 02:25:42 +00:00
2. Compose app level
2023-04-06 20:20:58 +00:00
2023-05-10 04:03:52 +00:00
For the same example, at the bottom of the [`docker-compose.yml` of Syncthing ](Apps/Syncthing/docker-compose.yml )
2023-04-06 20:20:58 +00:00
```yaml
x-casaos:
2023-05-25 20:38:19 +00:00
architectures: # a list of architectures that the app supports
2023-04-06 20:20:58 +00:00
- amd64
- arm
- arm64
2023-05-25 20:38:19 +00:00
main: syncthing # the name of the main service under `services`
2023-04-06 20:20:58 +00:00
author: CasaOS Team
category: Backup
2023-05-25 20:38:19 +00:00
description: # multiple locales are supported
2023-04-06 20:20:58 +00:00
en_us: Syncthing is a continuous file synchronization program. It synchronizes files between two or more computers in real time, safely protected from prying eyes. Your data is your data alone and you deserve to choose where it is stored, whether it is shared with some third party, and how it's transmitted over the internet.
developer: Syncthing
icon: https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@main/Apps/Syncthing/icon.png
2023-05-25 20:38:19 +00:00
tagline: # multiple locales are supported
2023-04-06 20:20:58 +00:00
en_us: Free, secure, and distributed file synchronisation tool.
thumbnail: https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@main/Apps/Jellyfin/thumbnail.jpg
2023-05-25 20:38:19 +00:00
title: # multiple locales are supported
2023-04-06 20:20:58 +00:00
en_us: Syncthing
2023-05-10 04:03:52 +00:00
tips:
before_install:
en_us: |
2023-05-10 04:04:45 +00:00
(some notes for user to read prior to installation, such as preset `username` and `password` - markdown is supported!)
2023-05-25 20:38:19 +00:00
index: / # the index page for web UI, e.g. index.html
port_map: "8384" # the port for web UI
2023-04-06 20:20:58 +00:00
```
2023-05-25 20:38:19 +00:00
2023-08-03 02:25:42 +00:00
3. Magic Value
2023-08-04 02:55:55 +00:00
2023-08-03 02:25:42 +00:00
**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:
2023-08-04 02:55:55 +00:00
- 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.
2023-08-03 02:25:42 +00:00
2023-06-21 03:21:09 +00:00
## Requirements for Featured Apps
Once in a while, we pick certain apps as featured apps and display them at the AppStore front. The standard for apps to be featured is a bit higher than rest of the apps:
2023-05-25 20:38:19 +00:00
- Icon image should be a transparent background PNG image with a size of 192x192 pixels.
- Thumbnail image should be 784x442 pixels, with a rounded corner mask. It is recommended to be saved as a PNG image with a transparent background.
- Screenshot image should be 1280x720 pixels and can be saved in either PNG or JPG format. Please try to keep the file size as small as possible.
Please find the prepared [PSD template files ](psd-source ), to quickly create the above images if you need.
2023-06-21 03:21:09 +00:00
If you have any feedback and suggestion about this contributing process, please let us know via Discord or Issues immediately. Thanks!