# Flexisip 2.4.1, Flexisip Account Manager on Podman (minikube, kubernetes)

**URL:** <https://forum.ficusonline.com/t/topic/527>\
**Category:** Server\
**Created:** [2025 年 4 月 22 日午前 8:20 UTC](https://forum.ficusonline.com/t/topic/527 "2025-04-22T08:20:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2025 年 4 月 22 日午前 8:20 UTC](https://forum.ficusonline.com/t/topic/527/1 "2025-04-22T08:20:07Z")

</div>

FlexisipのPodmanベースの動作検証（コンテナ）から開始し、コンテナからPod構成へ移行、最終的にはKubernetesクラスタ上での動作確認まで一連の検証を行います。

Podmanを利用したコンテナ構成では、Dockerによるそれと異なり、アカウントマネージャコンテナ(php-fpm)とFlexisipコンテナを完全分離します。

 ![podman-flexisip-system](https://forum.ficusonline.com/uploads/default/original/2X/8/81b4aab45d6b1d8996e940dccab3840b23ce1d7a.png)

 ![Screenshot from 2025-05-15 07-46-42](https://forum.ficusonline.com/uploads/default/original/2X/7/7821ccf877d493e60fdd1e99a33cd8a2264307a3.png)

#### Flexisip Ver.2.4.1

[https://gitlab.linphone.org/BC/public/flexisip/-/tree/release/2.4](https://gitlab.linphone.org/BC/public/flexisip/-/tree/release/2.4)

- **Dockerfile**

```auto
# https://wiki.linphone.org/xwiki/wiki/public/view/Flexisip/1.%20Installation/    
RUN echo 'deb [arch=amd64] http://linphone.org/snapshots/ubuntu jammy stable' > /etc/apt/sources.list.d/belledonne.list
RUN wget https://www.linphone.org/snapshots/ubuntu/pubkey.gpg -O - | apt-key add -
RUN apt-get update && apt-get install -y bc-flexisip

```

#### Flexisip Account Manager Ver.1.6

> **[ファイル · release/1.6 · BC / public / flexisip-account-manager · GitLab](https://gitlab.linphone.org/BC/public/flexisip-account-manager/-/tree/release/1.6)**
>
> Belledonne-Communications Gitlab

#### Lime Server Ver.1.3

> **[ファイル · release/1.3 · BC / public / lime-server · GitLab](https://gitlab.linphone.org/BC/public/lime-server/-/tree/release/1.3)**
>
> Belledonne-Communications Gitlab

#### File Transfer Server Ver.1.1

> **[ファイル · release/1.1 · BC / public / flexisip-http-file-transfer-server · GitLab](https://gitlab.linphone.org/BC/public/flexisip-http-file-transfer-server/-/tree/release/1.1)**
>
> A PHP script managing file transfer according to Rich Communications Service recommendation : RCC.07 v6.0 section 3.5.4.8 File Transfer via HTTP.

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2025 年 4 月 22 日午前 8:41 UTC](https://forum.ficusonline.com/t/topic/527/2 "2025-04-22T08:41:12Z")

</div>

## トラブルシュート

> #### mysqli::real\_connect(): (HY000/1040): Too many connections

 ![phpmyadmin](https://forum.ficusonline.com/uploads/default/original/2X/c/cc18408bce9e41cff86f8b31d10c2cebc0620ded.png)

MariaDB/MySQL の接続上限\*\* (`max_connections`) を超えたため、新しい接続を拒否。アカウントマネージャの500エラー、SIPアカウントの登録エラー。

```shell
$ podman compose exec flexisip-mariadb bash

```

```sql
# mysql -u root -p
MariaDB [(none)]> SHOW FULL PROCESSLIST;
+-----+-----------------+----------------+----------+---------+------+-----------------------------+-----------------------+----------+
| Id | User | Host | db | Command | Time | State | Info | Progress |
+-----+-----------------+----------------+----------+---------+------+-----------------------------+-----------------------+----------+
| 1 | event_scheduler | localhost | NULL | Daemon | 1132 | Waiting for next activation | NULL | 0.000 |
| 4 | flexisip | 10.8.8.5:40800 | flexisip | Sleep | 1132 | | NULL | 0.000 |
| 5 | flexisip | 10.8.8.5:40804 | flexisip | Sleep | 1132 | | NULL | 0.000 |
| 6 | flexisip | 10.8.8.5:40806 | flexisip | Sleep | 1132 | | NULL | 0.000 |
| 7 | flexisip | 10.8.8.5:40818 | flexisip | Sleep | 1132 | | NULL | 0.000 |
| 8 | flexisip | 10.8.8.5:40828 | flexisip | Sleep | 1132 | | NULL | 0.000 |
| 9 | flexisip | 10.8.8.5:40830 | flexisip | Sleep | 1132 | | NULL | 0.000 |
| 10 | flexisip | 10.8.8.5:40834 | flexisip | Sleep | 1132 | | NULL | 0.000 |
.....
.....
.....
| 153 | flexisip | 10.8.8.5:42140 | flexisip | Sleep | 1132 | | NULL | 0.000 |
| 154 | flexisip | 10.8.8.5:42146 | flexisip | Sleep | 1132 | | NULL | 0.000 |
| 162 | root | localhost | NULL | Query | 0 | starting | SHOW FULL PROCESSLIST | 0.000 |
+-----+-----------------+----------------+----------+---------+------+-----------------------------+-----------------------+----------+
153 rows in set (0.001 sec)

```

原因はFlexisipの以下の設定でMariaDBのデフォルトの上限接続数が150を超えたため。以下のFlexisipで設定した接続数を見直すか、MariaDBコンテナの上限接続数を変更する環境変数 : `--max-connections=500` をdocker-compose.ymlファイルに追加。

`flexisip.conf`

```ini
[presence-server]

# Max number of threads.
# Default: 50
rls-database-max-thread=50

[module::Authentication]

# Size of the pool of connections that Soci will use. A thread is
# opened for each DB query, and this pool will allow each thread
# to get a connection.
# The threads are blocked until a connection is released back to
# the pool, so increasing the pool size will allow more connections
# to occur simultaneously.
# On the other hand, you should not keep too many open connections
# to your DB at the same time.
# Default: 100
soci-poolsize=100

```

`docker-compose.yml`

```auto
##### mariadb
  mariadb-flexisip:
    container_name: mariadb-flexisip
    image: mariadb
    restart: unless-stopped
    ports:
      - 3306:3306
    command: --event-scheduler=ON --max-connections=500

```

* * *

#### flexisi-account-managerのfirebase環境変数名変更

flexisip-account-manager Ver.1.5以降APP\_FLEXISIP\_PUSHER\_FIREBASE\_KEY から **APP\_FLEXISIP\_PUSHER\_FIREBASE\_KEYSMAP** へ変更

`flexiapi/.env`

```ini
APP_LINPHONE_DAEMON_UNIX_PATH=/tmp/ld
APP_FLEXISIP_PUSHER_PATH=/opt/belledonne-communications/bin/flexisip_pusher
# APP_FLEXISIP_PUSHER_FIREBASE_KEY=xxxxxxxxxx
APP_FLEXISIP_PUSHER_FIREBASE_KEYSMAP=xxxxxxxxxx

```

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2025 年 4 月 26 日午前 4:04 UTC](https://forum.ficusonline.com/t/topic/527/3 "2025-04-26T04:04:08Z")

</div>

## Podman REST API

Flexisip-Account-ManagerコンテナからFlexisipコンテナへのAPIリクエスト

Podmanを動かすユーザー側で以下を実行（podman composeコマンドを有効にするため既に実行済）。

```shell
$ systemctl --user enable --now podman.socket

```

これで Podman の REST API ソケットが起動します。パスは以下のようになります。

- rootless（ユーザー）: `/run/user/1000/podman/podman.sock`
- root権限: `/run/podman/podman.sock`

#### Podman REST API : exec

> **[Reference](https://docs.podman.io/en/latest/_static/api.html?version=v4.9#tag/exec/operation/ContainerExecLibpod)**

rootlessモードのAPIソケットを、php-fpm(Laravel)コンテナと共有するため、ボリュームマッピングを追加。

このソケットを介して、flexisipコンテナのflexisip\_pusherの実行をリクエストできるようにします。

`docker-compose.yml`

```yaml
......
......
  php-fpm:
    container_name: php-fpm
    .....
    .....
    volumes:
      ......
      ......
      # for execution of flexisip_pusher on ubuntu-flexisip container by podman api socket
      - /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock
      .....
      .....

```

php-fpmコンテナ内でcurlによるテストを実施

実行セッションを作成（セッションID取得）

```shell
# curl --unix-socket /run/user/1000/podman/podman.sock \
 -X POST http://d/v4.0.0/libpod/containers/ubuntu-flexisip/exec \
 -H "Content-Type: application/json" \
 -d '{                                                                                                                             
        "Cmd": ["/opt/belledonne-communications/bin/flexisip_pusher", "--pn-provider", "xxx", "--pn-param", "yyy", "--pn-prid", "zzz", "--customPayload", "{\"token\":\"abc123\"}"],
        "AttachStdout": true,
        "AttachStderr": true
      }'

{"Id":"45317c07503b74f6c807ac0cc85f8651eff882d8cf0857340236039c644340af"}

```

セッションIDを指定して実行

```shell
# curl --unix-socket /run/user/1000/podman/podman.sock \
 -X POST http://d/v4.0.0/libpod/exec/45317c07503b74f6c807ac0cc85f8651eff882d8cf0857340236039c644340af/start \
 -H "Content-Type: application/json" \
 -d '{"Detach":false,"Tty":false,"AttachStdout":true,"AttachStderr":true}' \
 --output -

VWriting logs in : /var/opt/belledonne-communications/log/flexisip/flexisip-pusher.log
DError, caught an unexpected exception: provider [xxx] not supported
O2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [B2bua]...
2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [DoSProtection]...
2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [Authentication]...
2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [Capabilities]...
�2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [ContactRouteInserter]...
2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [Forward]...
�2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [GarbageIn]...
2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [GatewayAdapter]...
V2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [LoadBalancer]...
�2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [MediaRelay]...
2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [NatHelper]...
R2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [Redirect]...
�2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [Presence]...
2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [PushNotification]...
�2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [RegEvent]...
2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [Registrar]...
�2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [Router]...
2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [SanityChecker]...
]2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [StatisticsCollector]...
T2025-04-26 02:06:11:590 flexisip-message- Unregistering module info [Transcoder]...

```

**sendToke()** をAPIリクエスト対応へ入換え（追加箇所のみ掲載）

`flexiapi/app/Libraries/FlexisipPusherConnector.php`

```php

use Illuminate\Support\Facades\Http;

   public function sendToken(string $token)
    {
        $payload = json_encode(['token' => $token]);
    
        if (!empty($this->pusherPath)) {

            $cmd = [
                $this->pusherPath,
                '--pn-provider', $this->pnProvider,
                '--pn-param', $this->pnParam,
                '--pn-prid', $this->pnPrid,
                '--customPayload', $payload,
            ];
    
            if (in_array($this->pnProvider, ['apns', 'apns.dev'])) {
                $cmd[] = '--apple-push-type';
                $cmd[] = 'Background';
            }
    
            if ($this->pusherFirebaseKey) {
                $cmd[] = '--key';
                $cmd[] = $this->pusherFirebaseKey;
            }
    
            $containerId = 'ubuntu-flexisip';
            $socketPath = '/run/user/1000/podman/podman.sock';
    
            // create exec session 
            $execCreate = Http::withOptions([
                'curl' => [
                    CURLOPT_UNIX_SOCKET_PATH => $socketPath,
                ]
            ])->withHeaders([
                'Content-Type' => 'application/json',
            ])->post("http://d/v4.0.0/libpod/containers/{$containerId}/exec", [
                'cmd' => $cmd,
                'tty' => false,
                'detach' => false,
            ]);
    
            if (!$execCreate->successful()) {
                Log::error('Failed to create exec session', ['body' => $execCreate->body()]);
                return false;
            }
    
            $execId = $execCreate->json()['Id'] ?? null;
            if (!$execId) {
                Log::error('Exec ID missing');
                return false;
            }
    
            // execute exec session
            $execStart = Http::withOptions([
                'curl' => [
                    CURLOPT_UNIX_SOCKET_PATH => $socketPath,
                ]
            ])->withHeaders([
                'Content-Type' => 'application/json',
            ])->post("http://d/v4.0.0/libpod/exec/{$execId}/start", [
                'Detach' => false,
                'Tty' => false,
            ]);
    
            if (!$execStart->successful()) {
                Log::error('Failed to start exec session', ['body' => $execStart->body()]);
                return false;
            }
    
            Log::info('Pusher executed via Podman', ['output' => $execStart->body()]);
            return true;
        }
    
        Log::error('Pusher path not configured');
        return false;
    }   

```

* * *

#### sendToken()テスト

> **[PHPUnit: The testing framework for PHP](https://phpunit.de/index.html)**
>
> PHPUnit is the industry-leading test automation framework for software built using PHP.

> **[PHPUnit Manual — PHPUnit 9.6 Manual](https://docs.phpunit.de/en/9.6/)**

`tests/Feature/FlexisipPusherTest.php`

```php
<?php

namespace Tests\Feature;

use Tests\TestCase;
use App\Libraries\FlexisipPusherConnector;

class FlexisipPusherTest extends TestCase
{
    public function test_send_token()
    {
        // Dummy data for testing
        $provider = 'fcm';
        $param = 'yourappid';
        $prid = 'yourprid';
        $token = 'dummy_push_token';

        // Create instance
        $pusher = new FlexisipPusherConnector($provider, $param, $prid);

        // Execute
        $result = $pusher->sendToken($token);

        // Assert the result
        $this->assertTrue($result, 'Pusher should return true');
    }
}

```

テスト実行

```shell
# php artisan test --filter=FlexisipPusherTest

```

またはPHPUnitで直接実行

```shell
# vendor/bin/phpunit --filter=FlexisipPusherTest

```

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2025 年 5 月 9 日午後 2:14 UTC](https://forum.ficusonline.com/t/topic/527/4 "2025-05-09T14:14:06Z")

</div>

#### flexisip\_pusher help

```shell
# /opt/belledonne-communications/bin/flexisip_pusher --help
usage: /opt/belledonne-communications/bin/flexisip_pusher [options] --pn-provider {apns,apns.dev,fcm} --pn-param <param> --pn-prid <prid> [<prid> ...]

A tool to send push notifications to Android and iOS applications, based on parameters defined by RFC8599.

Mandatory parameters:
---------------------
  --pn-provider {apns,apns.dev,fcm} The service in charge to send the push notification.
                                       * 'apns' for iOS production applications;
                                       * 'apns.dev' for iOS development applications;
                                       * 'fcm' for Android applications.

  --pn-param <param> Provider specific ID of the application.
                                       * Android: Firebase Project ID.
                                       * iOS: <TeamID>.<BundleID>[.voip], where '.voip' is only added
                                                    for VoIP push notification.

  --pn-prid <prid> Provider specific ID of the targeted application instance.
                                       * Android: Registration token.
                                       * iOS: Device token.

General options:
----------------
  -h, --help Show this help message and exit.
  --debug Print all debug messages on the standard output.

  --customPayload <payload> Add custom parameters in the PN request body. <payload> must be a JSON structure
								     and will be placed in the top-level JSON attribute.

  --call-id <callID> Call-ID to use in the push notification payload.

Android specific options:
-------------------------
  --key <SecretKey> Specify the secret key to put in the HTTP/2 headers to be authenticated
                                     by Firebase push notification service.

iOS specific options:
---------------------
  --prefix <path> Path to the directory where the APNS certificates are stored. The certificates
                                     must actually be placed in a subdirectory named 'apns' just like a standard
                                     Flexisip configuration directory.

  --apple-push-type {Background,RemoteWithMutableContent,PushKit}
                                     The kind of push notification to send to the iOS device. Default: PushKit.
                                       * Background: only wake the application up without displaying anything to
                                         the user;
                                       * RemoteWithMutableContent: a message is displayed to the user;
                                       * PushKit: require the application to use CallKit API to display the incoming
                                         call view.

Examples:
---------
* Send a data push notification to an Android application:

    ./flexisip_pusher --key '<SecretKey>' --pn-provider 'fcm' --pn-param '<ProjectID>' --pn-prid '<token>'

* Send a data push notification to an Android application using FirebaseV1 API:

    ./flexisip_pusher --key '<FirebaseServiceAccountFile>' --pn-provider 'fcm' --pn-param '<ProjectID>' --pn-prid '<token>'

* Send a remote message push notification to an iOS production application:

    ./flexisip_pusher --prefix /etc/flexisip --pn-provider 'apns' --pn-param '<TeamID>.<BundleID>'
                      --pn-prid '<token>' --apple-push-type RemoteWithMutableContent

* Send a remote message push notification to an iOS development application:

    ./flexisip_pusher --prefix /etc/flexisip --pn-provider 'apns.dev' --pn-param '<TeamID>.<BundleID>'
                      --pn-prid '<token>' --apple-push-type RemoteWithMutableContent

* Send a VoIP push notification to an iOS production application:

    ./flexisip_pusher --prefix /etc/flexisip --pn-provider 'apns' --pn-param '<TeamID>.<BundleID>.voip'
                      --pn-prid '<token>' --apple-push-type PushKit

* Send a background push notification (remote PN without alert section) to an iOS production application:

    ./flexisip_pusher --prefix /etc/flexisip --pn-provider 'apns' --pn-param '<TeamID>.<BundleID>'
                      --pn-prid '<token>' --apple-push-type Background

Environment Variables:
----------------------
  FS_LOG_DIR The directory to write logs into. Defaults to /var/opt/belledonne-communications/log/flexisip

```

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2025 年 5 月 14 日午前 2:16 UTC](https://forum.ficusonline.com/t/topic/527/5 "2025-05-14T02:16:48Z")

</div>

## Podによる構成

 ![podman-flexisip-pod-system](https://forum.ficusonline.com/uploads/default/original/2X/b/be22d1e7ef57256ed7fbe40714e0144fbe56bc9c.png)

### **Podと役割**

| Pod名 | ホスト名（コンテナ） | 用途/サービス | ポート公開 |
| --- | --- | --- | --- |
| `pod-nginx` | `nginx.flexisip` | リバースプロキシ (Let’s Encrypt対応) | `9080`, `9443` |
| `pod-apache` | `apache.flexisip` | HTTPファイル転送サーバ (HFT) | `8080`, `8443` |
| `pod-php-fpm` | `php-fpm.flexisip` | LaravelベースのAccount Manager | `9000` |
| `pod-mariadb` | `mariadb.flexisip` | データベース (MariaDB) | `3306` |
| `pod-phpmyadmin` | `phpmyadmin.flexisip` | DB管理ツール | `9000` (Nginx経由) |
| `pod-redis` | `redis.flexisip` | Redisキャッシュ | `6379` |
| `pod-flexisip` | `sip-proxy.flexisip` | Flexisipコア (SIP/UDP対応) | `5060`, `5061`, `3478`, `10000-10500/UDP` |

### `Network`

```shell
$ podman network create \
  --subnet 10.8.8.0/24 \
  --ip-range 10.8.8.0/24 \
  --gateway 10.8.8.1 \
  --ipv6 \
  --subnet fd6c::8::/64 \
  --gateway fd6c::8::1 \
  net.flexisip

```

### `pod-redis`

```shell
$ podman pod create \
  --name pod-redis \
  --hostname redis.flexisip \
  --network net.flexisip \
  --ip 10.8.8.2 \
  --ip6 fd6c::8::2 \
  -p 127.0.0.1:6379:6379

$ podman create \
  --name redis \
  --pod pod-redis \
  --restart=always \
  -v $(pwd)/redis:/etc/redis \
  redis:alpine \
  redis-server /etc/redis/redis.conf
  
$ echo 'vm.overcommit_memory=1' | sudo tee -a /etc/sysctl.conf
$ sudo sysctl -p

```

### `pod-nginx`

```shell
$ podman pod create \
  --name pod-nginx \
  --hostname nginx.flexisip \
  --network net.flexisip \
  --ip 10.8.8.3 \
  --ip6 fd6c::8::3 \
  -p 8080:80 \
  -p 8443:443

$ podman create \
  --name nginx \
  --pod pod-nginx \
  --restart=always \
  -v $(pwd)/nginx:/etc/nginx/conf.d \
  -v $(pwd)/letsencrypt:/etc/letsencrypt \
  -v $(pwd)/flexisip-account-manager/flexiapi:/var/www/html/flexiapi \
  -v phpmyadmin:/var/www/html/phpmyadmin \
  -v $(pwd)/lime-server/lime:/var/www/html/lime \
  nginx:alpine

```

### `pod-apache`

```shell
$ podman pod create \
  --name pod-apache \
  --hostname apache.flexisip \
  --network net.flexisip \
  --ip 10.8.8.4 \
  --ip6 fd6c::8::4 \
  -p 9080:80 \
  -p 9443:443

$ podman create \
  --name apache \
  --pod pod-apache \
  --restart=always \
  -v $(pwd)/apache/httpd_ft.conf:/usr/local/apache2/conf/httpd.conf \
  -v $(pwd)/apache/extra/httpd-ssl.conf:/usr/local/apache2/conf/extra/httpd-ssl.conf \
  -v $(pwd)/letsencrypt:/etc/letsencrypt \
  -v $(pwd)/hft:/opt/belledonne-communications/share/flexisip-http-file-transfer-server \
  -v $(pwd)/hft-tmp:/var/opt/belledonne-communications/flexisip-http-file-transfer-tmp \
  -v $(pwd)/hft_conf/flexisip-http-file-transfer-server.conf:/etc/flexisip-http-file-transfer-server/flexisip-http-file-transfer-server.conf \
  -v $(pwd)/log/flexisip-http-file-transfer-server.log:/var/opt/belledonne-communications/log/flexisip-http-file-transfer-server.log \
  httpd:alpine

```

### `pod-mariadb`

```shell
$ podman pod create \
  --name pod-mariadb \
  --hostname mariadb.flexisip \
  --network net.flexisip \
  --ip 10.8.8.5 \
  --ip6 fd6c::8::5 \
  -p 127.0.0.1:3306:3306

$ podman create \
  --pod pod-mariadb \
  --name mariadb \
  --restart=always \
  --env-file $(pwd)/.env \
  -v $(pwd)/db:/var/lib/mysql \
  mariadb:11.7 \
  --event-scheduler=ON \
  --max-connections=300

```

### `pod-flexisip`

```shell
$ podman pod create \
  --name pod-flexisip \
  --hostname sip-proxy.flexisip \
  --network host
  
$ podman build -f $(pwd)/docker_files/flex-from-ubuntu22-apt-repo-24 -t ubuntu-flexisip:20250514 $(pwd)/docker_files

$ podman create \
  --pod pod-flexisip \
  --name flexisip \
  --restart=always \
  -v $(pwd)/letsencrypt:/etc/letsencrypt \
  -v $(pwd)/flexisip_conf:/etc/flexisip \
  -v $(pwd)/linphone:/root/.local/share/linphone \
  -v $(pwd)/tmp/ld:/tmp/ld \
  -v $(pwd)/firebase/flexisip-push-notification-firebase-adminsdk-fbsvc-xxxxxxxx.json:/etc/flexisip/flexisip-push-notification-firebase-adminsdk-fbsvc-xxxxxxxx.json \
  ubuntu-flexisip:20250514 ""

```

### `pod-php-fpm`

```shell
$ podman pod create \
  --name pod-php-fpm \
  --hostname php-fpm.flexisip \
  --network net.flexisip \
  --ip 10.8.8.6 \
  --ip6 fd6c::8::6
  
$ podman build -f $(pwd)/docker_files/php-fpm-alpine-laravel -t php-fpm-8.2:20250514 $(pwd)

$ podman create \
  --pod pod-php-fpm \
  --name php-fpm \
  --restart=always \
  -v $(pwd)/php-fpm_conf/php.ini:/usr/local/etc/php/php.ini \
  -v $(pwd)/flexisip-account-manager/flexiapi:/var/www/html/flexiapi \
  -v $(pwd)/xmlrpc:/opt/belledonne-communications/share/flexisip-account-manager/xmlrpc \
  -v $(pwd)/tmp/ld:/tmp/ld \
  -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock \
  -v $(pwd)/firebase/flexisip-push-notification-firebase-adminsdk-fbsvc-xxxxxxxx.json:/etc/flexisip/flexisip-push-notification-firebase-adminsdk-fbsvc-xxxxxxxx.json \
  -v $(pwd)/hft:/opt/belledonne-communications/share/flexisip-http-file-transfer-server \
  -v $(pwd)/hft-tmp:/var/opt/belledonne-communications/flexisip-http-file-transfer-tmp \
  -v $(pwd)/hft_conf/flexisip-http-file-transfer-server.conf:/etc/flexisip-http-file-transfer-server/flexisip-http-file-transfer-server.conf \
  -v $(pwd)/log/flexisip-pusher.log:/var/opt/belledonne-communications/log/flexisip/flexisip-pusher.log \
  -v $(pwd)/log/flexisip-http-file-transfer-server.log:/var/opt/belledonne-communications/log/flexisip-http-file-transfer-server.log \
  -v $(pwd)/lime-server/lime:/var/www/html/lime \
  -v $(pwd)/lime-server/lime-server.conf:/etc/lime-server/lime-server.conf \
  -v $(pwd)/lime-server/log/lime-server:/var/opt/belledonne-communications/log/lime-server \
  -v $(pwd)/log/php_errors.log:/var/log/php/php_errors.log \
  php-fpm-8.2:20250514

```

### `pod-phpmyadmin`

```shell
$ podman pod create \
  --name pod-phpmyadmin \
  --hostname phpmyadmin.flexisip \
  --network net.flexisip \
  --ip 10.8.8.7 \
  --ip6 fd6c::8::7
  
$ podman volume create phpmyadmin

$ podman create \
  --pod pod-phpmyadmin \
  --name phpmyadmin \
  --restart=always \
  -e PMA_HOST=mariadb.flexisip \
  -e PMA_PORT=3306 \
  -e PMA_ABSOLUTE_URI=http://localhost/phpmyadmin \
  -v phpmyadmin:/var/www/html \
  -v /sessions \
  phpmyadmin/phpmyadmin:fpm-alpine

```

上記一連のコマンドでPodを作成し内部にコンテナを配置したらPodman-Desktopで各Podをスタートします。

#### Podリスト

 ![Screenshot from 2025-05-16 16-46-48](https://forum.ficusonline.com/uploads/default/original/2X/b/b20844f7eca360eb5c69e55170da4eb79387aae4.png)

#### コンテナリスト

 ![Screenshot from 2025-05-16 16-46-58](https://forum.ficusonline.com/uploads/default/original/2X/e/ef02621c5a13619652f344d9cb0105c1a722b140.png)

podman composeによるコンテナ運用からpodによる運用へ移行した場合、NginxのFast\_CGIパス、Redis、MariaDBへのIPなどを再設定する必要があります。以下再設定が必要なファイルです。

> `flexisip-account-manager/flexiapi/.env`  
> `nginx/default.conf`  
> `nginx/lime.conf`  
> `lime-server/lime-server.conf`  
> `hft_conf/flexisip-http-file-transfer-server.conf`

* * *

### リモート操作

podman(desktop)からのリモート操作については下記参照。

> [@Podman (Podman Desktop) 導入](https://forum.ficusonline.com/t/topic/525/7):
>
> リモート操作 Podmanリモートクライアント [podman/docs/tutorials/remote\_client.md at main · containers/podman · GitHub](https://github.com/containers/podman/blob/main/docs/tutorials/remote_client.md) サーバ側：ユーザレベルでpodman.socketを有効化しサービスを起動。 $ systemctl --user enable --now podman.socket $ systemctl …

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2025 年 5 月 31 日午前 6:20 UTC](https://forum.ficusonline.com/t/topic/527/6 "2025-05-31T06:20:08Z")

</div>

Kubernetes本番環境へのたたき台として、podmanで作成したpodをベースに生成されるyamlファイルを利用して動作を確認します。

本番環境では；

- `Pod`から`Deployment`に変換
- `Service`を定義
- `hostPath` → `persistentVolumeClaim` への書き換え

などの調整が必要です。

Yamlファイル生成

```shell
$ podman generate kube pod-apache >> pod-apache.yaml
$ podman generate kube pod-flexisip >> pod-flexisip.yaml
$ podman generate kube pod-phpmyadmin >> pod-phpmyadmin.yaml
$ podman generate kube pod-php-fpm >> pod-php-fpm.yaml
$ podman generate kube pod-mariadb >> pod-mariadb.yaml
$ podman generate kube pod-nginx >> pod-nginx.yaml
$ podman generate kube pod-redis >> pod-redis.yaml

```

Pod名が重複するため既存のPodを全て削除

```shell
$ podman pod prune

```

Yamlファイルから各Podを起動

```auto
$ podman play kube pod-apache.yaml
$ podman play kube pod-flexisip.yaml
$ podman play kube pod-mariadb.yaml
$ podman play kube pod-nginx.yaml
$ podman play kube pod-php-fpm.yaml
$ podman play kube pod-phpmyadmin.yaml
$ podman play kube pod-redis.yaml

```

Podとそれに内包されるコンテナは以前のものと同じです。

```shell
$ podman pod ps
POD ID NAME STATUS CREATED INFRA ID # OF CONTAINERS
b23c7dd8e1ed pod-redis Running About an hour ago 96d4ff9d9be6 2
16c3acac6715 pod-phpmyadmin Running About an hour ago 908744e5fc70 2
d656430476a7 pod-php-fpm Running About an hour ago 279407fd70dc 2
155c5624be8f pod-nginx Running About an hour ago aa15c2c192ae 2
614b578e5cfb pod-mariadb Running About an hour ago 3849e4c3b6ca 2
3f5319aa1f5b pod-flexisip Running About an hour ago 7b03c8bf45c5 2
02d61ef173f0 pod-apache Running About an hour ago b8574fe0d303 2

```

```shell
$ podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b8574fe0d303 localhost/podman-pause:4.9.3-0 2 hours ago Up 2 hours 0.0.0.0:8080->8080/tcp, 0.0.0.0:8443->8443/tcp 02d61ef173f0-infra
8b5f59328c03 docker.io/library/httpd:alpine httpd-foreground 2 hours ago Up 2 hours 0.0.0.0:8080->8080/tcp, 0.0.0.0:8443->8443/tcp pod-apache-apache
7b03c8bf45c5 localhost/podman-pause:4.9.3-0 2 hours ago Up 2 hours 3f5319aa1f5b-infra
5972857eef2b localhost/ubuntu-flexisip:20250514 2 hours ago Up 2 hours pod-flexisip-ubuntu-flexisip
3849e4c3b6ca localhost/podman-pause:4.9.3-0 2 hours ago Up 2 hours 127.0.0.1:3306->3306/tcp 614b578e5cfb-infra
6cce6f51b1f9 docker.io/library/mariadb:11.7 --event-scheduler... 2 hours ago Up 2 hours 127.0.0.1:3306->3306/tcp pod-mariadb-mariadb-flexisip
aa15c2c192ae localhost/podman-pause:4.9.3-0 2 hours ago Up 2 hours 0.0.0.0:9080->80/tcp, 0.0.0.0:9443->443/tcp 155c5624be8f-infra
f8417f069a39 docker.io/library/nginx:alpine nginx -g daemon o... 2 hours ago Up 2 hours 0.0.0.0:9080->80/tcp, 0.0.0.0:9443->443/tcp pod-nginx-nginx
279407fd70dc localhost/podman-pause:4.9.3-0 2 hours ago Up 2 hours d656430476a7-infra
eb7e71d11aeb localhost/php-fpm-8.2:20250514 php-fpm 2 hours ago Up 2 hours pod-php-fpm-php-fpm
908744e5fc70 localhost/podman-pause:4.9.3-0 2 hours ago Up 2 hours 16c3acac6715-infra
3e2595af7a67 docker.io/phpmyadmin/phpmyadmin:fpm-alpine php-fpm 2 hours ago Up 2 hours pod-phpmyadmin-phpmyadmin-fpm
96d4ff9d9be6 localhost/podman-pause:4.9.3-0 2 hours ago Up 2 hours 127.0.0.1:6379->6379/tcp b23c7dd8e1ed-infra
2f12fea3020c docker.io/library/redis:alpine redis-server /etc... 2 hours ago Up 2 hours 127.0.0.1:6379->6379/tcp pod-redis-redis

```

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2025 年 6 月 15 日午前 6:59 UTC](https://forum.ficusonline.com/t/topic/527/8 "2025-06-15T06:59:40Z")

</div>

## minikubeでflexisipを運用(Flexisip + Flexisip Account Manager)

Flexisip は、RTP 用に広範なポート範囲を確保する必要があるため、コンテナのネットワークモードをホスト（`host`）に設定する必要があります。しかし、Minikube はデフォルトで Kubernetes をコンテナ内で実行するため、このホストネットワークモードが利用できません。そのため、Flexisip に必要なポートを確保するには、Minikube をコンテナベースではなく、直接ホスト上または仮想マシン（VM）上で実行する必要があります。

–driver=noneで運用する場合、ホストマシンに必要な追加パッケージが幾つかあります（以下参照）。

> [@Kubernetes (minikube)](https://forum.ficusonline.com/t/topic/453/37):
>
> ホストマシンに直接minikubeを配備：driver=none たとえば --driver=docker を使用すると、Minikube VM はDockerコンテナとして実行され、ホストと異なるネットワーク空間に配置されます。そのため、RTP通信などで必要とされる複数ポート（UDPなど）をホスト側で直接バインドすることが難しくなります。これが問題となる場合は、--driver=none や -…

ルートユーザで起動

```shell
$ sudo su
# minikube --driver=none --container-runtime=containerd

```

用意したマニフェストと設定ファイル

```shell
$ tree -a
.
├── apache ### Flexisipファイルサーバ用Pod
│ ├── apache_deployment.yaml
│ ├── apache_pv-pvc.yaml
│ ├── apache_service.yaml
│ └── httpd.conf
├── cert-manager ### Ingress-Nginxを利用したTLS認証Pod
│ ├── certificate.yaml
│ ├── cluster-issuer.yaml
│ └── ingress.yaml
├── cni-plugins.tgz ### CNI追加パッケージ
├── deploy.yaml ### Ingress-Nginxの公式マニフェスト
├── flexisip ### Flexisip用Pod
│ ├── flexisip.conf
│ ├── flexisip_deployment.yaml
│ └── flexisip_pv-pvc.yaml
├── flexisip.tar ### Flexisipカスタムビルドイメージ
├── mariadb ### MariaDBデータベースPod
│ ├── mariadb_deployment.yaml
│ ├── mariadb_pv-pvc.yaml
│ └── mariadb_service.yaml
├── nginx ### Flexisip Account Manager用ウェブサーバ用Pod
│ ├── default.conf
│ ├── nginx_deployment.yaml
│ └── nginx_service.yaml
├── php-fpm ### Flexisip Account Manager PHP-FPM Pod
│ ├── create-configmap-secret.sh
│ ├── .env
│ ├── flexisip-http-file-transfer-server.conf
│ ├── lime-server.conf
│ ├── php-fpm_deployment.yaml
│ ├── php-fpm_pv-pvc.yaml
│ └── php-fpm_service.yaml
├── php-fpm.tar ### Flexisip Account Manager PHP-FPM カスタムビルドイメージ
├── phpmyadmin ### PhpMyAdmin Pod
│ ├── phpmyadmin_deployment.yaml
│ ├── phpmyadmin_pv-pvc.yaml
│ └── phpmyadmin_service.yaml
└── redis ### Redis Pod
    ├── redis_deployment.yaml
    ├── redis_pv-pvc.yaml
    └── redis_service.yaml

```

上記yamlファイルを作成するまでが慣れないと大変ですが、作成できたらこれらyamlファイルを `$ kubectl apply -f ***.yaml` コマンドで読み込むだけで、システムが安定稼働します。

```shell
# kubectl get pod -A
NAMESPACE NAME READY STATUS RESTARTS AGE
cert-manager cert-manager-544f4cd4f9-ppdb5 1/1 Running 2 (6h59m ago) 19h
cert-manager cert-manager-cainjector-5674ff7897-6xxsd 1/1 Running 4 (6h34m ago) 19h
cert-manager cert-manager-webhook-8fbb858cb-92qqj 1/1 Running 2 (6h59m ago) 19h
default apache-deployment-6c97c7f99-bkjvq 1/1 Running 1 (6h59m ago) 16h
default flexisip-7784d9d9d8-gkdv7 1/1 Running 2 (6h34m ago) 14h
default mariadb-deployment-67d8c8485-x48vt 1/1 Running 1 (6h59m ago) 16h
default nginx-deployment-74664cff65-mlv7p 1/1 Running 0 6h29m
default php-fpm-68d859cf74-g99jr 1/1 Running 1 (6h59m ago) 15h
default phpmyadmin-8978775b9-2dnzl 1/1 Running 1 (6h59m ago) 16h
default redis-58d6bd9ccb-fxgtr 1/1 Running 1 (6h59m ago) 16h
ingress-nginx ingress-nginx-controller-557f88b9b9-xxc68 1/1 Running 0 102s
kube-system coredns-674b8bbfcf-7x7l4 1/1 Running 2 (6h59m ago) 24h
kube-system coredns-674b8bbfcf-89vxh 1/1 Running 2 (6h59m ago) 24h
kube-system etcd-hp-elitedesk 1/1 Running 2 (6h59m ago) 24h
kube-system kube-apiserver-hp-elitedesk 1/1 Running 2 (6h59m ago) 24h
kube-system kube-controller-manager-hp-elitedesk 1/1 Running 2 (6h59m ago) 24h
kube-system kube-proxy-lkvdl 1/1 Running 2 (6h59m ago) 24h
kube-system kube-scheduler-hp-elitedesk 1/1 Running 2 (6h59m ago) 24h
kube-system storage-provisioner 1/1 Running 4 (6h34m ago) 24h

```

Minikubeは本番環境移行前の試験用途として使用しており、次の段階では本番に近い環境として、各ノードを物理・仮想ホスト上に分散配置し、VM上でkubeadmを用いてクラスターを構成・運用します。

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2025 年 6 月 16 日午後 12:49 UTC](https://forum.ficusonline.com/t/topic/527/9 "2025-06-16T12:49:19Z")

</div>

## トラブルシュート

* * *

#### Laravelキャッシュクリア

`.env`が古いキャシュとして残っているとデータベース接続エラーなどが発生するため、念の為クリアして下さい。

コンテナ（ポッド）チェック

```auto
# kubectl get pod
NAME READY STATUS RESTARTS AGE
apache-deployment-6c97c7f99-bkjvq 1/1 Running 2 (7h39m ago) 2d
flexisip-7784d9d9d8-gkdv7 1/1 Running 3 (7h39m ago) 46h
mariadb-deployment-67d8c8485-x48vt 1/1 Running 2 (7h39m ago) 2d
nginx-deployment-64696bdb7d-ssfrb 1/1 Running 0 67m
php-fpm-68d859cf74-bvjrh 1/1 Running 0 171m
phpmyadmin-76c56779c8-4jgm4 1/1 Running 0 6h40m
redis-58d6bd9ccb-fxgtr 1/1 Running 2 (7h39m ago) 2d

```

上記よりphp-fpmコンテナへ

```shell
# kubectl exec -ti php-fpm-68d859cf74-bvjrh -- bash

```

php-fpmコンテナ内`(/var/www/html/flexiapi)`で以下実行

```shell
# php artisan config:clear

   INFO Configuration cache cleared successfully.  

# php artisan cache:clear

   INFO Application cache cleared successfully.  

```
