## 1. Docker deployment

1. Modify `application-prod.yml` in the `fastbee-record` package according to the deployment environment. This service uses Redis cache, so update the Redis `host` and `password` as needed.
2. Build `fastbee-record.jar` and place it under `/data/zlmedia/record` in the deployment directory.
3. The Dockerfile used to package the container is located at `/docker/data/zlmedia/record` in the project. It packages `fastbee-record` and ZLMediaKit together.
4. Uncomment the related section in `docker-compose.yml`, then run `docker-compose up -d`.

```yaml
zlmedia-record:
  build:
    context: /var/data/zlmedia/record
  # image: zlmediakit/zlmediakit:master
  container_name: zlmedia-record
  privileged: true
  restart: always
  ports:
    - 18081:18081
    - 8082:80
    - 8443:443
    - 554:554
    - 1935:1935
    - 8000:8000
    - 30000-30100:30000-30100/udp
  expose:
    - "80"
    - "443"
    - "554"
    - "1935"
  volumes:
    - /var/data/zlmedia/record/fastbee-record.jar:/fastbee-record.jar
    - /var/data/zlmedia/record/logs:/opt/assist/logs
    - /var/data/zlmedia/logs:/opt/media/bin/log
    - /var/data/zlmedia/data/www:/opt/media/bin/www
    - /var/data/zlmedia/conf/config.ini:/opt/media/conf/config.ini
    - /var/data/zlmedia/conf/default.pem:/opt/media/bin/default.pem
  networks:
    network:
      ipv4_address: 177.7.0.15
```

## 2. Windows and Linux deployment

1. Install `ffmpeg` and `ffprobe`.
2. Modify the tool paths and recording path in the `fastbee-record` configuration file.
3. Run `fastbee-record.jar` and ZLMediaKit separately.
4. Start the record service:

```shell
java -jar /fastbee-record.jar &
```

`fastbee-record` configuration example:

```yaml
userSettings:
  # Required. Recording path configured in ZLMediaKit.
  record: /opt/media/bin/www/record

  # Required. ffmpeg path.
  ffmpeg: /usr/bin/ffmpeg

  # Required. ffprobe path. It is usually installed with ffmpeg and located in the same directory.
  # ffprobe is used to query media file information.
  ffprobe: /usr/bin/ffprobe
```

::: warning
`ffmpeg` and `ffprobe` must work together with ZLMediaKit. They are used to manage recording files on the streaming server.
:::

## 3. Switch recording APIs to HTTPS

::: tip
The latest master version supports switching recording APIs between HTTPS and HTTP. Update the code before using this capability.
:::

### 3.1 Download a JKS certificate

Reference document:

```text
https://help.aliyun.com/zh/ssl-certificate/user-guide/enable-https-on-spring-boot
```

### 3.2 Modify configuration and redeploy the JAR

Configuration fields:

* `enabled`: HTTPS enable switch.
* `key-store`: certificate path.
* `key-store-password`: certificate password.

```yaml
# Optional. HTTP port used by web pages and API calls.
# Replace domain_name.jks with your actual certificate name.
# Reference:
# https://help.aliyun.com/zh/ssl-certificate/user-guide/enable-https-on-spring-boot
server:
  port: 18081
  ssl:
    # Enable HTTPS access. Disabled by default.
    enabled: true
    # Certificate file path. Replace fastbee.online.jks with your actual certificate name.
    key-store: classpath:fastbee.online.jks
    # Certificate password.
    key-store-password: fastbee
    # Certificate type. Default is JKS. Adjust according to the actual certificate.
    key-store-type: JKS
```

### 3.3 Change the streaming server playback protocol to HTTPS

<img src="../../../../business/v2/install/images/zlmedia/record01.png" alt="3.3 Change the streaming server playback protocol to HTTPS" loading="lazy" style="border:1px solid #ccc;border-radius:6px;margin:8px 0;" />

## 4. Common issues

### 4.1 Change recording file length

```ini
# zlmedia/conf/config.ini
# Streaming service configuration file.
[record]
appName=record
fileBufSize=65536
filePath=./www
fileSecond=3600
sampleMS=500
fastStart=0
fileRepeat=0
```

In the Java `ZmlHookServiceImpl#onPublish` method:

```java
// playrecord
ret.put("mp4_max_second", 10);

// download
ret.put("mp4_max_second", 10);

// Default value is 10 seconds. Modify it according to your requirements.
```

### 4.2 Recording storage path

Camera recording files are stored under:

```text
zlmedia/data/www/record/
```
