Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENDOC-525 Create new ent CLI Services page #541

Merged
merged 4 commits into from
Aug 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions vuepress/docs/next/docs/getting-started/ent-svc.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,59 @@
---
sidebarDepth: 1
---

# Auxiliary Services

Auxiliary services add capabilities to a local environment to accelerate application development. This is in contrast to developing on Kubernetes, where the equivalent services are either provisioned by the Entando Platform or are externally managed and pointed to by the application.

The following sections describe how Entando supports and implements auxiliary services.

## Services

When the Entando Bundle CLI enables a service, a default auxiliary configuration is generated and stored as a Docker Compose YAML file in the bundle's 'svc' folder. Three services are available out of the box: `mysql`, `postgresql` and `keycloak`.

- `mysql` and `postgresql` obey the same naming convention
- The username and password are derived from the bundle name, e.g. YOUR-BUNDLE has the username YOUR-BUNDLE-USER and the password YOUR-BUNDLE-PASSWORD
- A database is automatically created and given the bundle name, e.g. YOUR-BUNDLE

- `keycloak` configures authentication for Entando
- The `keycloak` realm name is 'entando-dev'
- The console is accessible at *http://localhost:9080* with username: *admin*, password: *admin*
- All roles and permissions are preset, based on the Keycloak realm-config file
- The `keycloak.yaml`, realm-config and user config files are located in the 'keycloak' folder inside 'svc'

A custom service can be added to a bundle's 'svc' folder as a Docker Compose YAML file. The file and service must have the same name, e.g. if the service filename is `mysql.yml`, then the service name must be `mysql`:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a custom service can be added 'as' a Docker Compose... >> as sounds odd, maybe with?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the service is the file

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A Docker Compose file can contain multiple things. In this case it looks like Eng has a convention of 1 Docker Compose YAML File defining a single named service. So 'as' works for me.


``` yaml
version: '3.7'

services:
# since filename is mysql.yml, service name is 'mysql' as declared below:
mysql:
image: mysql
...
```

## Commands

Use `ent bundle svc` to enable, disable, start, stop, restart, print the logs of, or list services. Services must be formatted as Docker Compose YAML files in the 'svc' bundle folder.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems unnecessary as it is listed all below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't do any harm and introduces the ent bundle svc command


To run auxiliary operations, a service must be enabled. Enabled services are listed under the 'svc' attribute of the bundle descriptor, `entando.json`. Common auxiliary service commands are detailed below.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about 'auxiliary operations' here >> simplify >> a service must be enabled before it can be used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the service performs auxiliary operations. the current wording is precise and connects the dots.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This explanation does help me connect it all.


| Command | Description
| :- | :-
| `ent bundle svc enable <service_name>` | Adds the service(s) to the bundle’s auxiliary services
| `ent bundle svc disable <service_name>` | Removes the service(s) from the bundle’s auxiliary services
| `ent bundle svc start <service_name>` | Starts the enabled service(s)
| `ent bundle svc stop <service_name>` | Stops the enabled service(s)
| `ent bundle svc restart <service_name>` | Restarts the enabled service(s)
| `ent bundle svc logs <service_name>` | Prints the enabled service log(s)
| `ent bundle svc list` | Lists all enabled services

**Command details:**

- `svc logs`: The log of a running service will continue to update until exited via `Ctrl+C`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

until exited via Ctrl+C>> sounds awkward and don't think we need to back tick Ctrl-C

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disagree

we decided to backtick Ctrl+C a few months ago, and to use + instead of -

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got the sign wrong, meant to do + . Pretty sure we just decided on Ctrl+C but the backtick is not a big deal. (4-5-22)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that decision doesn't make any mention of backticking, so i'm going off of how ctrl+c is usually formatted on the developer site. i have no strong feelings about this. just aiming for consistency.


- `svc list`: Include the option `--available` to list all services located in the 'svc' bundle folder

- Auxiliary commands can operate on multiple services by listing each service name as an argument, e.g. `ent bundle svc start service_1 service_2`. The option `--all` applies the command to all enabled bundle services.