Skip to content

Instantly share code, notes, and snippets.

@orhun
Last active May 10, 2024 06:20
Show Gist options
  • Save orhun/eb8488d6658029ecdf843089bde0f29e to your computer and use it in GitHub Desktop.
Save orhun/eb8488d6658029ecdf843089bde0f29e to your computer and use it in GitHub Desktop.
Set up `softserve` to mirror repositories from GitHub
version: "3.6"
services:
soft-serve:
image: charmcli/soft-serve:latest
container_name: soft-serve
restart: unless-stopped
ports:
- 23231:23231
- 23232:23232
- 23233:23233
- 9418:9418
volumes:
- ./data:/soft-serve
env_file:
- ./.env # SOFT_SERVE_INITIAL_ADMIN_KEYS="ssh-ed25519 AA..."
#!/usr/bin/env bash
# Define a `soft` entry in ~/.ssh/config as follows:
#
# ```
# Host soft
# HostName localhost
# Port 23231
# IdentityFile ~/.ssh/id_ed25519
# ```
repos=(
"https://github.com/orhun/dotfiles"
"https://github.com/orhun/daktilo"
)
# github_token=""
for repo in "${repos[@]}"; do
response=$(
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${github_token}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${repo#https://github.com/}"
)
name=$(jq .name <<<"${response}")
description=$(jq .description <<<"${response}")
ssh soft repo import --mirror "${name}" --description "${description}" "${repo}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment