专栏首页huginnHuginn 环境搭建

Huginn 环境搭建

什么是 Huginn ?

Huginn 是一个可以通过构建 agents 来帮你实现在线自动化任务的系统。它们可以理解 web,监听事件,按你所需地去执行一些行为。Huginn 的 agents 创建和消费事件,通过有向图表来进行转播。你可以把它当作部署在你自己的服务器上的破解版本的 IFTTT 或 Zapier。

你可以用 Huginn 做什么?

  • 追踪天气并在明天下雨(雪)的时候邮件通知给你(明天不要忘记带伞)。
  • 列出你关心的条目,并在 Twitter 发生改变的时候电子邮件通知给你。(例如,想知道在机器学习领域发生了什么有趣的事情吗?Huginn 将在 Twitter 上观察“machine learning”这个词,并告诉你什么时候讨论会高高峰。)
  • 帮你观察旅游机票和购物优惠信息。
  • 抓取任意网站并在发生变化时电子邮件通知你。
  • 连接到 Adioso, HipChat, Basecamp, Growl, FTP, IMAP, Jabber, JIRA, MQTT, nextbus, Pushbullet, Pushover, RSS, Bash, Slack, StubHub, translation APIs, Twilio, Twitter, Wunderground, and 微博等第三方.
  • 发送和接收 WebHooks。
  • 其它很多很多你能想到的。

环境搭建

Debian 服务器为例,进行环境搭建(大家可以选择购买VPS)。

概述

Huginn 的安装主要包括以下组件:

  1. Packages / Dependencies
  2. Ruby
  3. System Users
  4. Database
  5. Huginn
  6. Nginx

1. Packages / Dependencies

Debian 中 sudo 并没有默认安装。确保你的系统是最新的,然后安装它。

# run as root! apt-get <span class="hljs-keyword">update</span> -y apt-<span class="hljs-keyword">get</span> <span class="hljs-keyword">upgrade</span> -y apt-<span class="hljs-keyword">get</span> <span class="hljs-keyword">install</span> sudo -y

1234

# run as root!apt-get <span class="hljs-keyword">update</span> -yapt-<span class="hljs-keyword">get</span> <span class="hljs-keyword">upgrade</span> -yapt-<span class="hljs-keyword">get</span> <span class="hljs-keyword">install</span> sudo -y

注意:在安装过程中,需要手动编辑一些文件。如果你熟悉 vim,请使用下面的命令将其设置为默认编辑器。如果你对 vim 不熟悉,请跳过此操作并继续使用默认编辑器。

# <span class="hljs-keyword">Install</span> vim <span class="hljs-keyword">and</span> <span class="hljs-keyword">set</span> <span class="hljs-keyword">as</span> <span class="hljs-keyword">default</span> editor sudo apt-<span class="hljs-keyword">get</span> <span class="hljs-keyword">install</span> -y vim sudo <span class="hljs-keyword">update</span>-alternatives <span class="hljs-comment">--set editor /usr/bin/vim.basic</span>

123

# <span class="hljs-keyword">Install</span> vim <span class="hljs-keyword">and</span> <span class="hljs-keyword">set</span> <span class="hljs-keyword">as</span> <span class="hljs-keyword">default</span> editorsudo apt-<span class="hljs-keyword">get</span> <span class="hljs-keyword">install</span> -y vimsudo <span class="hljs-keyword">update</span>-alternatives <span class="hljs-comment">--set editor /usr/bin/vim.basic</span>

导入 node.js 库 (如果是 Ubuntu 或者 Debian Jessie 的话可以跳过):

curl -sL <span class="hljs-string">https:</span><span class="hljs-comment">//deb.nodesource.com/setup_0.12 | sudo bash -</span>

1

curl -sL <span class="hljs-string">https:</span><span class="hljs-comment">//deb.nodesource.com/setup_0.12 | sudo bash -</span>

安装需要的 packages:

sudo apt-get <span class="hljs-keyword">install</span> -y runit <span class="hljs-keyword">build</span>-essential git zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-<span class="hljs-keyword">server</span> checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils pkg-config cmake nodejs graphviz

1

sudo apt-get <span class="hljs-keyword">install</span> -y runit <span class="hljs-keyword">build</span>-essential git zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-<span class="hljs-keyword">server</span> checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils pkg-config cmake nodejs graphviz

Debian Stretch

由于 Debian Stretch 的 runit 不会自动启动,但是这会被init系统处理。另外,Ruby需要 OpenSSL 1.0 开发包而不是 1.1的。对于默认安装使用这些包:

sudo apt-<span class="hljs-keyword">get</span> install -y runit-systemd libssl1.<span class="hljs-number">0</span>-dev

1

sudo apt-<span class="hljs-keyword">get</span> install -y runit-systemd libssl1.<span class="hljs-number">0</span>-dev

2. Ruby

在生产中使用带有 Huginn 的 Ruby 版本管理器(如 RVMrbenvchruby)会频繁导致难以诊断的问题。版本管理器不受支持,我们强烈建议所有人按照以下说明使用系统 Ruby。

如果存在的话,删除旧版本的 Ruby:

<span class="hljs-selector-tag">sudo</span> <span class="hljs-selector-tag">apt-get</span> <span class="hljs-selector-tag">remove</span> <span class="hljs-selector-tag">-y</span> <span class="hljs-selector-tag">ruby1</span><span class="hljs-selector-class">.8</span> <span class="hljs-selector-tag">ruby1</span><span class="hljs-selector-class">.9</span>

1

<span class="hljs-selector-tag">sudo</span> <span class="hljs-selector-tag">apt-get</span> <span class="hljs-selector-tag">remove</span> <span class="hljs-selector-tag">-y</span> <span class="hljs-selector-tag">ruby1</span><span class="hljs-selector-class">.8</span> <span class="hljs-selector-tag">ruby1</span><span class="hljs-selector-class">.9</span>

下载 Ruby,然后编译:

mkdir /tmp/ruby &amp;&amp; cd /tmp/ruby curl -L --progress http:<span class="hljs-comment">//cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.2.tar.bz2 | tar xj</span> cd ruby<span class="hljs-number">-2.4</span><span class="hljs-number">.2</span> ./configure --disable-install-rdoc <span class="hljs-built_in">make</span> -j<span class="hljs-string">`nproc`</span> sudo <span class="hljs-built_in">make</span> install

123456

mkdir /tmp/ruby &amp;&amp; cd /tmp/rubycurl -L --progress http:<span class="hljs-comment">//cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.2.tar.bz2 | tar xj</span>cd ruby<span class="hljs-number">-2.4</span><span class="hljs-number">.2</span>./configure --disable-install-rdoc<span class="hljs-built_in">make</span> -j<span class="hljs-string">`nproc`</span>sudo <span class="hljs-built_in">make</span> install

安装 bundler 和 foreman:

<span class="hljs-attribute">sudo</span> gem install rake bundler foreman --<span class="hljs-literal">no</span>-ri --<span class="hljs-literal">no</span>-rdoc

1

<span class="hljs-attribute">sudo</span> gem install rake bundler foreman --<span class="hljs-literal">no</span>-ri --<span class="hljs-literal">no</span>-rdoc

3. System Users

为 Huginn 创建一个用户:

<span class="hljs-attribute">sudo</span> adduser --disabled-login --gecos <span class="hljs-string">'Huginn'</span> huginn

1

<span class="hljs-attribute">sudo</span> adduser --disabled-login --gecos <span class="hljs-string">'Huginn'</span> huginn

4. Database

安装数据库

sudo apt-<span class="hljs-keyword">get</span> install -y mysql-server mysql-client libmysqlclient-dev <span class="hljs-meta"># 选择一个 MySQL root 密码 (可以任意), 输入并按回车,</span> <span class="hljs-meta"># 重复输入 MySQL root 密码 然后按回车</span>

1234

sudo apt-<span class="hljs-keyword">get</span> install -y mysql-server mysql-client libmysqlclient-dev <span class="hljs-meta"># 选择一个 MySQL root 密码 (可以任意), 输入并按回车,</span><span class="hljs-meta"># 重复输入 MySQL root 密码 然后按回车</span>

对于 Debian Stretch, 替换 libmysqlclient-dev 为 default-libmysqlclient-dev。

检查你安装的 MySQL 版本:

mysql <span class="hljs-comment">--version</span>

1

mysql <span class="hljs-comment">--version</span>

<span class="hljs-attribute">sudo</span> mysql_secure_installation

1

<span class="hljs-attribute">sudo</span> mysql_secure_installation

登录 MySQL:

<span class="hljs-attribute">mysql</span> -u root -p <span class="hljs-comment"># 输入 MySQL root 密码</span>

123

<span class="hljs-attribute">mysql</span> -u root -p <span class="hljs-comment"># 输入 MySQL root 密码</span>

为 Huginn 创建一个用户,替换 命令中的 $password 为你真实的密码:

mysql&gt; CREATE USER <span class="hljs-string">'huginn'</span>@<span class="hljs-string">'localhost'</span> IDENTIFIED BY <span class="hljs-string">'$password'</span>;

1

mysql&gt; CREATE USER <span class="hljs-string">'huginn'</span>@<span class="hljs-string">'localhost'</span> IDENTIFIED BY <span class="hljs-string">'$password'</span>;

支持 long indexes,你需要确保可以使用 InnoDB engine:

mysql&gt; SET default_storage_engine=INNODB; # 如果失败,检查你的 MySQL 配置文件 (e.g. <span class="hljs-string">`/etc/mysql/*.cnf`</span>, <span class="hljs-string">`/etc/mysql/conf.d/*`</span>) # 设置 <span class="hljs-string">"innodb = off"</span>

1234

mysql&gt; SET default_storage_engine=INNODB; # 如果失败,检查你的 MySQL 配置文件 (e.g. <span class="hljs-string">`/etc/mysql/*.cnf`</span>, <span class="hljs-string">`/etc/mysql/conf.d/*`</span>)# 设置 <span class="hljs-string">"innodb = off"</span>

给予 Huginn 用户必要的数据库相关权限:

mysql&gt; GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, <span class="hljs-keyword">INDEX</span>, ALTER, LOCK TABLES <span class="hljs-keyword">ON</span> `huginn_production`.* <span class="hljs-keyword">TO</span> <span class="hljs-string">'huginn'</span>@<span class="hljs-string">'localhost'</span>;

1

mysql&gt; GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, <span class="hljs-keyword">INDEX</span>, ALTER, LOCK TABLES <span class="hljs-keyword">ON</span> `huginn_production`.* <span class="hljs-keyword">TO</span> <span class="hljs-string">'huginn'</span>@<span class="hljs-string">'localhost'</span>;

退出 database 会话:

mysql&gt; \q

1

mysql&gt; \q

尝试使用新的用户链接到新的数据库

<span class="hljs-attribute">sudo</span> -u huginn -H mysql -u huginn -p -D huginn_production <span class="hljs-comment"># Type the password you replaced $password with earlier</span>

123

<span class="hljs-attribute">sudo</span> -u huginn -H mysql -u huginn -p -D huginn_production <span class="hljs-comment"># Type the password you replaced $password with earlier</span>

你应该回看到 ERROR 1049 (42000): Unknown database 'huginn_production',这是正常的,因为我们会稍后创建数据库。

5. Huginn

Clone 源代码

# We'll <span class="hljs-keyword">install</span> Huginn <span class="hljs-keyword">into</span> the home <span class="hljs-keyword">directory</span> <span class="hljs-keyword">of</span> the <span class="hljs-keyword">user</span> <span class="hljs-string">"huginn"</span> cd /home/huginn # <span class="hljs-keyword">Clone</span> Huginn repository sudo -u huginn -H git <span class="hljs-keyword">clone</span> https://github.com/huginn/huginn.git -b <span class="hljs-keyword">master</span> huginn # <span class="hljs-keyword">Go</span> <span class="hljs-keyword">to</span> Huginn installation folder cd /home/huginn/huginn # Copy the example Huginn config sudo -u huginn -H cp .env.example .env # <span class="hljs-keyword">Create</span> the <span class="hljs-keyword">log</span>/, tmp/pids/ <span class="hljs-keyword">and</span> tmp/sockets/ directories sudo -u huginn mkdir -<span class="hljs-keyword">p</span> <span class="hljs-keyword">log</span> tmp/pids tmp/sockets # Make sure Huginn can write <span class="hljs-keyword">to</span> the <span class="hljs-keyword">log</span>/ <span class="hljs-keyword">and</span> tmp/ directories sudo chown -R huginn <span class="hljs-keyword">log</span>/ tmp/ sudo chmod -R u+rwX,<span class="hljs-keyword">go</span>-w <span class="hljs-keyword">log</span>/ tmp/ # Make sure permissions <span class="hljs-keyword">are</span> <span class="hljs-keyword">set</span> correctly sudo chmod -R u+rwX,<span class="hljs-keyword">go</span>-w <span class="hljs-keyword">log</span>/ sudo chmod -R u+rwX tmp/ sudo -u huginn -H chmod o-rwx .env # Copy the example Unicorn config sudo -u huginn -H cp config/unicorn.rb.example config/unicorn.rb

1234567891011121314151617181920212223242526

# We'll <span class="hljs-keyword">install</span> Huginn <span class="hljs-keyword">into</span> the home <span class="hljs-keyword">directory</span> <span class="hljs-keyword">of</span> the <span class="hljs-keyword">user</span> <span class="hljs-string">"huginn"</span>cd /home/huginn # <span class="hljs-keyword">Clone</span> Huginn repositorysudo -u huginn -H git <span class="hljs-keyword">clone</span> https://github.com/huginn/huginn.git -b <span class="hljs-keyword">master</span> huginn # <span class="hljs-keyword">Go</span> <span class="hljs-keyword">to</span> Huginn installation foldercd /home/huginn/huginn # Copy the example Huginn configsudo -u huginn -H cp .env.example .env # <span class="hljs-keyword">Create</span> the <span class="hljs-keyword">log</span>/, tmp/pids/ <span class="hljs-keyword">and</span> tmp/sockets/ directoriessudo -u huginn mkdir -<span class="hljs-keyword">p</span> <span class="hljs-keyword">log</span> tmp/pids tmp/sockets # Make sure Huginn can write <span class="hljs-keyword">to</span> the <span class="hljs-keyword">log</span>/ <span class="hljs-keyword">and</span> tmp/ directoriessudo chown -R huginn <span class="hljs-keyword">log</span>/ tmp/sudo chmod -R u+rwX,<span class="hljs-keyword">go</span>-w <span class="hljs-keyword">log</span>/ tmp/ # Make sure permissions <span class="hljs-keyword">are</span> <span class="hljs-keyword">set</span> correctlysudo chmod -R u+rwX,<span class="hljs-keyword">go</span>-w <span class="hljs-keyword">log</span>/sudo chmod -R u+rwX tmp/sudo -u huginn -H chmod o-rwx .env # Copy the example Unicorn configsudo -u huginn -H cp config/unicorn.rb.example config/unicorn.rb

配置它

<span class="hljs-comment"># Update Huginn config file and follow the instructions</span> <span class="hljs-attribute">sudo</span> -u huginn -H editor .env

12

<span class="hljs-comment"># Update Huginn config file and follow the instructions</span><span class="hljs-attribute">sudo</span> -u huginn -H editor .env

<span class="hljs-attr">DATABASE_ADAPTER</span>=mysql2 <span class="hljs-attr">DATABASE_RECONNECT</span>=<span class="hljs-literal">true</span> <span class="hljs-attr">DATABASE_NAME</span>=huginn_production <span class="hljs-attr">DATABASE_POOL</span>=<span class="hljs-number">20</span> <span class="hljs-attr">DATABASE_USERNAME</span>=huginn <span class="hljs-attr">DATABASE_PASSWORD</span>=<span class="hljs-string">'$password'</span> <span class="hljs-comment">#DATABASE_HOST=your-domain-here.com</span> <span class="hljs-comment">#DATABASE_PORT=3306</span> <span class="hljs-comment">#DATABASE_SOCKET=/tmp/mysql.sock</span> <span class="hljs-attr">DATABASE_ENCODING</span>=utf8 <span class="hljs-comment"># MySQL only: If you are running a MySQL server &gt;=5.5.3, you should</span> <span class="hljs-comment"># set DATABASE_ENCODING to utf8mb4 instead of utf8 so that the</span> <span class="hljs-comment"># database can hold 4-byte UTF-8 characters like emoji.</span> <span class="hljs-comment">#DATABASE_ENCODING=utf8mb4</span>

123456789101112131415

<span class="hljs-attr">DATABASE_ADAPTER</span>=mysql2<span class="hljs-attr">DATABASE_RECONNECT</span>=<span class="hljs-literal">true</span><span class="hljs-attr">DATABASE_NAME</span>=huginn_production<span class="hljs-attr">DATABASE_POOL</span>=<span class="hljs-number">20</span><span class="hljs-attr">DATABASE_USERNAME</span>=huginn<span class="hljs-attr">DATABASE_PASSWORD</span>=<span class="hljs-string">'$password'</span><span class="hljs-comment">#DATABASE_HOST=your-domain-here.com</span><span class="hljs-comment">#DATABASE_PORT=3306</span><span class="hljs-comment">#DATABASE_SOCKET=/tmp/mysql.sock</span> <span class="hljs-attr">DATABASE_ENCODING</span>=utf8<span class="hljs-comment"># MySQL only: If you are running a MySQL server &gt;=5.5.3, you should</span><span class="hljs-comment"># set DATABASE_ENCODING to utf8mb4 instead of utf8 so that the</span><span class="hljs-comment"># database can hold 4-byte UTF-8 characters like emoji.</span><span class="hljs-comment">#DATABASE_ENCODING=utf8mb4</span>

重要: 取消注释 RAILS_ENV 设置,以便于在生产环节运行 Huginn。

<span class="hljs-attr">RAILS_ENV</span>=production

1

<span class="hljs-attr">RAILS_ENV</span>=production

如果需要改变 Unicorn 配置:

<span class="hljs-comment"># Increase the amount of workers if you expect to have a high load instance.</span> <span class="hljs-comment"># 2 are enough for most use cases, if the server has less then 2GB of RAM</span> <span class="hljs-comment"># decrease the worker amount to 1</span> <span class="hljs-attribute">sudo</span> -u huginn -H editor config/unicorn.rb

1234

<span class="hljs-comment"># Increase the amount of workers if you expect to have a high load instance.</span><span class="hljs-comment"># 2 are enough for most use cases, if the server has less then 2GB of RAM</span><span class="hljs-comment"># decrease the worker amount to 1</span><span class="hljs-attribute">sudo</span> -u huginn -H editor config/unicorn.rb

重要:确保 .envunicorn.rb 都符合你的配置。

安装 Gems

sudo -u huginn -H bundle <span class="hljs-keyword">install</span> <span class="hljs-comment">--deployment --without development test</span>

1

sudo -u huginn -H bundle <span class="hljs-keyword">install</span> <span class="hljs-comment">--deployment --without development test</span>

初始化 Database

# <span class="hljs-keyword">Create</span> the <span class="hljs-keyword">database</span> sudo -u huginn -H bundle exec rake db:<span class="hljs-keyword">create</span> RAILS_ENV=production # Migrate <span class="hljs-keyword">to</span> the latest <span class="hljs-keyword">version</span> sudo -u huginn -H bundle exec rake db:migrate RAILS_ENV=production # <span class="hljs-keyword">Create</span> <span class="hljs-keyword">admin</span> <span class="hljs-keyword">user</span> <span class="hljs-keyword">and</span> example agents <span class="hljs-keyword">using</span> the <span class="hljs-keyword">default</span> <span class="hljs-keyword">admin</span>/<span class="hljs-keyword">password</span> login sudo -u huginn -H bundle exec rake db:<span class="hljs-keyword">seed</span> RAILS_ENV=production SEED_USERNAME=<span class="hljs-keyword">admin</span> SEED_PASSWORD=<span class="hljs-keyword">password</span>

12345678

# <span class="hljs-keyword">Create</span> the <span class="hljs-keyword">database</span>sudo -u huginn -H bundle exec rake db:<span class="hljs-keyword">create</span> RAILS_ENV=production # Migrate <span class="hljs-keyword">to</span> the latest <span class="hljs-keyword">version</span>sudo -u huginn -H bundle exec rake db:migrate RAILS_ENV=production # <span class="hljs-keyword">Create</span> <span class="hljs-keyword">admin</span> <span class="hljs-keyword">user</span> <span class="hljs-keyword">and</span> example agents <span class="hljs-keyword">using</span> the <span class="hljs-keyword">default</span> <span class="hljs-keyword">admin</span>/<span class="hljs-keyword">password</span> loginsudo -u huginn -H bundle exec rake db:<span class="hljs-keyword">seed</span> RAILS_ENV=production SEED_USERNAME=<span class="hljs-keyword">admin</span> SEED_PASSWORD=<span class="hljs-keyword">password</span>

编译 Assets

sudo -u huginn -H bundle <span class="hljs-keyword">exec</span> rake assets:precompile RAILS_ENV=production

1

sudo -u huginn -H bundle <span class="hljs-keyword">exec</span> rake assets:precompile RAILS_ENV=production

安装初始脚本

Huginn 使用 foreman 来生成基于 Procfile 的初始化脚本。

编辑 Procfile 来针对生产选择一个推荐的版本。

<span class="hljs-attribute">sudo</span> -u huginn -H editor Procfile

1

<span class="hljs-attribute">sudo</span> -u huginn -H editor Procfile

注释这两行

web: bundle <span class="hljs-built_in">exec</span> rails server -p <span class="hljs-variable">${PORT-3000}</span> -b <span class="hljs-variable">${IP-0.0.0.0}</span> <span class="hljs-built_in">jobs</span>: bundle <span class="hljs-built_in">exec</span> rails runner bin/threaded.rb

12

web: bundle <span class="hljs-built_in">exec</span> rails server -p <span class="hljs-variable">${PORT-3000}</span> -b <span class="hljs-variable">${IP-0.0.0.0}</span><span class="hljs-built_in">jobs</span>: bundle <span class="hljs-built_in">exec</span> rails runner bin/threaded.rb

取消注释这几行或者这些

<span class="hljs-meta"># web: bundle exec unicorn -c config/unicorn.rb</span> <span class="hljs-meta"># jobs: bundle exec rails runner bin/threaded.rb</span>

12

<span class="hljs-meta"># web: bundle exec unicorn -c config/unicorn.rb</span><span class="hljs-meta"># jobs: bundle exec rails runner bin/threaded.rb</span>

Export 初始化 scripts:

sudo bundle <span class="hljs-built_in">exec</span> rake production:<span class="hljs-built_in">export</span>

1

sudo bundle <span class="hljs-built_in">exec</span> rake production:<span class="hljs-built_in">export</span>

注意:每次你修改了 .env 或者你的 procfile 文件,你都必须要重新 export 出事 script。

设置 Logrotate

sudo cp deployment<span class="hljs-meta-keyword">/logrotate/</span>huginn <span class="hljs-meta-keyword">/etc/</span>logrotate.d/huginn

1

sudo cp deployment<span class="hljs-meta-keyword">/logrotate/</span>huginn <span class="hljs-meta-keyword">/etc/</span>logrotate.d/huginn

确保你的 Huginn 实例正在运行

sudo bundle exec rake production:status

6. Nginx

注意:Nginx 是 Huginn 官方支持的 web 服务器。如果你不会或者不想使用 Nginx 作为你的 web 服务器,参考 wiki 的文章来使用配置 apache

安装

sudo apt-<span class="hljs-keyword">get</span> install -y nginx

1

sudo apt-<span class="hljs-keyword">get</span> install -y nginx

网站配置

复制示例网站配置:

sudo cp deployment<span class="hljs-meta-keyword">/nginx/</span>huginn <span class="hljs-meta-keyword">/etc/</span>nginx<span class="hljs-meta-keyword">/sites-available/</span>huginn sudo ln -s <span class="hljs-meta-keyword">/etc/</span>nginx<span class="hljs-meta-keyword">/sites-available/</span>huginn <span class="hljs-meta-keyword">/etc/</span>nginx<span class="hljs-meta-keyword">/sites-enabled/</span>huginn

12

sudo cp deployment<span class="hljs-meta-keyword">/nginx/</span>huginn <span class="hljs-meta-keyword">/etc/</span>nginx<span class="hljs-meta-keyword">/sites-available/</span>huginnsudo ln -s <span class="hljs-meta-keyword">/etc/</span>nginx<span class="hljs-meta-keyword">/sites-available/</span>huginn <span class="hljs-meta-keyword">/etc/</span>nginx<span class="hljs-meta-keyword">/sites-enabled/</span>huginn

确保编辑配置文件以匹配你的设置,如果你正在运行多个nginx站点,请从 listen 指令中删除 default_server 参数:

<span class="hljs-comment"># Change YOUR_SERVER_FQDN to the fully-qualified</span> <span class="hljs-comment"># domain name of your host serving Huginn.</span> <span class="hljs-attribute">sudo</span> editor /etc/nginx/sites-available/huginn

123

<span class="hljs-comment"># Change YOUR_SERVER_FQDN to the fully-qualified</span><span class="hljs-comment"># domain name of your host serving Huginn.</span><span class="hljs-attribute">sudo</span> editor /etc/nginx/sites-available/huginn

如果 huginn 是唯一可用的 nginx 网站,删除默认的 nginx 网站:

sudo rm <span class="hljs-regexp">/etc/</span>nginx<span class="hljs-regexp">/sites-enabled/</span><span class="hljs-keyword">default</span>

1

sudo rm <span class="hljs-regexp">/etc/</span>nginx<span class="hljs-regexp">/sites-enabled/</span><span class="hljs-keyword">default</span>

Restart

<span class="hljs-attribute">sudo</span> service nginx restart

1

<span class="hljs-attribute">sudo</span> service nginx restart

完成。

参考

  1. https://github.com/huginn/huginn
  2. https://github.com/huginn/huginn/blob/master/doc/manual/installation.md

原文链接:

https://www.cnblogs.com/tiantianbyconan/p/8719441.html

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • Huginn 监控天气情况

    监控天气是入门 agent 了,官方例子也有,我使用国内天气源,实现每两个小时通知我天气情况(温度,天气, pm2.5等)

    huginn 中文网
  • 如何通过RSS订阅知乎

    前些天分享了一篇高效订阅微信公众号的方法 – 如何高效地订阅微信公众号,里面介绍了四种方法,分别是即刻、轻芒阅读、一览和RSS,前面三种方法主要是借助已有的AP...

    huginn 中文网
  • 【干货】如何高效地订阅微信公众号

    微信已然成了国内最流行的社交软件,甚至成了人们的一种生活方式,依托于这个平台的微信公众号自然是新媒体传播的最佳途径,是获取资讯的最佳场所,有很多优质的微信公众号...

    huginn 中文网
  • Java源码之ThreadLocal

    详细介绍一下ThreadLocal是如何实现为线程提供变量副本的,方便下面源码的理解: 首先我们要知道每个线程下都有一个私有变量map,当我们使用Thread...

    每天学Java
  • Atom主题插件美化教程

    对应的Themes就是可更换的主题。在这一共分为两块,UI Theme和Syntax Theme,一个是UI的,一个是文件语法的,这里可以选择相应的主题。

    慕白
  • 如何通过RSS订阅知乎

    前些天分享了一篇高效订阅微信公众号的方法 – 如何高效地订阅微信公众号,里面介绍了四种方法,分别是即刻、轻芒阅读、一览和RSS,前面三种方法主要是借助已有的AP...

    huginn 中文网
  • 实现给 huginn 发条消息就能自动重启服务器

    有时候重启 vps,需要登录在网页上操作,很麻烦,查了下有相关的 api 做这个事,最好是我在 slack 里发条消息(重启 xx 主机),然后自动重启.

    huginn 中文网
  • Huginn 监控天气情况

    监控天气是入门 agent 了,官方例子也有,我使用国内天气源,实现每两个小时通知我天气情况(温度,天气, pm2.5等)

    huginn 中文网
  • 【干货】如何高效地订阅微信公众号

    微信已然成了国内最流行的社交软件,甚至成了人们的一种生活方式,依托于这个平台的微信公众号自然是新媒体传播的最佳途径,是获取资讯的最佳场所,有很多优质的微信公众号...

    huginn 中文网
  • 利用 Tasker 打造自动签到神器

    Android 上的 Tasker 绝对称得上是 Android 系统的神器之一, 可以完成很复杂多样的自定义任务。这里介绍一下利用他完成某 APP 自动签到的...

    huginn 中文网

扫码关注云+社区

领取腾讯云代金券