Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 35 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
ROOT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
PKG_NAME := pulp_manager

.PHONY : check-devcontainer
check-devcontainer:
@if [ -z "$$Is_local" ] && [ -z "$$DEVCONTAINER" ]; then \
echo "ERROR: Tests must be run in devcontainer environment!"; \
echo ""; \
echo "To run tests:"; \
echo " 1. Open VS Code"; \
echo " 2. Use Command Palette (Cmd/Ctrl+Shift+P)"; \
echo " 3. Select 'Dev Containers: Reopen in Container'"; \
echo " 4. Wait for container to build"; \
echo " 5. Run: make t"; \
echo ""; \
exit 1; \
fi

.PHONY : h help
h help:
@printf "%s\n" "Usage: make <target>"
Expand All @@ -13,30 +28,18 @@ h help:
"l|lint" "Run lint" \
"c|cover" "Run coverage for all tests" \
"venv" "Create virtualenv" \
"ansible" "Install ansible in venv" \
"clean" "Clean workspace" \
"run-pulp-manager" "Run Pulp Manager services for development" \
"run-pulp3" "Run Pulp 3 primary and secondary servers" \
"demo" "Run complete demo environment"
"demo" "Run complete demo environment" \
"demo-repo-sync" "Upload package and run sync tasks in demo env"

.PHONY : l lint
l lint: venv
@echo "# pylint"; \
./venv/bin/pylint --rcfile ./pylint.rc pulp_manager/

check-devcontainer:
@if [ -z "$$Is_local" ] && [ -z "$$DEVCONTAINER" ]; then \
echo "ERROR: Tests must be run in devcontainer environment!"; \
echo ""; \
echo "To run tests:"; \
echo " 1. Open VS Code"; \
echo " 2. Use Command Palette (Cmd/Ctrl+Shift+P)"; \
echo " 3. Select 'Dev Containers: Reopen in Container'"; \
echo " 4. Wait for container to build"; \
echo " 5. Run: make t"; \
echo ""; \
exit 1; \
fi

.PHONY : t test
t test: venv check-devcontainer
@./venv/bin/pytest -v
Expand All @@ -49,11 +52,16 @@ c cover: venv check-devcontainer
coverage html

.PHONY : venv
venv: requirements.txt
venv:
@python3 -m venv venv
@. venv/bin/activate; \
pip install --upgrade pip; \
pip install -r requirements.txt
pip install --upgrade pip -q; \
pip install -r requirements.txt -q;

.PHONY : ansible
ansible: venv
@. venv/bin/activate && \
pip install -q ansible 'pulp-glue>=0.29.0' 'pulp-glue-deb>=0.3.0,<0.4'

.PHONY : run-pulp-manager
run-pulp-manager:
Expand All @@ -77,9 +85,14 @@ run-pulp3:
@echo "Secondary: http://localhost:8001"

.PHONY : demo
demo: venv
demo: venv ansible
@echo "Setting up demo environment..."
@. venv/bin/activate && \
pip install -q ansible 'pulp-glue>=0.29.0' 'pulp-glue-deb>=0.3.0,<0.4' && \
ansible-galaxy collection install pulp.squeezer 2>&1 | grep -v 'Installing' && \
ansible-playbook -i localhost, demo/ansible/playbook.yml
ansible-playbook -i localhost demo/ansible/playbook.yml

.PHONY : demo-repo-sync
demo-repo-sync: venv ansible
@echo "Setting up demo environment..."
@. venv/bin/activate && \
ansible-playbook -i localhost demo/ansible/setup_repos.yml

59 changes: 58 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,61 @@ components:
```bash
make demo
```

When startup is finished, `docker ps` will show you the components, and all APIs will be listening.

### Demo Environment Details

Once the demo is running, you'll have access to:

**Available repositories on primary (http://localhost:8000):**
- `int-demo-packages`: http://localhost:8000/pulp/content/int-demo-packages/ (internal, no remote)
- `ext-demo-packages`: http://localhost:8000/pulp/content/ext-demo-packages/ (syncs from nginx.org)

**Available repositories on secondary (http://localhost:8001):**
- `int-demo-packages`: http://localhost:8001/pulp/content/int-demo-packages/ (syncs from primary)
- `ext-demo-packages`: http://localhost:8001/pulp/content/ext-demo-packages/ (syncs from primary)

**Services:**
- Pulp Manager API: http://localhost:8080
- RQ Dashboard: http://localhost:9181

### Demo Usage Examples

**Upload a package to int-demo-packages on primary:**
```bash
# Upload content
docker cp /path/to/package.deb demo-pulp-primary-1:/tmp/package.deb
docker exec demo-pulp-primary-1 pulp deb content upload --file /tmp/package.deb --repository int-demo-packages

# Create publication
docker exec demo-pulp-primary-1 pulp deb publication create --repository int-demo-packages --simple

# Update distribution (get publication href from above command)
docker exec demo-pulp-primary-1 pulp deb distribution update --name int-demo-packages --publication <publication_href>
```

**Sync ext-demo-packages on primary from nginx.org:**
```bash
curl -X POST 'http://localhost:8080/v1/pulp_servers/1/sync_repos' \
-H 'Content-Type: application/json' \
-d '{"max_runtime": "3600", "max_concurrent_syncs": 2, "regex_include": "^ext-demo"}'
```

**Sync int-demo-packages from primary to secondary:**
```bash
curl -X POST 'http://localhost:8080/v1/pulp_servers/2/sync_repos' \
-H 'Content-Type: application/json' \
-d '{"max_runtime": "3600", "max_concurrent_syncs": 2, "regex_include": "^int-demo", "source_pulp_server_name": "pulp-primary:80"}'
```

**Sync ext-demo-packages from primary to secondary:**
```bash
curl -X POST 'http://localhost:8080/v1/pulp_servers/2/sync_repos' \
-H 'Content-Type: application/json' \
-d '{"max_runtime": "3600", "max_concurrent_syncs": 2, "regex_include": "^ext-demo", "source_pulp_server_name": "pulp-primary:80"}'
```

For detailed development setup, see the [Development
Info](#development-info) section.

Expand Down Expand Up @@ -182,6 +234,8 @@ banned_package_regex=bannedexample|another
internal_domains=example.com
git_repo_config=https://git.example.com/Pulp-Repo-Config
git_repo_config_dir=repo_config
# Optional: Use local filesystem instead of git for repo configs (e.g., demo/dev)
# local_repo_config_dir=/path/to/local/repo-config
password=password
internal_repo_prefix=corp-
external_repo_prefix=ext-
Expand Down Expand Up @@ -249,6 +303,9 @@ Settings to apply to all pulp servers
servers
- `git_repo_config_dir`: Directory in `git_repo_config` which contains
the pulp repo config
- `local_repo_config_dir`: Optional local filesystem path to repo config
directory. If set, scheduled repo registration will read configs from
this path instead of cloning from `git_repo_config`.
- `internal_repo_prefix`: Prefix applied to a repo name when
uploaded directly to Pulp primary (no remote URL). Leave blank or
omit to retain original name.
Expand Down
Loading