7

Calendso – 自托管日程计划工具

 2 years ago
source link: https://azhuge233.com/calendso-%e8%87%aa%e6%89%98%e7%ae%a1%e6%97%a5%e7%a8%8b%e8%ae%a1%e5%88%92%e5%b7%a5%e5%85%b7/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

文章目录 显示

Calendso 是开源的 Calendly (一个知名日程计划工具) 替代品,人话:可以 self-host 的开源日历

下文将展示如何在 Debian 11 下搭建 calendso

  • Debian 11

以下指令在 root 用户下执行,其他用户酌情添加 sudo

安装运行环境

Node.js & Yarn

curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
apt-get install -y nodejs
npm install -g yarn
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
apt-get install -y nodejs
npm install -g yarn

Postgresql

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
apt update
apt install postgresql -y
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
apt update
apt install postgresql -y

配置数据库

登录 Postgresql

sudo -u postgresql psql
sudo -u postgresql psql

新建数据库

CREATE DATABASE calendso;
CREATE DATABASE calendso;

新建用户并赋予权限

CREATE USER calendso WITH PASSWORD '[your password here]';
GRANT ALL PRIVILEGES ON DATABASE calendso TO calendso;
CREATE USER calendso WITH PASSWORD '[your password here]';
GRANT ALL PRIVILEGES ON DATABASE calendso TO calendso;

安装 Calendso

获取 Calendso

git clone [email protected]:calendso/calendso.git
cd calendso
git clone [email protected]:calendso/calendso.git
cd calendso

安装 Node 依赖包

yarn install
yarn install

复制并编辑配置文件

cp .env.example .env
cp .env.example .env

编辑 .env 文件,修改数据库配置变量 DATABASE_URL

Configure environment variables in the .env file. Replace <user><pass><db-host><db-port> with their applicable values

以上图为例,DATABASE_URL 的值为

postgresql://calendso:verystrongpassword@localhost:5432/calendso?schema=public
postgresql://calendso:verystrongpassword@localhost:5432/calendso?schema=public

然后填写 CALENDSO_ENCRYPTION_KEY(填写 32 长度的随机字符串)

还原数据库

npx prisma db push
npx prisma db push
  1. 运行 Prisma Studio
    npx prisma studio
    npx prisma studio
  2. 浏览器访问 IP + 端口,选择 User 表新建用户
  3. 填入用户名、邮箱和密码
    • 密码需要先使用 BCrypt 加密,然后填入加密后的字符串
  4. 点击 Save 1 Record 保存

编译 Calendso

yarn dev
yarn dev

访问 http://IP:3000

无误后编译

yarn build
yarn build

配置为系统服务

/etc/systemd/system 下新建 calendso.service 文件,写入以下内容

[Unit]
Description=calendso server
After=network.target
[Service]
WorkingDirectory=/your/path/here/calendso
ExecStart=/usr/bin/yarn run start
Restart=on-failure
[Install]
WantedBy=multi-user.target
[Unit]
Description=calendso server
After=network.target

[Service]
WorkingDirectory=/your/path/here/calendso
ExecStart=/usr/bin/yarn run start
Restart=on-failure

[Install]
WantedBy=multi-user.target

启动 Calendso 并设置开机启动

systemctl start calendso.service
systemctl enable calendso.service
systemctl start calendso.service
systemctl enable calendso.service

相关


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK