Creating first service¶
Service definitions are docker-compose.yml files, with addition of Harbor’s patterns which allows to automate and standardize the way of environment preparation.
- YAML files are stored at
- The naming:
apps.MY-APP-NAME.yamlfor applications, and
infrastructure.MY-TECHNICAL-APP-NAME.yamlfor technical services (health checks, backups etc.)
- Volumes with configuration files eg. nginx.conf - should be in
- Volumes with external git repositories should be in
- Volumes with dynamic data such as user uploads should be in
Generating a service from template using Cooperative¶
Best way to create a service is to use a generator - to avoid common mistakes.
harbor :cooperative:sync harbor :cooperative:install harbor/webservice
The below example will sync coop repositories, then use
harbor/webservice template to generate docker-compose yaml file,
that will be placed in
Creating a service - the manual way¶
Create a standard docker-compose format file in
./apps/conf directory, name it properly eg.
apps.adminer.yml and put following example contents:
version: 2.3 services: adminer: image: adminer restart: always environment: VIRTUAL_HOST: db.example.localhost VIRTUAL_PORT: "80" LETSENCRYPT_HOST: db.example.localhost LETSENCRYPT_EMAIL: firstname.lastname@example.org labels: org.riotkit.updateStrategy: "rolling"
Bringing up created service¶
:service:up task to bring up a recently created service.
harbor :service:list harbor :service:up service-name
After checking that everything works correctly the service definition + configuration files placed in
./container directory should be pushed to GIT.