如果你想快速安装n8n;
全栈代理Nginx n8n:
<p align="left">
<a href="https://n8n.io/" target="_blank" rel="noreferrer"> <img src="https://gips2.baidu.com/it/u=2094247128,507324369&fm=3081&app=3081&f=PNG?w=200&h=200" alt="n8n" height="40" width="40"/> </a>
<a href="https://www.docker.com/" target="_blank" rel="noreferrer" style="text-decoration: none;"> <img src="https://gips1.baidu.com/it/u=696240157,4091815162&fm=3081&app=3081&f=PNG?w=288&h=288" alt="docker" width="40" height="40" width="40"/> </a>
<a href="https://www.nginx.com" target="_blank" rel="noreferrer"> <img src="https://gips2.baidu.com/it/u=3081496243,2156614024&fm=3081&app=3081&f=PNG?w=200&h=200" alt="nginx" height="40" width="40"/> </a>
<a href="https://en.wikipedia.org/wiki/Bash_(Unix_shell)" target="_blank" rel="noreferrer" style="text-decoration: none;"> <img src="https://gips3.baidu.com/it/u=2855303911,920256780&fm=3081&app=3081&f=PNG?w=288&h=288" alt="Bash" height="50" width="50" style="max-width: 100%;"> </a>
<a href="https://letsencrypt.org/" target="_blank" rel="noreferrer" style="text-decoration: none;"> <img src="https://gips2.baidu.com/it/u=2703192850,2058634189&fm=3081&app=3081&f=PNG?w=200&h=200" alt="letsencrypt" height="40" width="40"/> </a>
<a href="https://certbot.eff.org/" target="_blank" rel="noreferrer"> <img src="https://gips0.baidu.com/it/u=2863282611,2107719679&fm=3081&app=3081&f=PNG?w=200&h=200" alt="certbot" height="40" width="40"/> </a>
<a href="https://www.offen.dev/" target="_blank" rel="noreferrer"> <img src="https://gips3.baidu.com/it/u=3608731202,3503079203&fm=3081&app=3081&f=PNG?w=200&h=200" alt="backup" height="35" width="35"/> </a>
</p>
此外,还可以使用Portainer管理Docker容器。
支持的CPU架构:
<p align="left"> arm64/aarch64, x86-64 </p>
支持的Linux包管理系统:
<p align="left"> apk, dnf, yum, apt/apt-get, zypper, pacman </p>
支持的Linux操作系统:
<p align="left">
<a href="https://alpinelinux.org/" target="_blank" rel="noreferrer"> <img src="https://gips2.baidu.com/it/u=1167434501,3498695165&fm=3081&app=3081&f=PNG?w=160&h=160" alt="alpine linux" height="40" width="40"/> </a>
<a href="https://fedoraproject.org/" target="_blank" rel="noreferrer"> <img src="https://gips0.baidu.com/it/u=2919669364,2274112926&fm=3081&app=3081&f=PNG?w=288&h=288" alt="fedora" height="40" width="40"/> </a>
<a href="https://www.centos.org/" target="_blank" rel="noreferrer"> <img src="https://gips2.baidu.com/it/u=3348488987,3079700048&fm=3081&app=3081&f=PNG?w=200&h=200" alt="centos" height="40" width="40"/> </a>
<a href="https://www.debian.org/" target="_blank" rel="noreferrer"> <img src="https://gips0.baidu.com/it/u=1155589039,2697497351&fm=3081&app=3081&f=PNG?w=200&h=200" alt="debian" height="40" width="40"/> </a>
<a href="https://ubuntu.com/" target="_blank" rel="noreferrer"> <img src="https://gips0.baidu.com/it/u=1510636073,840920934&fm=3081&app=3081&f=PNG?w=200&h=200" alt="ubuntu" height="40" width="40"/> </a>
<a href="https://www.raspberrypi.com/" target="_blank" rel="noreferrer"> <img src="https://gips2.baidu.com/it/u=2968923011,34340540&fm=3081&app=3081&f=PNG?w=200&h=200" alt="ubuntu" height="40" width="40"/> </a>
<a href="https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux" target="_blank" rel="noreferrer"> <img src="https://gips3.baidu.com/it/u=1015141411,1378224256&fm=3081&app=3081&f=PNG?w=200&h=200" alt="redhat on s390x (IBM Z)" height="40" width="40"/> </a>
<a href="https://www.suse.com/products/server/" target="_blank" rel="noreferrer"> <img src="https://gips0.baidu.com/it/u=827454971,697395739&fm=3081&app=3081&f=PNG?w=200&h=200" alt="opensuse on s390x (IBM Z)" height="40" width="40"/> </a>
<a href="https://archlinux.org/" target="_blank" rel="noreferrer"> <img src="https://gips3.baidu.com/it/u=3266054565,346615511&fm=3081&app=3081&f=PNG?w=48&h=48" alt="arch linux" height="40" width="40"/> </a>
</p>
注意:Fedora 37, 39 和 Alpine Linux x86-64 兼容,未尝试 SLES IBM Z s390x, RHEL IBM Z s390x 和 Raspberry Pi。
使用此项目,你可以快速运行以下内容:
对于 certbot (letsencrypt) 证书:
IPv4/IPv6 防火墙
创建规则以打开到互联网的端口,或到特定的IPv4地址或范围。
- http: 80
- https: 443
- portainer: 9001
内容:
自动
执行安装shell脚本进行自动安装和配置
下载:
git clone https://github.com/damalis/full-stack-proxy-nginx-n8n-for-everyone-with-docker-compose.git
打开终端并 cd 到保存 docker-compose.yml 的文件夹中并运行:
cd full-stack-proxy-nginx-n8n-for-everyone-with-docker-compose
chmod +x install.sh
./install.sh
手动
需求
确保你的机器上安装了最新版本的 Docker 和 Docker Compose。
克隆这个仓库或将此仓库中的文件复制到新文件夹中。
确保已将用户添加到docker组。
配置
下载:
git clone https://github.com/damalis/full-stack-proxy-nginx-n8n-for-everyone-with-docker-compose.git
打开终端并 cd 到保存 docker-compose.yml 的文件夹中并运行:
cd full-stack-proxy-nginx-n8n-for-everyone-with-docker-compose
将示例环境复制到 .env
cp env.example .env
编辑 .env 文件以更改值
|LOCAL_TIMEZONE|DOMAIN_NAME|SUBDOMAIN|DIRECTORY_PATH|LETSENCRYPT_EMAIL|SSL_SNIPPET|
<table><thead>
<tr>
<th>变量 </th>
<th colspan="2">值</th>
</tr></thead>
<tbody>
<tr>
<td><code>LOCAL_TIMEZONE</code></td>
<td colspan="2"><code><a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List" rel="nofollow">查看本地时区</a></code></td>
</tr>
<tr>
<td><code>DIRECTORY_PATH</code></td>
<td colspan="2"><code>pwd</code> 在命令行中</td>
</tr>
<tr>
<td rowspan="2"><code>SSL_SNIPPET</code></td>
<td>localhost</td>
<td><code>echo '生成自签名SSL证书在localhost'</code></td>
</tr>
<tr>
<td>remotehost</td>
<td><code>certbot certonly --webroot --webroot-path /tmp/acme-challenge --rsa-key-size 4096 --non-interactive --agree-tos --no-eff-email --force-renewal --email ${LETSENCRYPT_EMAIL} -d ${DOMAIN_NAME} -d www.${DOMAIN_NAME} -d ${SUBDOMAIN}.${DOMAIN_NAME}</code></td>
</tr>
</tbody>
</table>
安装
首先:将创建外部卷
docker volume create --driver local --opt type=none --opt device=${PWD}/certbot --opt o=bind certbot-etc
本地ssl:使用指南 mkcert仓库 生成自签名SSL证书。
docker compose up -d
然后重新加载代理ssl配置
docker container restart proxy
容器现在已构建并运行。你应该能够通过浏览器地址栏中的配置IP访问n8n安装。https://子域.示例.com。
为了方便起见,你可以在hosts文件中添加一个新条目。
Portainer
docker compose -f portainer-docker-compose.yml -p portainer up -d
使用 Portainer 是用于Docker和Docker Swarm的终极容器管理工具,具有高度直观的GUI和API。
你也可以在启动容器后访问 https://示例.com:9001 来访问portainer。
使用
你可以使用portainer无需命令行来管理Docker容器。
这里是一些常用的Docker Compose命令的快速参考
docker ps -a # 列出由compose文件管理的所有容器
docker compose start # 启动之前停止的容器
docker compose stop # 停止所有正在运行的容器
docker compose down # 停止并移除容器、网络等
docker compose down -v # 添加--volumes以明确移除卷
docker rm -f $(docker ps -a -q) # 移除portainer和其他容器
docker volume rm $(docker volume ls -q) # 移除所有卷
docker network prune # 移除所有未使用的网络
docker system prune # 移除未使用的数据(容器、网络、镜像,以及可选的卷)
docker system prune -a # 移除所有未使用的镜像,而不仅仅是悬挂的镜像
docker rmi $(docker image ls -q) # 移除portainer和其他镜像
docker container logs container_name_or_id # 显示来自所有服务的日志
从现有源项目
将所有文件复制到新目录:
docker compose up -d # 在后台启动服务(分离模式)
Docker运行参考
https://docs.docker.com/reference/cli/docker/compose/
n8n
n8n 该页面提供了关于为企业版和社区版自托管n8n的设置指导。社区版是免费的,企业版则不是。
代理
代理通常用于在多个服务器之间分配负载,无缝地显示来自不同网站的内容,或者通过不同于HTTP的协议将请求传递给应用服务器进行处理。
在 ./proxy/templates/proxy.conf.template 文件中添加或删除代码以进行自定义代理配置
https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/
备份
这将每天备份数据库/dump sql和html卷中的所有文件和文件夹,并将其写入 ./backups,文件名为类似 backup-2023-01-01T10-18-00.tar.gz
可以按照自定义cron计划运行
BACKUP_CRON_EXPRESSION: '20 01 * * *' 使用UTC时区。