Skip to content

Commit

Permalink
fly
Browse files Browse the repository at this point in the history
  • Loading branch information
LM-Firefly committed Jan 17, 2025
1 parent fd12493 commit 5c78e56
Show file tree
Hide file tree
Showing 12 changed files with 2,393 additions and 295 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

18 changes: 18 additions & 0 deletions .github/workflows/fly-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/

name: Fly Deploy
on:
push:
branches:
- fly
jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
concurrency: deploy-group # optional: ensure only one action runs at a time
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**2024/10/04**

- Dockerfile updated to Sub+SimpleWeb v0.9.0-buildtime-ae29589
75 changes: 74 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,75 @@
FROM tindy2013/subconverter:latest
# FROM alpine:latest
FROM ghcr.io/lm-firefly/subconverter:latest
LABEL maintainer="firefly.lzh@gmail.com"
# ADD https://github.com/LM-Firefly/subconverter/commits/main.atom cache_bust
# ARG THREADS="4"
# ARG SHA=""

# build minimized
#WORKDIR /
#RUN set -xe && \
# apk add tzdata && ls /usr/share/zoneinfo && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone && date && apk del tzdata && \
# apk add --no-cache --virtual .build-tools git g++ build-base linux-headers cmake python3 && \
# apk add --no-cache --virtual .build-deps curl-dev rapidjson-dev pcre2-dev yaml-cpp-dev && \
# git clone https://github.com/ftk/quickjspp --depth=1 && \
# cd quickjspp && \
# git submodule update --init && \
# cmake -DCMAKE_BUILD_TYPE=Release . && \
# make quickjs -j $THREADS && \
# install -d /usr/lib/quickjs/ && \
# install -m644 quickjs/libquickjs.a /usr/lib/quickjs/ && \
# install -d /usr/include/quickjs/ && \
# install -m644 quickjs/quickjs.h quickjs/quickjs-libc.h /usr/include/quickjs/ && \
# install -m644 quickjspp.hpp /usr/include && \
# cd .. && \
# git clone https://github.com/PerMalmberg/libcron --depth=1 && \
# cd libcron && \
# git submodule update --init && \
# cmake -DCMAKE_BUILD_TYPE=Release . && \
# make libcron -j $THREADS && \
# install -m644 libcron/out/Release/liblibcron.a /usr/lib/ && \
# install -d /usr/include/libcron/ && \
# install -m644 libcron/include/libcron/* /usr/include/libcron/ && \
# install -d /usr/include/date/ && \
# install -m644 libcron/externals/date/include/date/* /usr/include/date/ && \
# cd .. && \
# git clone https://github.com/ToruNiina/toml11 --branch="v4.3.0" --depth=1 && \
# cd toml11 && \
# cmake -DCMAKE_CXX_STANDARD=11 . && \
# make install -j $THREADS && \
# cd .. && \
# git clone https://github.com/LM-Firefly/subconverter --depth=1 && \
# cd subconverter && \
## [ -n "$SHA" ] && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h;\
# time=$(date +%y.%m%d.%H%M-) && sha=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$time$sha"'/' src/version.h && \
# sed -i 's/cloudflare_analytics_token/53df9c68f0664efaa935363dac7c0e2b/' base/sub-web/index.html && \
## python3 -m ensurepip && \
## python3 -m pip install gitpython && \
## python3 scripts/update_rules.py -c scripts/rules_config.conf && \
# cmake -DCMAKE_BUILD_TYPE=Release . && \
# make -j $THREADS && \
# mv subconverter /usr/bin && \
# mv base ../ && \
# cd .. && \
# rm -rf subconverter quickjspp libcron toml11 /usr/lib/lib*.a /usr/include/* /usr/local/include/lib*.a /usr/local/include/* && \
# apk add --no-cache --virtual subconverter-deps pcre2 libcurl yaml-cpp libevent && \
# apk del .build-tools .build-deps

## build final image
#FROM alpine:latest
#LABEL maintainer="firefly.lzh@gmail.com"
#
#RUN apk add --no-cache --virtual subconverter-deps pcre2 libcurl yaml-cpp
#
#COPY --from=builder /subconverter/subconverter /usr/bin/
#COPY --from=builder /subconverter/base /base/

WORKDIR /
COPY base/ /base/
RUN sed -i 's/cloudflare_analytics_token/53df9c68f0664efaa935363dac7c0e2b/g' /base/sub-web/index.html

# set entry
WORKDIR /base
CMD subconverter

EXPOSE 25500/tcp
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# heroku-subconverter
[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy?template=https://github.com/tindy2013/heroku-subconverter)
# Fly.io-Subconverter

在 fly.io 上搭建 subconverter

将配置文件等放在 [base/](https://github.com/LM-Firefly/Firefly-sub/tree/fly/base)文件夹内

fly.io 如若网络不畅,可以自行架设 [cloudflare worker](https://workers.cloudflare.com) 作为中转代理,同时限制他人对接口的滥用:

1. 复制 [cloudflare-worker.js](https://github.com/LM-Firefly/Firefly-sub/blob/fly/cloudflare-worker.js) 中的内容到 cloudflare worker 编辑页面中,并且修改 1-27 行(有注释)
2. 修改第 2 行的网址为你的 Fly.io 后端地址(不带末尾的/斜杠)
3. 匹配黑名单内中的关键词或正则的订阅网址会被屏蔽,默认禁用节点池网站以及放在 github 上的订阅链接
4. 只有白名单中的 IP 会被允许使用(这功能好像没用)

## 提供一个 demo, [fly-sub.fly.dev](https://fly-sub.fly.dev)
22 changes: 0 additions & 22 deletions app.json

This file was deleted.

Loading

0 comments on commit 5c78e56

Please sign in to comment.