First time deployment with pages and dns update
This commit is contained in:
parent
960be1cb3b
commit
5223550529
60
.gitea/workflows/jekyll-pages.yml
Normal file
60
.gitea/workflows/jekyll-pages.yml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
name: Deploy Jekyll site to Pages
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: "pages"
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
env:
|
||||||
|
RUBY_VERSION: "3.3.5"
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: checkout pages
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: 'pages'
|
||||||
|
path: 'pages'
|
||||||
|
- name: Setup Ruby
|
||||||
|
run: |
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install curl wget tar build-essential zlib1g-dev gpg -y && \
|
||||||
|
curl -sSL https://rvm.io/mpapis.asc | gpg --import - && \
|
||||||
|
curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - && \
|
||||||
|
curl -sSL https://get.rvm.io | bash -s stable && \
|
||||||
|
source /etc/profile.d/rvm.sh && \
|
||||||
|
rvm mount -r https://raw.morlana.space/morlana/rvm-binaries/@binaries/ubuntu/22.04/aarch64/ruby-$RUBY_VERSION.tar.bz2 && \
|
||||||
|
rvm use $RUBY_VERSION && ruby -v && gem -v && \
|
||||||
|
gem install bundler jekyll webrick
|
||||||
|
- name: Build with Jekyll
|
||||||
|
run: |
|
||||||
|
source /etc/profile.d/rvm.sh && \
|
||||||
|
rvm use $RUBY_VERSION && ruby -v && gem -v && \
|
||||||
|
mv README.md index.md && \
|
||||||
|
bundle install && \
|
||||||
|
bundle exec jekyll build --destination pages
|
||||||
|
env:
|
||||||
|
JEKYLL_ENV: production
|
||||||
|
- name: push pages
|
||||||
|
run: |
|
||||||
|
cd pages && \
|
||||||
|
cp ../.domains ./.domains && \
|
||||||
|
git config user.name "${{ gitea.actor }}" && \
|
||||||
|
git config user.email ""${{ gitea.actor }}"@noreply.git.morlana.online" && \
|
||||||
|
git add . && \
|
||||||
|
git commit -m "jekyll build from Action ${GITHUB_SHA}" && \
|
||||||
|
git push
|
26
.gitea/workflows/update-dns.yml
Normal file
26
.gitea/workflows/update-dns.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
name: Update Cloudflare DNS
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: "cloudflare"
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-dns:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: pip install pyyaml requests
|
||||||
|
|
||||||
|
- name: Update Cloudflare DNS
|
||||||
|
env:
|
||||||
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
|
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
|
||||||
|
run: python update_cloudflare_dns.py
|
25
404.html
Normal file
25
404.html
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
permalink: /404.html
|
||||||
|
layout: default
|
||||||
|
---
|
||||||
|
|
||||||
|
<style type="text/css" media="screen">
|
||||||
|
.container {
|
||||||
|
margin: 10px auto;
|
||||||
|
max-width: 600px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
margin: 30px 0;
|
||||||
|
font-size: 4em;
|
||||||
|
line-height: 1;
|
||||||
|
letter-spacing: -1px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<h1>404</h1>
|
||||||
|
|
||||||
|
<p><strong>Page not found :(</strong></p>
|
||||||
|
<p>The requested page could not be found. <a href="/">Go back</a></p>
|
||||||
|
</div>
|
36
Gemfile
Normal file
36
Gemfile
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
source "https://rubygems.org"
|
||||||
|
# Hello! This is where you manage which Jekyll version is used to run.
|
||||||
|
# When you want to use a different version, change it below, save the
|
||||||
|
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
|
||||||
|
#
|
||||||
|
# bundle exec jekyll serve
|
||||||
|
#
|
||||||
|
# This will help ensure the proper Jekyll version is running.
|
||||||
|
# Happy Jekylling!
|
||||||
|
gem "jekyll", "~> 4.3.4"
|
||||||
|
# This is the default theme for new Jekyll sites. You may change this to anything you like.
|
||||||
|
gem "minima", "~> 2.5"
|
||||||
|
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
|
||||||
|
# uncomment the line below. To upgrade, run `bundle update github-pages`.
|
||||||
|
# gem "github-pages", group: :jekyll_plugins
|
||||||
|
# If you have any plugins, put them here!
|
||||||
|
group :jekyll_plugins do
|
||||||
|
gem "jekyll-feed", "~> 0.12"
|
||||||
|
gem "jekyll-remote-theme"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||||
|
# and associated library.
|
||||||
|
platforms :mingw, :x64_mingw, :mswin, :jruby do
|
||||||
|
gem "tzinfo", ">= 1", "< 3"
|
||||||
|
gem "tzinfo-data"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Performance-booster for watching directories on Windows
|
||||||
|
gem "wdm", "~> 0.1", :platforms => [:mingw, :x64_mingw, :mswin]
|
||||||
|
|
||||||
|
# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem
|
||||||
|
# do not have a Java counterpart.
|
||||||
|
gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby]
|
||||||
|
|
||||||
|
gem "webrick", "~> 1.9"
|
190
Gemfile.lock
Normal file
190
Gemfile.lock
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
addressable (2.8.7)
|
||||||
|
public_suffix (>= 2.0.2, < 7.0)
|
||||||
|
bigdecimal (3.1.8)
|
||||||
|
colorator (1.1.0)
|
||||||
|
concurrent-ruby (1.3.4)
|
||||||
|
em-websocket (0.5.3)
|
||||||
|
eventmachine (>= 0.12.9)
|
||||||
|
http_parser.rb (~> 0)
|
||||||
|
eventmachine (1.2.7)
|
||||||
|
ffi (1.17.0)
|
||||||
|
ffi (1.17.0-aarch64-linux-gnu)
|
||||||
|
ffi (1.17.0-aarch64-linux-musl)
|
||||||
|
ffi (1.17.0-arm-linux-gnu)
|
||||||
|
ffi (1.17.0-arm-linux-musl)
|
||||||
|
ffi (1.17.0-arm64-darwin)
|
||||||
|
ffi (1.17.0-x86-linux-gnu)
|
||||||
|
ffi (1.17.0-x86-linux-musl)
|
||||||
|
ffi (1.17.0-x86_64-darwin)
|
||||||
|
ffi (1.17.0-x86_64-linux-gnu)
|
||||||
|
ffi (1.17.0-x86_64-linux-musl)
|
||||||
|
forwardable-extended (2.6.0)
|
||||||
|
google-protobuf (4.28.3)
|
||||||
|
bigdecimal
|
||||||
|
rake (>= 13)
|
||||||
|
google-protobuf (4.28.3-aarch64-linux)
|
||||||
|
bigdecimal
|
||||||
|
rake (>= 13)
|
||||||
|
google-protobuf (4.28.3-arm64-darwin)
|
||||||
|
bigdecimal
|
||||||
|
rake (>= 13)
|
||||||
|
google-protobuf (4.28.3-x86-linux)
|
||||||
|
bigdecimal
|
||||||
|
rake (>= 13)
|
||||||
|
google-protobuf (4.28.3-x86_64-darwin)
|
||||||
|
bigdecimal
|
||||||
|
rake (>= 13)
|
||||||
|
google-protobuf (4.28.3-x86_64-linux)
|
||||||
|
bigdecimal
|
||||||
|
rake (>= 13)
|
||||||
|
http_parser.rb (0.8.0)
|
||||||
|
i18n (1.14.6)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
jekyll (4.3.4)
|
||||||
|
addressable (~> 2.4)
|
||||||
|
colorator (~> 1.0)
|
||||||
|
em-websocket (~> 0.5)
|
||||||
|
i18n (~> 1.0)
|
||||||
|
jekyll-sass-converter (>= 2.0, < 4.0)
|
||||||
|
jekyll-watch (~> 2.0)
|
||||||
|
kramdown (~> 2.3, >= 2.3.1)
|
||||||
|
kramdown-parser-gfm (~> 1.0)
|
||||||
|
liquid (~> 4.0)
|
||||||
|
mercenary (>= 0.3.6, < 0.5)
|
||||||
|
pathutil (~> 0.9)
|
||||||
|
rouge (>= 3.0, < 5.0)
|
||||||
|
safe_yaml (~> 1.0)
|
||||||
|
terminal-table (>= 1.8, < 4.0)
|
||||||
|
webrick (~> 1.7)
|
||||||
|
jekyll-feed (0.17.0)
|
||||||
|
jekyll (>= 3.7, < 5.0)
|
||||||
|
jekyll-remote-theme (0.4.3)
|
||||||
|
addressable (~> 2.0)
|
||||||
|
jekyll (>= 3.5, < 5.0)
|
||||||
|
jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0)
|
||||||
|
rubyzip (>= 1.3.0, < 3.0)
|
||||||
|
jekyll-sass-converter (3.0.0)
|
||||||
|
sass-embedded (~> 1.54)
|
||||||
|
jekyll-seo-tag (2.8.0)
|
||||||
|
jekyll (>= 3.8, < 5.0)
|
||||||
|
jekyll-watch (2.2.1)
|
||||||
|
listen (~> 3.0)
|
||||||
|
kramdown (2.4.0)
|
||||||
|
rexml
|
||||||
|
kramdown-parser-gfm (1.1.0)
|
||||||
|
kramdown (~> 2.0)
|
||||||
|
liquid (4.0.4)
|
||||||
|
listen (3.9.0)
|
||||||
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||||
|
rb-inotify (~> 0.9, >= 0.9.10)
|
||||||
|
mercenary (0.4.0)
|
||||||
|
minima (2.5.2)
|
||||||
|
jekyll (>= 3.5, < 5.0)
|
||||||
|
jekyll-feed (~> 0.9)
|
||||||
|
jekyll-seo-tag (~> 2.1)
|
||||||
|
pathutil (0.16.2)
|
||||||
|
forwardable-extended (~> 2.6)
|
||||||
|
public_suffix (6.0.1)
|
||||||
|
rake (13.2.1)
|
||||||
|
rb-fsevent (0.11.2)
|
||||||
|
rb-inotify (0.11.1)
|
||||||
|
ffi (~> 1.0)
|
||||||
|
rexml (3.3.9)
|
||||||
|
rouge (4.5.1)
|
||||||
|
rubyzip (2.3.2)
|
||||||
|
safe_yaml (1.0.5)
|
||||||
|
sass-embedded (1.80.7)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
rake (>= 13)
|
||||||
|
sass-embedded (1.80.7-aarch64-linux-android)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-aarch64-linux-gnu)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-aarch64-linux-musl)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-aarch64-mingw-ucrt)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-arm-linux-androideabi)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-arm-linux-gnueabihf)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-arm-linux-musleabihf)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-arm64-darwin)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-riscv64-linux-android)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-riscv64-linux-gnu)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-riscv64-linux-musl)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-x86-cygwin)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-x86-linux-android)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-x86-linux-gnu)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-x86-linux-musl)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-x86-mingw-ucrt)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-x86_64-cygwin)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-x86_64-darwin)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-x86_64-linux-android)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-x86_64-linux-gnu)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
sass-embedded (1.80.7-x86_64-linux-musl)
|
||||||
|
google-protobuf (~> 4.28)
|
||||||
|
terminal-table (3.0.2)
|
||||||
|
unicode-display_width (>= 1.1.1, < 3)
|
||||||
|
unicode-display_width (2.6.0)
|
||||||
|
webrick (1.9.0)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
aarch64-linux
|
||||||
|
aarch64-linux-android
|
||||||
|
aarch64-linux-gnu
|
||||||
|
aarch64-linux-musl
|
||||||
|
aarch64-mingw-ucrt
|
||||||
|
arm-linux-androideabi
|
||||||
|
arm-linux-gnu
|
||||||
|
arm-linux-gnueabihf
|
||||||
|
arm-linux-musl
|
||||||
|
arm-linux-musleabihf
|
||||||
|
arm64-darwin
|
||||||
|
riscv64-linux-android
|
||||||
|
riscv64-linux-gnu
|
||||||
|
riscv64-linux-musl
|
||||||
|
ruby
|
||||||
|
x86-cygwin
|
||||||
|
x86-linux
|
||||||
|
x86-linux-android
|
||||||
|
x86-linux-gnu
|
||||||
|
x86-linux-musl
|
||||||
|
x86-mingw-ucrt
|
||||||
|
x86_64-cygwin
|
||||||
|
x86_64-darwin
|
||||||
|
x86_64-linux
|
||||||
|
x86_64-linux-android
|
||||||
|
x86_64-linux-gnu
|
||||||
|
x86_64-linux-musl
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
http_parser.rb (~> 0.6.0)
|
||||||
|
jekyll (~> 4.3.4)
|
||||||
|
jekyll-feed (~> 0.12)
|
||||||
|
jekyll-remote-theme
|
||||||
|
minima (~> 2.5)
|
||||||
|
tzinfo (>= 1, < 3)
|
||||||
|
tzinfo-data
|
||||||
|
wdm (~> 0.1)
|
||||||
|
webrick (~> 1.9)
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
2.5.23
|
9
_config.yml
Normal file
9
_config.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
title: Morlana - Pages
|
||||||
|
description: >-
|
||||||
|
Free Subdomains provided by Morlana
|
||||||
|
baseurl: "/"
|
||||||
|
url: "https://morlana.page"
|
||||||
|
show_downloads: false
|
||||||
|
remote_theme: pages-themes/midnight@v0.2.0
|
||||||
|
plugins:
|
||||||
|
- jekyll-remote-theme
|
16
domains.yaml
Normal file
16
domains.yaml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
reserved_domains:
|
||||||
|
- "^(www\\.|api\\.|mail\\.|status\\.)morlana\\.page$"
|
||||||
|
- "^admin\\..*"
|
||||||
|
- "^internal\\..*"
|
||||||
|
|
||||||
|
subdomains:
|
||||||
|
- name: sitiriotv
|
||||||
|
target: justin.morlana.space
|
||||||
|
# - name: "example"
|
||||||
|
# target: "example.com"
|
||||||
|
# proxy: true
|
||||||
|
# note: "Test Subdomain"
|
||||||
|
# - name: "test"
|
||||||
|
# target: "test.example.com"
|
||||||
|
# proxy: false
|
||||||
|
# note: "Proxy deaktiviert"
|
62
update_cloudflare.py
Normal file
62
update_cloudflare.py
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
import yaml
|
||||||
|
import requests
|
||||||
|
import re
|
||||||
|
import os
|
||||||
|
|
||||||
|
# Cloudflare API Konfiguration
|
||||||
|
CLOUDFLARE_API_TOKEN = os.getenv("CLOUDFLARE_API_TOKEN")
|
||||||
|
CLOUDFLARE_ZONE_ID = os.getenv("CLOUDFLARE_ZONE_ID")
|
||||||
|
CLOUDFLARE_API_URL = f"https://api.cloudflare.com/client/v4/zones/{CLOUDFLARE_ZONE_ID}/dns_records"
|
||||||
|
|
||||||
|
HEADERS = {
|
||||||
|
"Authorization": f"Bearer {CLOUDFLARE_API_TOKEN}",
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
def load_domains(file_path="domains.yaml"):
|
||||||
|
with open(file_path, "r") as file:
|
||||||
|
return yaml.safe_load(file)
|
||||||
|
|
||||||
|
def is_reserved(domain, reserved_patterns):
|
||||||
|
return any(re.match(pattern, domain) for pattern in reserved_patterns)
|
||||||
|
|
||||||
|
def get_existing_records():
|
||||||
|
response = requests.get(CLOUDFLARE_API_URL, headers=HEADERS)
|
||||||
|
if response.status_code == 200:
|
||||||
|
return {rec["name"]: rec for rec in response.json().get("result", [])}
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def update_cloudflare():
|
||||||
|
data = load_domains()
|
||||||
|
reserved_patterns = data.get("reserved_domains", [])
|
||||||
|
subdomains = data.get("subdomains", [])
|
||||||
|
|
||||||
|
existing_records = get_existing_records()
|
||||||
|
|
||||||
|
for subdomain in subdomains:
|
||||||
|
full_domain = f"{subdomain['name']}.morlana.page"
|
||||||
|
|
||||||
|
if is_reserved(full_domain, reserved_patterns):
|
||||||
|
print(f"Skipping reserved domain: {full_domain}")
|
||||||
|
continue
|
||||||
|
|
||||||
|
record_data = {
|
||||||
|
"type": "CNAME",
|
||||||
|
"name": full_domain,
|
||||||
|
"content": subdomain["target"],
|
||||||
|
"proxied": subdomain.get("proxy", True)
|
||||||
|
}
|
||||||
|
|
||||||
|
if full_domain in existing_records:
|
||||||
|
record_id = existing_records[full_domain]["id"]
|
||||||
|
response = requests.put(f"{CLOUDFLARE_API_URL}/{record_id}", json=record_data, headers=HEADERS)
|
||||||
|
else:
|
||||||
|
response = requests.post(CLOUDFLARE_API_URL, json=record_data, headers=HEADERS)
|
||||||
|
|
||||||
|
if response.status_code in [200, 201]:
|
||||||
|
print(f"Successfully updated {full_domain}")
|
||||||
|
else:
|
||||||
|
print(f"Failed to update {full_domain}: {response.text}")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
update_cloudflare()
|
Reference in New Issue
Block a user