Compare commits
15 Commits
pages
...
d7045e0bee
| Author | SHA1 | Date | |
|---|---|---|---|
| d7045e0bee | |||
| 061201835b | |||
| a3e7e9ce78 | |||
| dcef8fc691 | |||
| 02d2834636 | |||
| 95601c75c9 | |||
| 03a56ef1bb | |||
| b2650bb952 | |||
| 2ae6488249 | |||
| e0f579c12b | |||
| 123ff15b1c | |||
| ec0dc1bb4f | |||
| bf5ca6e8a1 | |||
| f4b04bd3f4 | |||
| eea447a2c5 |
@@ -5,6 +5,8 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: "cloudflare"
|
group: "cloudflare"
|
||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
@@ -13,14 +15,20 @@ jobs:
|
|||||||
update-dns:
|
update-dns:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up Python Virtual Environment
|
||||||
|
run: |
|
||||||
|
python3 -m venv venv
|
||||||
|
source venv/bin/activate
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: pip install pyyaml requests
|
run: |
|
||||||
|
source venv/bin/activate
|
||||||
|
pip install pyyaml requests
|
||||||
- name: Update Cloudflare DNS
|
- name: Update Cloudflare DNS
|
||||||
env:
|
env:
|
||||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
|
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
|
||||||
run: python update_cloudflare_dns.py
|
run: |
|
||||||
|
source venv/bin/activate
|
||||||
|
python ./update_cloudflare_dns.py
|
||||||
71
.gitea/workflows/02-jekyll-pages.yml
Normal file
71
.gitea/workflows/02-jekyll-pages.yml
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
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: Cleanup Pages Branch
|
||||||
|
run: |
|
||||||
|
cd pages
|
||||||
|
git config user.name "${{ gitea.actor }}"
|
||||||
|
git config user.email ""${{ gitea.actor }}"@noreply.git.morlana.online"
|
||||||
|
git rm --cached -r update_cloudflare_dns.py domains.yaml || true
|
||||||
|
git commit -m "Remove ignored files from Jekyll site"
|
||||||
|
cd ..
|
||||||
|
- 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: Prepare Jekyll Index
|
||||||
|
run: |
|
||||||
|
echo "---\nlayout: default\ntitle: Documentation\n---\n" > index.md
|
||||||
|
cat README.md >> index.md
|
||||||
|
- name: Build with Jekyll
|
||||||
|
run: |
|
||||||
|
source /etc/profile.d/rvm.sh
|
||||||
|
rvm use $RUBY_VERSION && ruby -v && gem -v
|
||||||
|
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
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
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
|
|
||||||
7
.jekyllignore
Normal file
7
.jekyllignore
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
update_cloudflare_dns.py
|
||||||
|
domains.yaml
|
||||||
|
LICENSE
|
||||||
|
README.md
|
||||||
|
Gemfile
|
||||||
|
Gemfile.lock
|
||||||
|
.gitea
|
||||||
55
README.md
55
README.md
@@ -1,2 +1,55 @@
|
|||||||
# morlana-pages
|
# Morlana Pages Free Subdomain Service
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
This repository provides a free subdomain service for the `morlana.page` domain, similar to `js.org`. Users can request a subdomain by forking this repository, adding their domain entry to `domains.yaml`, and submitting a pull request.
|
||||||
|
|
||||||
|
## How It Works
|
||||||
|
1. Fork this repository.
|
||||||
|
2. Add your subdomain entry to `domains.yaml`, ensuring it is in alphabetical order.
|
||||||
|
3. Submit a pull request.
|
||||||
|
4. Once the PR is approved and merged, an automated workflow updates the DNS records via the Cloudflare API.
|
||||||
|
|
||||||
|
## Subdomain Requirements
|
||||||
|
- Only **CNAME** records are allowed.
|
||||||
|
- The Cloudflare proxy is **enabled by default**, but can be disabled per subdomain.
|
||||||
|
- Reserved domains cannot be registered (e.g., `www.morlana.page`).
|
||||||
|
|
||||||
|
## How to Request a Subdomain
|
||||||
|
### 1. Edit `domains.yaml`
|
||||||
|
Add your subdomain under the `subdomains` section:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
subdomains:
|
||||||
|
- name: "your-subdomain"
|
||||||
|
target: "your-site.example.com"
|
||||||
|
proxy: true # Set to false if you want to disable the Cloudflare proxy
|
||||||
|
note: "Optional description"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Submit a Pull Request
|
||||||
|
- Ensure that your subdomain entry is in **alphabetical order**.
|
||||||
|
- Verify that your CNAME target is correct.
|
||||||
|
- Create a pull request with your changes.
|
||||||
|
|
||||||
|
## Reserved Domains
|
||||||
|
Some subdomains are **reserved** and cannot be registered. The list includes:
|
||||||
|
- `www.morlana.page`
|
||||||
|
- `api.morlana.page`
|
||||||
|
- `mail.morlana.page`
|
||||||
|
- Domains matching specific patterns (e.g., `admin.*`, `internal.*`).
|
||||||
|
|
||||||
|
## Automation
|
||||||
|
Once a pull request is merged, a GitHub Action will:
|
||||||
|
1. Validate the `domains.yaml` file.
|
||||||
|
2. Check for duplicate or reserved domains.
|
||||||
|
3. Update the Cloudflare DNS settings automatically.
|
||||||
|
|
||||||
|
## Setup for Maintainers
|
||||||
|
### Environment Variables
|
||||||
|
To enable Cloudflare DNS updates, set the following secrets in Gitea:
|
||||||
|
- `CLOUDFLARE_API_TOKEN`: API token with DNS write access.
|
||||||
|
- `CLOUDFLARE_ZONE_ID`: Cloudflare Zone ID for `morlana.page`.
|
||||||
|
|
||||||
|
## License
|
||||||
|
This project is open-source and licensed under the BSD-3-Clause.
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
title: Morlana - Pages
|
title: Morlana - Pages
|
||||||
description: >-
|
description: >-
|
||||||
Free Subdomains provided by Morlana
|
Free Subdomains provided by Morlana
|
||||||
|
|
||||||
baseurl: "/"
|
baseurl: "/"
|
||||||
url: "https://morlana.page"
|
url: "https://morlana.page"
|
||||||
|
|
||||||
show_downloads: false
|
show_downloads: false
|
||||||
|
|
||||||
remote_theme: pages-themes/midnight@v0.2.0
|
remote_theme: pages-themes/midnight@v0.2.0
|
||||||
plugins:
|
plugins:
|
||||||
- jekyll-remote-theme
|
- jekyll-remote-theme
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ reserved_domains:
|
|||||||
- "^internal\\..*"
|
- "^internal\\..*"
|
||||||
|
|
||||||
subdomains:
|
subdomains:
|
||||||
- name: sitiriotv
|
- name: www
|
||||||
target: justin.morlana.space
|
target: pages.morlana-pages.morlana.morlana.space
|
||||||
|
proxy: false
|
||||||
|
note: "Currently the cloudflare proxy service is not supported by Morlana Git Pages service"
|
||||||
# - name: "example"
|
# - name: "example"
|
||||||
# target: "example.com"
|
# target: "example.com"
|
||||||
# proxy: true
|
# proxy: true
|
||||||
|
|||||||
@@ -29,13 +29,22 @@ def get_existing_records():
|
|||||||
def update_cloudflare():
|
def update_cloudflare():
|
||||||
data = load_domains()
|
data = load_domains()
|
||||||
reserved_patterns = data.get("reserved_domains", [])
|
reserved_patterns = data.get("reserved_domains", [])
|
||||||
subdomains = data.get("subdomains", [])
|
subdomains = {f"{sub['name']}.morlana.page": sub for sub in data.get("subdomains", [])}
|
||||||
|
|
||||||
existing_records = get_existing_records()
|
existing_records = get_existing_records()
|
||||||
|
|
||||||
for subdomain in subdomains:
|
# Entferne Einträge, die nicht mehr in domains.yaml stehen
|
||||||
full_domain = f"{subdomain['name']}.morlana.page"
|
for existing_domain in existing_records:
|
||||||
|
if existing_domain.endswith(".morlana.page") and existing_domain not in subdomains:
|
||||||
|
record_id = existing_records[existing_domain]["id"]
|
||||||
|
response = requests.delete(f"{CLOUDFLARE_API_URL}/{record_id}", headers=HEADERS)
|
||||||
|
if response.status_code == 200:
|
||||||
|
print(f"Successfully removed {existing_domain}")
|
||||||
|
else:
|
||||||
|
print(f"Failed to remove {existing_domain}: {response.text}")
|
||||||
|
|
||||||
|
# Neue Einträge hinzufügen oder bestehende aktualisieren
|
||||||
|
for full_domain, subdomain in subdomains.items():
|
||||||
if is_reserved(full_domain, reserved_patterns):
|
if is_reserved(full_domain, reserved_patterns):
|
||||||
print(f"Skipping reserved domain: {full_domain}")
|
print(f"Skipping reserved domain: {full_domain}")
|
||||||
continue
|
continue
|
||||||
Reference in New Issue
Block a user