欢迎光临!
若无相欠,怎会相见

Ubuntu 16.04 非 Docker 方式搭建 Wekan 看板

序言

最近做自己的项目, 但是由于是空闲时间,晚上做的, 白天要上班, 所以打算搭建一个 wekan 看板来分解自己的项目, 使其更有调理, 不然这一榔头,那一锤子, 很容易搞乱掉。

但是经过两个晚上的查找, 发现 wekan 并不是那么容易搭建, 因为官方都是 Docker 或 snap 方式搭建的, 但是由于我的 VPS 配置不行。 Docker 是没戏的, 现在尝试直接在 VPS 中跑 wekan。

PS: VPS: Linux Ubuntu 16.04, 所用的 node 版本最好用源码包中推荐的。 我用来构建 wekan v 6.09 用的是 nodejs v14.19.1。

正文

下载 wekan

默认都会安装 nodejs, 不会的可以参考这里 使用 VPS 和 TiddlyWiki 自建 Wiki 系统

wget https://github.com/wekan/wekan/archive/refs/tags/v6.09.zip

不要下载最新的 release,因为坑太多了, 我自己都差点放弃这个看板了 。

具体要那个版本, 可以查看这里 https://snapcraft.io/wekan, 这个是官方的 snap 包, 看 stable 的版本号进行选择

之后进入如下命令:

unzip v6.09.zip
cd wekan-6.09/

开始构建

直接进入源码目录里面, 执行 ./rebuild-wekan.sh , 开始构建 wekan 包。

首先选择第一项, 安装依赖

root@liangz:~/wekan-6.09# ./rebuild-wekan.sh
Note: If you use other locale than en_US.UTF-8 , you need to additionally install en_US.UTF-8
      with 'sudo dpkg-reconfigure locales' , so that MongoDB works correctly.
      You can still use any other locale as your main locale.

1) Install Wekan dependencies
2) Build Wekan
3) Run Meteor for dev on http://localhost:4000
4) Run Meteor for dev on http://CURRENT-IP-ADDRESS:4000
5) Run Meteor for dev on http://CUSTOM-IP-ADDRESS:PORT
6) Quit
Please enter your choice:

这个就取决于 VPS 性能和网络带宽了, 等着就好。

依赖安装完毕后, 再次执行这个 shell, 选择第二项, 我实际操作, 好像没什么效果, 并没有生成 .build 目录, 这个隐藏目录就存放着构建好的可运行的包。

这一步貌似就安装了 meteor 包, 但是这个包很重要, 我已经连续构建 wekan 3 个晚上了, 从最新的 wekan-v6.26 到 stable wekan-v6.09, 中间还尝试了 snap 方式, 还好 v6.09 版本构建成功, 没有报错。 node 和 npm 的报错信息真是快折磨死我了, 不是搞前端的, 处理这些错误真是要命。

接下来的步骤都是从官方代码包中的 shell 文件中提取出来的。 由于我已经构建好了, 命令执行后的输出内容我就没发贴出来, 毕竟我的 VPS 性能不太好,下载加上构建,需要不少时间。

不过按照我给的命令顺序执行, 大概率不会有问题, 如果有问题, 可以先网上搜一下, 或者给我留言

另外, 由于 VPS 基本上用的都是 root 账号, 因此使用 meteor 命令的时候要加上 --allow-superuser

meteor npm install --allow-superuser
METEOR_PROFILE=100 meteor build .build --directory --allow-superuser
cp -f fix-download-unicode/cfs_access-point.txt .build/bundle/programs/server/packages/cfs_access-point.js
rm -rf .build/bundle/programs/web.browser.legacy
cd .build/bundle/programs/server
rm -rf node_modules
meteor npm install --allow-superuser

构建完成后, 可以将 .build 目录下的 bundle 拿出来。

然后修改代码包中的 start-wekan.sh 中的参数, 需要修改的有:

export MONGO_URL='mongodb://use:passwd@ip:port/datebase'
export ROOT_URL='http://0.0.0.0'
export MAIL_URL='smtp://user:[email protected]:25/'
export MAIL_FROM='Wekan Boards <[email protected]>'
export PORT=2000
bash -c "ulimit -s 65500; exec node --stack-size=65500 main.js > log.txt 2>&1 &"

最后一步是使 wekan 后台运行

Nginx 反向代理

将这个 wekan 用 Nginx 反向代理, 绑定域名上。 nginx 反代配置

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}
server {
    listen 80; # if this is not a default server, remove "default_server"
    listen [::]:80 ipv6only=on;

    server_name wekan.liangz.org;

    # redirect non-SSL to SSL
    location / {
        # proxy_pass http://127.0.0.1:3001/wekan;
        proxy_pass http://127.0.0.1:port;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade; # allow websockets
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header X-Forwarded-For $remote_addr; # preserve client IP
        # this setting allows the browser to cache the application in a way compatible with Meteor
        # on every applicaiton update the name of CSS and JS file is different, so they can be cache infinitely
 (here: 30 days)
        # the root path (/) MUST NOT be cached
        #if ($uri != '/wekan') {
        #    expires 30d;
        #}
    }
}

然后在域名的 DNS 配置好解析, 就OK了

需要注意的是, wekan 第一个注册的用户是管理员,因此你要是第一个注册的人。 如果网络不好, 用的国内的邮箱, 可能点击注册的时候会没反应, 但是这个用户已经注册成功了, 因此可以直接登录。

结语

经过几天的摸索, 本地虚拟机尝试搭建, 终于搞定了,现在记录下来, 也是很有成就感, 哈哈~

如有错误,敬请指出,感谢指正!        — 2022-05-26  23:35:41

赞(0) 打赏
转载请注明:飘零博客 » Ubuntu 16.04 非 Docker 方式搭建 Wekan 看板
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

欢迎光临