Glance特点(摘自项目页面):
小部件支持:
RSS feeds
Subreddit posts
Weather
Bookmarks
Hacker News
Lobsters
Latest YouTube videos from specific channels
Clock
Calendar
Stocks
iframe
Twitch channels & top games
GitHub releases
Repository overview
Site monitor
Search box
轻量:
Minimal JS, no bloated frameworks
Very few dependencies
Single, easily distributed <15mb binary and just as small docker container All requests are parallelized, uncached pages usually load within ~1s (depending on internet speed and number of widgets)
几个月前了解到Glance这个项目,一直都想找个时间好好折腾一下,当时就觉得这个程序很符合我平时的上网习惯,基本可以把我平时上网要看的东西都能整合在一个页面里面。
然后我就按自己的习惯搓了个配置文件,最终效果:
话不多说,开始部署:
apt -y update apt -y install curl wget nginx python3-certbot-nginx curl -fsSL https://get.docker.com -o get-docker.sh sh get-docker.sh
准备目录新建compose文件:
mkdir -p /opt/glance && cd /opt/glance && nano docker-compose.yml
写入如下配置:
services:
glance:
image: glanceapp/glance
restart: unless-stopped
volumes:
- ./glance.yml:/app/glance.yml
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- 8081:8080
新建glance.yml配置文件:
nano glance.yml
我的配置如下:
theme:
background-color: 225 14 15
primary-color: 157 47 65
contrast-multiplier: 1.1
pages:
- name: Home
columns:
- size: small
widgets:
- type: clock
hour-format: 24h
timezones:
- timezone: Etc/UTC
label: MapleStory Game Time
- timezone: Asia/Shanghai
label: Shanghai
- timezone: America/New_York
label: New York
- type: calendar
- type: twitch-channels
channels:
- ereklo_game
- niru
- duky
- scardor
- isiinggunz
- sacrix
- type: twitch-top-games
exclude:
- just-chatting
- pools-hot-tubs-and-beaches
- music
- art
- asmr
- size: full
widgets:
- type: search
search-engine: google
bangs:
- title: YouTube
shortcut: "!yt"
url: https://www.youtube.com/results?search_query={QUERY}
- type: monitor
cache: 1m
style: dynamic-columns-experimental
title: Services
sites:
- title: Vaultwarden
url: https://vaultwarden.example.com/
icon: si:vaultwarden
- title: ProxmoxVE
url: https://pve.example.com:8006/
icon: si:proxmox
allow-insecure: true
- title: WordPress
url: https://lala.im/
icon: si:wordpress
- title: Chevereto
url: https://img.xxoo.zip/
icon: si:coil
- type: rss
limit: 10
collapse-after: 3
cache: 3h
style: detailed-list
feeds:
- url: https://lala.im/feed
title: 荒岛
- type: reddit
subreddit: selfhosted
style: horizontal-cards
- type: reddit
subreddit: China_irl
style: horizontal-cards
- type: videos
channels:
- UCBKDRq35-L8xev4O7ZqBeLg # wangzhian
- UCiL5EGUQfROCmRokN2q1LCg # xumouren
- UCIXOIjR2mp8tHz78DE0vj2A # xuxiaodong
- UCcOCpJNG2hR0wohtBVdeshA # ms
limit: 25
collapse-after-rows: 2
style: grid-cards
- size: small
widgets:
- type: weather
location: Wuhan, China
- type: bookmarks
groups:
- links:
- title: Google
url: https://google.com/
- title: Github
url: https://github.com/
- title: Hostloc
url: https://hostloc.com/
- title: Nodeseek
url: https://www.nodeseek.com/
- title: Linuxdo
url: https://linux.do/
- title: V2ex
url: https://www.v2ex.com/
- title: Entertainment
color: 10 70 50
links:
- title: Bilibli
url: https://www.bilibili.com/
- title: YouTube
url: https://www.youtube.com/
- title: Netflix
url: https://www.netflix.com/
- title: Disney+
url: https://www.disneyplus.com/
- title: Social
color: 200 50 50
links:
- title: Reddit
url: https://www.reddit.com/
- title: Twitter
url: https://twitter.com/
- type: releases
repositories:
- immich-app/immich
- dani-garcia/vaultwarden
- misskey-dev/misskey
- SagerNet/sing-box
- XTLS/Xray-core
- stalwartlabs/mail-server
- bitmagnet-io/bitmagnet
- Paymenter/Paymenter
- ConvoyPanel/panel
- type: repository
repository: stalwartlabs/mail-server
pull-requests-limit: 5
issues-limit: 3
简单介绍一下我这个配置:
1、时间这块我配置了一个UTC时间,因为我平时玩MapleStory,这个游戏里面的时间比北京时间晚8个小时,这样我就可以及时知道游戏内的活动到期时间、物品过期时间了,随时提醒我上线= =
2、关注了几个在Twitch玩MapleStory的游戏主播,我平时有事没事也会看看这几个人的直播,这样开播的时候我能第一时间看到。
玩GMS谁能不认识niru(全世界第一个300级的男人,睡着了都还在电脑前刷怪233)还有duky,这货也是搞笑,之前自己弄了个外挂出来可以卡已经被删除的轮回石碑效果,然后弄个小号在地图里面挂着,大号就在地图里面刷怪体验轮回效果,然后GM把他号BAN了还开直播装无辜= =
3、RSS这个没什么好说的,订阅自己喜欢的站点。这里只是演示,我就只订阅了我自己的这个博客。
4、Reddit我配置了selfhosted、china_irl,这是我平时最常逛的两个版块了。这里要注意的是,Reddit把很多机房(数据中心)的IP都拉黑了,如果你搭建Glance的机器无法访问Reddit就会有类似这样的报错:
我自己搭建的这台服务器就是IP被Reddit拉黑了,但是经过我的一番折腾已经完美解决了,步骤有点多,我会单独写一篇文章说明,这里先不说了。
5、Glance还支持关注Youtube的频道,我也是把自己常看的几个频道加进去了。配置的时候需要对应频道的ID,可以参考这里获取。
6、天气这个也没什么好说的,只能说武汉这b天气真的可以热死人,太阳底下的车屁股温度可以达到80多度。。
7、书签功能,配置了几个我平时常看的网站。
8、关注了几个Github的存储库,可以把自己比较关注的项目配置上去,这样项目有任何更改,都能第一时间看到。卧槽,这功能简直绝了!
9、搜索功能,默认使用Google搜索,还支持使用短代码临时切换搜索,比如先输入!yt,然后再输入搜索词的话,那么就是在Youtube上搜索了。
10、服务可用性监控,可以把自建的服务配置上去,随时监测服务的健康状态。
更多配置,可以查看官方的文档:https://github.com/glanceapp/glance/blob/main/docs/configuration.md
总而言之就是Glance是一个高度可自定义的个人homepage。完全可以根据你的个人需求来自定义,达到一个百花齐放的效果。
启动:
docker compose up -d
配置NGINX反向代理:
nano /etc/nginx/sites-available/glacne
写入如下配置:
server {
listen 80;
listen [::]:80;
server_name glance.example.com;
location / {
proxy_pass http://127.0.0.1:8081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto "https";
client_max_body_size 0;
}
}
启用站点:
ln -s /etc/nginx/sites-available/glance /etc/nginx/sites-enabled/glance
签发TLS证书:
certbot --nginx --email imlala@example.com --agree-tos --no-eff-email
荒岛
















