initial
This commit is contained in:
parent
3ae69a109f
commit
86bb5cc8f8
10 changed files with 310 additions and 1 deletions
83
README.md
83
README.md
|
@ -1,3 +1,86 @@
|
|||
# federate-your-repos
|
||||
|
||||
Support mirroring your federated repositories to common plattforms in order to get found.
|
||||
|
||||
## Rational
|
||||
|
||||
It is always the same - it's about regaining digital sovereignty.
|
||||
|
||||
With OpenSource, the story is absolutely comparable to the situation on Twitter, Facebook or Youtube. You have invested countless hours to realize your idea and building a community. The big platforms profit from this.
|
||||
|
||||
We advocate that the fruits of our investment end up with us and not with Microsoft, Facbook, Twitter or Gitlab.
|
||||
|
||||
So we will not longer propagate Links to Github, Gitlab or any other foreign platform. In al fully federated world that will be the idea.
|
||||
|
||||
But in the time beeing we will not livbe in this perfect world. So we present our model to handle this intermediate time. There are some principles:
|
||||
|
||||
1. Any marketing invest (links in blogs, mblogs, toots, ...) will link to our own repository.
|
||||
2. In order to enable interaction with our community we accept issues & PR on the most relevant and the least unappealing platform.
|
||||
3. We interact primarily with the platform our CI is running on.
|
||||
4. We mirror our repository to the remaining bunch of platforms in order to get found if someone is searching for our OpenSource solution.
|
||||
5. Every repository has an section where we accept Issues & PRs and where mirrors exist.
|
||||
|
||||
## Realisation
|
||||
|
||||
# Mirroring
|
||||
|
||||
At the moment our CI is running on gitlab, so thats our current model
|
||||
|
||||
```mermaid
|
||||
C4Context
|
||||
Person(community, "Community")
|
||||
Person(maint, "Maintainer")
|
||||
|
||||
System_Boundary(gitlab, "GitLab") {
|
||||
System(gitlab-repo, "GitLab")
|
||||
System(gitlab-ci, "GitLab-CI")
|
||||
}
|
||||
System_Boundary(codeberg, "Codeberg") {
|
||||
System(cb-repo, "Codeberg")
|
||||
}
|
||||
System_Boundary(gitea, "repo.prod.meissa.de") {
|
||||
System(gitea-repo, "repo")
|
||||
}
|
||||
System_Boundary(github, "github") {
|
||||
System(github-repo, "GitHub")
|
||||
}
|
||||
|
||||
Rel(maint, gitlab-repo, "interact")
|
||||
Rel(community, gitlab-repo, "interact")
|
||||
|
||||
Rel(gitlab-repo, gitea-repo, "mirror on pull")
|
||||
Rel(gitea-repo, github-repo, "mirror on push")
|
||||
Rel(gitea-repo, cb-repo, "mirror on push")
|
||||
|
||||
UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="2")
|
||||
```
|
||||
|
||||
## Artefacts & CI
|
||||
|
||||
```mermaid
|
||||
C4Context
|
||||
System_Boundary(gitlab, "GitLab") {
|
||||
System(gitlab-repo, "GitLab")
|
||||
System(gitlab-ci, "GitLab-CI")
|
||||
}
|
||||
System_Boundary(gitea, "repo.prod.meissa.de") {
|
||||
System(gitea-repo, "repo")
|
||||
System(gitea-release-pages, "release pages")
|
||||
System(gitea-artifacts, "artifacts")
|
||||
}
|
||||
System_Boundary(art, "Artifact Repositories") {
|
||||
System(pypi, "Pypi")
|
||||
System(docker, "Docker Hub")
|
||||
System(npm, "Npm")
|
||||
System(clojars, "Clojars")
|
||||
}
|
||||
|
||||
Rel(gitlab-ci, gitea-release-pages, "create release & upload changelog")
|
||||
Rel(gitlab-ci, gitea-artifacts, "artifact upload")
|
||||
Rel(gitlab-ci, clojars, "artifact upload")
|
||||
Rel(gitlab-ci, pypi, "artifact upload")
|
||||
Rel(gitlab-ci, npm, "artifact upload")
|
||||
Rel(gitlab-ci, docker, "artifact upload")
|
||||
|
||||
UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="2")
|
||||
```
|
11
doc/MirroringSection.md
Normal file
11
doc/MirroringSection.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
## Development & mirrors
|
||||
|
||||
Development happens at: https://repo.prod.meissa.de/meissa/dda-python-terraform
|
||||
|
||||
Mirrors are:
|
||||
|
||||
https://gitlab.com/domaindrivenarchitecture/dda-python-terraform (issues and PR, CI)
|
||||
https://codeberg.org/meissa/dda-python-terraform
|
||||
https://github.com/DomainDrivenArchitecture/dda-python-terraform
|
||||
|
||||
For more details about our repository model see: https://repo.prod.meissa.de/meissa/federate-your-repos
|
66
src/terraform/build.py
Normal file
66
src/terraform/build.py
Normal file
|
@ -0,0 +1,66 @@
|
|||
from os import environ
|
||||
from pybuilder.core import task, init
|
||||
from ddadevops import *
|
||||
from subprocess import run
|
||||
|
||||
name = 'meissa'
|
||||
MODULE = 'repos'
|
||||
PROJECT_ROOT_PATH = '../../..'
|
||||
|
||||
|
||||
class MyBuild(DigitaloceanBackendPropertiesMixin):
|
||||
pass
|
||||
|
||||
|
||||
@init
|
||||
def initialize(project):
|
||||
project.build_depends_on('ddadevops>=3.0.2')
|
||||
stage = environ['STAGE']
|
||||
do_api_key = gopass_password_from_path(
|
||||
environ.get('DIGITALOCEAN_TOKEN_KEY_PATH', None))
|
||||
do_s3_id = gopass_field_from_path('server/devops/digitalocean/s3', 'id')
|
||||
do_s3_secret = gopass_field_from_path(
|
||||
'server/devops/digitalocean/s3', 'secret')
|
||||
repo_meissa_token_ro = gopass_password_from_path('server/meissa/repo/buero-ro')
|
||||
codeberg_gitea_token = gopass_password_from_path('server/meissa/codeberg')
|
||||
github_token = gopass_password_from_path('server/meissa/github')
|
||||
gitlab_token = gopass_password_from_path('server/meissa/gitlab')
|
||||
|
||||
config = create_digitalocean_terraform_build_config(stage,
|
||||
PROJECT_ROOT_PATH,
|
||||
MODULE,
|
||||
{'repo_meissa_token_ro': repo_meissa_token_ro,
|
||||
'codeberg_gitea_token': codeberg_gitea_token,
|
||||
'github_token': github_token,
|
||||
'gitlab_token': gitlab_token},
|
||||
do_api_key,
|
||||
do_s3_id,
|
||||
do_s3_secret,
|
||||
use_workspace=False,
|
||||
terraform_semantic_version="1.0.8")
|
||||
config = add_digitalocean_backend_properties_mixin_config(config,
|
||||
stage,
|
||||
'fra1.digitaloceanspaces.com',
|
||||
'meissa-configuration-2',
|
||||
MODULE)
|
||||
build = MyBuild(project, config)
|
||||
build.initialize_build_dir()
|
||||
run('cp -r mirror ' + build.build_path(), shell=True, check=False)
|
||||
|
||||
|
||||
@task
|
||||
def plan(project):
|
||||
build = get_devops_build(project)
|
||||
build.plan()
|
||||
|
||||
|
||||
@task
|
||||
def apply(project):
|
||||
build = get_devops_build(project)
|
||||
build.apply(True)
|
||||
|
||||
|
||||
@task
|
||||
def destroy(project):
|
||||
build = get_devops_build(project)
|
||||
build.destroy(True)
|
21
src/terraform/mirror/codeberg.tf
Normal file
21
src/terraform/mirror/codeberg.tf
Normal file
|
@ -0,0 +1,21 @@
|
|||
data "gitea_org" "dda" {
|
||||
name = "DomainDrivenArchitecture"
|
||||
}
|
||||
|
||||
resource "gitea_repository" "repo" {
|
||||
username = data.gitea_org.dda.name
|
||||
name = local.name_with_stage
|
||||
private = false
|
||||
auto_init = false
|
||||
license = var.license
|
||||
has_issues = true
|
||||
has_projects = false
|
||||
has_pull_requests = true
|
||||
migration_issue_labels = false
|
||||
migration_milestones = false
|
||||
migration_releases = false
|
||||
mirror = true
|
||||
migration_clone_address = "https://repo.prod.meissa.de/meissa/c4k-gitea.git"
|
||||
migration_service = "gitea"
|
||||
migration_service_auth_token = var.repo_meissa_token_ro
|
||||
}
|
17
src/terraform/mirror/github.tf
Normal file
17
src/terraform/mirror/github.tf
Normal file
|
@ -0,0 +1,17 @@
|
|||
data "github_organization" "dda" {
|
||||
name = "DomainDrivenArchitecture"
|
||||
}
|
||||
|
||||
resource "github_repository" "repo" {
|
||||
name = local.name_with_stage
|
||||
|
||||
visibility = "public"
|
||||
auto_init = false
|
||||
has_issues = false
|
||||
has_projects = false
|
||||
has_downloads = false
|
||||
has_wiki = false
|
||||
has_discussions = false
|
||||
archive_on_destroy = false
|
||||
}
|
||||
|
29
src/terraform/mirror/gitlab.tf
Normal file
29
src/terraform/mirror/gitlab.tf
Normal file
|
@ -0,0 +1,29 @@
|
|||
data "gitlab_group" "dda" {
|
||||
full_path = "DomainDrivenArchitecture"
|
||||
}
|
||||
|
||||
resource "gitlab_project" "repo" {
|
||||
name = local.name_with_stage
|
||||
|
||||
visibility_level = "public"
|
||||
initialize_with_readme = false
|
||||
issues_enabled = false
|
||||
wiki_enabled = false
|
||||
auto_devops_enabled = false
|
||||
packages_enabled = false
|
||||
request_access_enabled = false
|
||||
snippets_enabled = false
|
||||
#mirror = true
|
||||
container_expiration_policy {
|
||||
enabled = false
|
||||
}
|
||||
push_rules {
|
||||
deny_delete_tag = true
|
||||
}
|
||||
}
|
||||
/*
|
||||
resource "gitlab_project_mirror" "mirror_gitea" {
|
||||
project = "3"
|
||||
url = "https://repo.prod.meissa.de/api/v1/repositories/3?token=${var.gitea_api_token}"
|
||||
}
|
||||
*/
|
18
src/terraform/mirror/provider.tf
Normal file
18
src/terraform/mirror/provider.tf
Normal file
|
@ -0,0 +1,18 @@
|
|||
variable "codeberg_gitea_token" {}
|
||||
variable "github_token" {}
|
||||
variable "gitlab_token" {}
|
||||
|
||||
provider "gitea" {
|
||||
base_url = "https://codeberg.org"
|
||||
token = var.codeberg_gitea_token
|
||||
insecure = false
|
||||
}
|
||||
|
||||
provider "github" {
|
||||
token = var.github_token
|
||||
owner = "DomainDrivenArchitecture"
|
||||
}
|
||||
|
||||
provider "gitlab" {
|
||||
token = var.gitlab_token
|
||||
}
|
16
src/terraform/mirror/provider_registry.tf
Normal file
16
src/terraform/mirror/provider_registry.tf
Normal file
|
@ -0,0 +1,16 @@
|
|||
terraform {
|
||||
required_providers {
|
||||
gitea = {
|
||||
source = "Lerentis/gitea"
|
||||
version = "0.12.2"
|
||||
}
|
||||
github = {
|
||||
source = "integrations/github"
|
||||
version = "~> 5.17"
|
||||
}
|
||||
gitlab = {
|
||||
source = "gitlabhq/gitlab"
|
||||
version = "15.8.0"
|
||||
}
|
||||
}
|
||||
}
|
11
src/terraform/mirror/variables.tf
Normal file
11
src/terraform/mirror/variables.tf
Normal file
|
@ -0,0 +1,11 @@
|
|||
variable "stage" {}
|
||||
|
||||
variable "name" {}
|
||||
|
||||
variable "license" {}
|
||||
|
||||
variable "repo_meissa_token_ro" {}
|
||||
|
||||
locals {
|
||||
name_with_stage = var.stage == "prod" ? var.name : "test-${var.name}"
|
||||
}
|
37
src/terraform/mirrors.tf
Normal file
37
src/terraform/mirrors.tf
Normal file
|
@ -0,0 +1,37 @@
|
|||
variable "codeberg_gitea_token" {}
|
||||
variable "github_token" {}
|
||||
variable "gitlab_token" {}
|
||||
variable "repo_meissa_token_ro" {}
|
||||
|
||||
module "dda-python-terraform" {
|
||||
source = "./mirror"
|
||||
stage = var.stage
|
||||
codeberg_gitea_token = var.codeberg_gitea_token
|
||||
github_token = var.github_token
|
||||
gitlab_token = var.gitlab_token
|
||||
repo_meissa_token_ro = var.repo_meissa_token_ro
|
||||
name = "dda-python-terraform"
|
||||
license = "Mit"
|
||||
}
|
||||
|
||||
module "dda-devops-build" {
|
||||
source = "./mirror"
|
||||
stage = var.stage
|
||||
codeberg_gitea_token = var.codeberg_gitea_token
|
||||
github_token = var.github_token
|
||||
gitlab_token = var.gitlab_token
|
||||
repo_meissa_token_ro = var.repo_meissa_token_ro
|
||||
name = "dda-devops-build"
|
||||
license = "Mit"
|
||||
}
|
||||
|
||||
module "c4k-forgejo" {
|
||||
source = "./mirror"
|
||||
stage = var.stage
|
||||
codeberg_gitea_token = var.codeberg_gitea_token
|
||||
github_token = var.github_token
|
||||
gitlab_token = var.gitlab_token
|
||||
repo_meissa_token_ro = var.repo_meissa_token_ro
|
||||
name = "dda-devops-build"
|
||||
license = "Mit"
|
||||
}
|
Loading…
Reference in a new issue