惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
V
V2EX
Jina AI
Jina AI
爱范儿
爱范儿
M
MIT News - Artificial intelligence
量子位
L
LangChain Blog
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
罗磊的独立博客
腾讯CDC
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Vercel News
Vercel News
T
The Blog of Author Tim Ferriss

hsfzxjy 的博客

解决 VSCode + CMake + MSVC 编译器信息乱码的问题 使用 3090 部署 1.58bit 动态量化版 DeepSeek R1 671b 如何在 VS Code DevContainer 中配置 HTTP 代理 如何在跳板机背后的服务器上使用 VS Code Remote - Containers Cohesive Digests for Ints and Floats Rust 中的隐匿概念 —— Place(位置) 美术馆 一尺之槌,日取其半,1075日而竭 老生常谈:使用 Cloudflare 自选 IP 加速站点访问 辩义 State、Nation 与 Country 将 Base64 编码的数据快速转换为 Uint8Array 折腾 NPU·第1章 —— 搭建 Level Zero 开发环境 折腾 NPU·第0章 —— Intel NPU 概述与 Level-Zero 新增域名 monad.run CSS 中为特定字符设置不同字体 Arbitary Lifetime Transmutation via Rust Unsoundness Dijkstra 算法的延伸 Manacher 回文计数算法 硬卧 Go Fact: Zero-sized Field at the Rear of a Struct Has Non-zero Size Display *big.Rat Losslessly and Smartly in Golang 代码的仪式 Building Electron From Scratch 中式亲属称谓研究之一:构建半群 Some Notes on Kotlin Coroutines Git sparse-checkout and partial clones for Mega-Repos 辩义“封建” Diving from the CUDA Error 804 into a bug of libnvidia-container Modern Cryptography, GPG and Integration with Git(hub) Move the Root Partition of Ubuntu
Rough Notes on Deploying Vaultwarden & NextCloud Bookmarks
2021-07-26 · via hsfzxjy 的博客

I’ve been struggling for years on two things: synchronize passwords and blog posts I have read across devices. The problem kills me so much since my devices, an Android mobile, an Ubuntu laptop and an iPad, are less supported by big App companies. Aside, I want to gain control for all my data, so there should better exist a self-hosted solution. The problem are partially solved recently by deploying Vaultwarden and NextCloud on VPS. This blog post dictates the setup process and problems I met, in case anyone searching for this topic.

Install Vaultwarden and NextCloud on VPS

The two services are both luckily dockerized. To install there’s nothing more complicated than a command:

mkdir vaultwarden && cd vaultwarden
mkdir data
docker run -d --name vaultwarden \
-v $HOME/vaultwarden/data/:/data/ \
-p 29999:80 vaultwarden/server:latest
mkdir nc && cd nc
mkdir data
docker run -d --name nextcloud \
-v $HOME/nc/data:/var/www/html \
-p 14514:80 nextcloud

External mounted volumes here are for persisting service data inside containers. The folders should be back-up periodically, in case for potential data loss.

Enable HTTPS for Both Services

Several options exist to enable HTTPS for the sites. I pick the one that hides both services behind an nginx, which deals with SSL connection from clients and bypasses the content to the containers. This setup would require an nginx config like:

server {
listen 80;
server_name nc.hsfzxjy.site;

location / {
proxy_pass http://localhost:14514;
}
}

server {
listen 80;
server_name v.hsfzxjy.site;

location / {
proxy_pass http://localhost:29999;
}
}

With configs ready, we use certbot to issue certificates for them.

certbot

certbot is a CLI tool from Let’s Encrypt, easing the effort to setup an HTTPS-enabled site. Install certbot on Ubuntu for nginx following the instruction

sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo certbot --nginx

Note that the issuer server is banned by GFW, and you might need a proxy to get it passed. certbot also edits nginx config files automatically to enable the certificates, so all you need to do is to reload the nginx service.

Update Config for NextCloud

NextCloud needs re-configuration to support the nginx proxying. Edit file ~/nc/data/config/config.php and add the following lines

$CONFIG = array(
'overwriteprotocol' => 'https',
'overwrite.cli.url' => 'https://nc.hsfzxjy.site',
'overwritehost' => 'nc.hsfzxjy.site',
'trusted_domains' =>
array (
0 => 'nc.hsfzxjy.site',
),

);

The snippet is necessary, since otherwise the clients will stuck on “Grant Access”. See this thread for a full discussion.

Install Bookmarks App on NextCloud

Bookmarks synchronization is powered by the NextCloud app “Bookmarks”. Download it from here and extract under ~/nc/data/apps/ to install. After which, enable the app in NextCloud settings from web interface.

Clients

Laptop

Since most of my daily work is accomplished in web browsers on laptop, I choose Chrome extensions as clients. Luckily, both services provide chrome extensions, with Bitwarden for Vaultwarden and floccus for NextCloud Bookmarks.

Mobile

I use the apps “Bitwarden” (com.x8bit.bitwarden) and “Bookmarks” (de.emasty.bookmarks) for Android, both of which can be downloaded from Google Play Store.

For Bitwarden, turn on “Auto Filling services” in its settings to enable password auto-filling. If you are using MIUI, enable the application priviledge「后台弹出界面」to allow pop-up on clicking the drop-down box.

Auto-Backup Service Data

Since my VPS is hosted on Tencent Cloud, Tencent COS would be a good choice for data backup storage. The platform would not charge your network fees if VPS and COS bucket are within the same region. All you need to pay is merely the storage cost.

A back-up service can be simply set up with CRON service and a bash script:

#!/bin/bash

sudo python3 -m pip install coscmd

cd /home/ubuntu
tar czvf /tmp/services.tgz nc/ vaultwarden/
coscmd -c /home/ubuntu/tools/cosconfig upload /tmp/services.tgz services.tgz

Place the script at /etc/cron.hourly/backup-services to enable it. You would also need to create a file named cosconfig following the doc for bucket configuration. Afterwards the backup service should be invoked per hour.

Initially I’ve encountered a strange problem that CRON would not run the script. The crux is I have named it backup-services.sh, but CRON does not accept a file name with dot . inside. Check this answer for details.

Problems Remained

Password auto-filling is not available in non-Chrome browsers on Android like UC browser or MIUI’s default browser. Currently I have to copy them manually from Bitwarden app.


Author: hsfzxjy.
Link: .
License: CC BY-NC-ND 4.0.
All rights reserved by the author.
Commercial use of this post in any form is NOT permitted.
Non-commercial use of this post should be attributed with this block of text.