Skip to content

CLI#26

Open
catch-21 wants to merge 9 commits into
mainfrom
catch-21/cli
Open

CLI#26
catch-21 wants to merge 9 commits into
mainfrom
catch-21/cli

Conversation

@catch-21
Copy link
Copy Markdown
Collaborator

@catch-21 catch-21 commented May 20, 2026

For contributors and local development, pubky-docker.sh handles all git and docker commands for you to clone the service repositories, checks out the refs you choose, builds Pubky images from source, and starts the stack.

The script will:

  • Check that git, Docker, and Docker Compose are available.
  • Check that Git can read from GitHub before attempting clones.
  • Copy .env-sample to .env if .env does not already exist.
  • If .build-state has a complete record for the selected services, list those commits and offer to start the stack immediately or proceed to ref selection.
  • Ask for a commit, tag, or branch for each service. Press Enter to use the head of the repository's default branch.
  • Clone or update the service repositories next to this directory.
  • Build local Docker images only for services whose checked-out commit changed.
  • Start the stack with Docker Compose.

@catch-21 catch-21 marked this pull request as ready for review May 21, 2026 09:39
@catch-21 catch-21 marked this pull request as draft May 21, 2026 11:26
@catch-21 catch-21 marked this pull request as ready for review May 21, 2026 11:26
@catch-21
Copy link
Copy Markdown
Collaborator Author

To extend this, I would like for it to checkout the latest prod release in pubky-stack. For that we need to publish the refs and this cli can read them. A github page should do.

Comment thread pubky-docker-cli.sh
require_command git
require_command docker

if ! docker compose version >/dev/null 2>&1; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could use function require_command, but it should take two args, the first one is command itself(docker, git, docker compose) and the second is how to validate it(-v, version.
Also it's worth to mention, that sometimes docker compose could be a separate package and has it's own binary, like docker-compose.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe docker-compose to be deprecated

Comment thread pubky-docker-cli.sh
fi
}

check_github_access() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't sure we should use this checks, at some point we run git commands and they will fail if no access.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, it catches earlier. I could remove it and it will exit with error still.

Comment thread pubky-docker-cli.sh
profiles+=(--profile pubky-app)
fi

if [ "${#BUILD_SERVICES[@]}" -gt 0 ]; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't support public docker images, that we will have.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct, the intention of the cli is for convenience of local builds. I think the readme makes that clear.. we could support both but that is simply running up

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll reword the Readme. Once we have consistent up-to-date dockerhub images that can be the recommended use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants