[Unit] Description=AgentMail Gateway - email-driven multi-agent collaboration platform Documentation=https://github.com/agentmail After=network-online.target Wants=network-online.target [Service] Type=simple WorkingDirectory=/opt/agentmail ExecStart=/opt/agentmail/agentmail-gateway # 数据库:留空即用内置 SQLite(/opt/agentmail/data/agentmail.db)。 # 要接外部 PostgreSQL 就把 DATABASE_URL 填成 postgres://user:pass@host:5432/db。 Environment=DATABASE_URL= Environment=AGENTMAIL_DATA_DIR=/opt/agentmail/data Environment=PORT=8180 # 附件:内容存磁盘(默认在 data/attachments),单个上限 25MB Environment=AGENTMAIL_MAX_ATTACHMENT_BYTES=26214400 # 首启创建的管理员。密码放在 EnvironmentFile 里,避免出现在 systemctl show 输出。 EnvironmentFile=/etc/agentmail/gateway.env Restart=always RestartSec=5 LimitNOFILE=65535 # 只需要读自己的程序目录与写 data/,其余文件系统一律只读 NoNewPrivileges=true PrivateTmp=true ProtectSystem=strict ProtectHome=true ReadWritePaths=/opt/agentmail/data [Install] WantedBy=multi-user.target