52 lines
1.1 KiB
Markdown
52 lines
1.1 KiB
Markdown
# Install
|
|
|
|
## Local runtime
|
|
```bash
|
|
cd /opt
|
|
unzip /path/to/mailcow-plugin-runtime-v0.2.0.zip
|
|
cd mailcow-plugin-runtime-v0.2.0
|
|
cp .env.example .env
|
|
npm install
|
|
npm run build
|
|
node dist/server.js
|
|
```
|
|
|
|
## Docker
|
|
```bash
|
|
docker compose up -d --build
|
|
```
|
|
|
|
## Test
|
|
```bash
|
|
curl http://127.0.0.1:4110/health
|
|
curl http://127.0.0.1:4110/plugins-runtime/api/runtime/plugins
|
|
curl http://127.0.0.1:4110/plugins-runtime/api/runtime/hooks
|
|
```
|
|
|
|
## Mailcow nginx integration
|
|
Add a proxy block similar to:
|
|
|
|
```nginx
|
|
location /plugins-runtime/ {
|
|
proxy_pass http://mailcow-plugin-runtime:4110/plugins-runtime/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
}
|
|
```
|
|
|
|
Inject the bootstrap script into your Mailcow UI shell:
|
|
|
|
```html
|
|
<script src="/plugins-runtime/runtime/bootstrap.js"></script>
|
|
```
|
|
|
|
Recommended hook anchors in Mailcow markup:
|
|
|
|
```html
|
|
<div data-mailcow-plugin-hook="mail.compose.toolbar"></div>
|
|
<div data-mailcow-plugin-hook="mail.compose.attachments"></div>
|
|
```
|