Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prs/update makefile #73

Merged
merged 11 commits into from
Oct 23, 2024
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
unset SSH_AUTH_SOCK
53 changes: 29 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ help: ## Display this help message
@echo -e '\n${COLOUR_RED}Usage: make <command>${COLOUR_END}'
@cat $(MAKEFILE_LIST) | grep '^[a-zA-Z]' | \
awk -F ':.*?## ' 'NF==2 {printf " %-26s%s\n\n", $$1, "${COLOUR_GREEN}"$$2"${COLOUR_END}"}'
@echo -e '${COLOUR_RED}OSISM helperscript usage: make <command>${COLOUR_END}'
@echo -e '${COLOUR_RED}Container related commands${COLOUR_END}'
@cat $(MAKEFILE_LIST) | grep '^[a-zA-Z]' | \
awk -F ':.*?#container# ' 'NF==2 {printf " %-26s%s\n\n", $$1, "${COLOUR_GREEN}"$$2"${COLOUR_END}"}'
@echo -e '${COLOUR_RED}OSISM helperscripts${COLOUR_END}'
@cat $(MAKEFILE_LIST) | grep '^[a-zA-Z]' | \
awk -F ':.*?#osism# ' 'NF==2 {printf " %-26s%s\n\n", $$1, "${COLOUR_GREEN}"$$2"${COLOUR_END}"}'

Expand Down Expand Up @@ -66,53 +69,55 @@ check-radoslib: ## Checks if radoslib is installed and if it contains the right
./scripts/check_local_rados_lib_installation.sh ${RADOSLIB_VERSION}

.PHONY: build-local-rookify
build-local-rookify: ## This builds rookify into .venv/bin/rookify
build-local-rookify: setup ## This builds rookify into .venv/bin/rookify
source .venv/bin/activate && pip install -e .

.PHONY: build-container
build-container: ## Build container from Dockerfile, add e.g. ROOKIFY_VERSION=0.0.1 to specify the version. Default value is 0.0.0.dev1
${CONTAINERCMD} build --build-arg ROOKIFY_VERSION=$(ROOKIFY_VERSION) --target rookify -t rookify:latest -f Dockerfile .

.PHONY: run-local-rookify
run-local-rookify: ## Runs rookify in the local development environment (requires setup-venv)
source ./.venv/bin/activate && pip install -e . && rookify

.PHONY: run-rookify
run-rookify: ## Runs rookify in the container
docker exec -it rookify-dev /app/rookify/.venv/bin/rookify

.PHONY: get-testbed-configs-for-rookify-testing
get-testbed-configs-for-rookify-testing: ## Gets the needed config (like .kube, /etc/ceph and so on) from the testbed
bash ./scripts/get_configs_from_testbed.sh
run-local-rookify: build-local-rookify ## Runs rookify in the local development environment (requires setup-venv)
./.venv/bin/rookify

.PHONY: run-tests-locally
run-tests-locally: ## Runs the tests in the tests directory. NB: check that your local setup is connected through vpn to the testbed!
run-tests-locally: setup-venv ## Runs the tests in the tests directory. NB: check that your local setup is connected through vpn to the testbed!
.venv/bin/python -m pytest

##
# Add container related commands here (so they appear below the container header)
# Note: use #container# so command appear under header in menu
##

.PHONY: run-tests
run-tests: up ## Runs the tests in the container
run-tests: up #container# Runs the tests in the container
${CONTAINERCMD} exec -it rookify-dev bash -c "/app/rookify/.venv/bin/python -m pytest"

.PHONY: run-rookify
run-rookify: up #container# Runs rookify in the container
${CONTAINERCMD} exec -it rookify-dev /app/rookify/.venv/bin/rookify

.PHONY: enter
enter: ## Enter the container
enter: up #container# Enter the container
${CONTAINERCMD} exec -it rookify-dev bash

.PHONY: logs
logs: ## Logs the container
logs: #container# Logs the container
${CONTAINERCMD} logs -f rookify-dev

.PHONY: down
down: ## Remove the containers as setup by docker-compose.yml
down: #container# Remove the containers as setup by docker-compose.yml
${CONTAINERCMD} compose down

.PHONY: up
up: ## Sets up the container as specified in docker-compose.yml and opens a bash terminal
up: #container# Sets up the container as specified in docker-compose.yml and opens a bash terminal
${CONTAINERCMD} compose up -d

.PHONY: build-container
build-container: #container# Build container from Dockerfile only, add e.g. ROOKIFY_VERSION=0.0.1 to specify the version. Default value is 0.0.0.dev1
${CONTAINERCMD} build --build-arg ROOKIFY_VERSION=$(ROOKIFY_VERSION) --target rookify -t rookify:latest -f Dockerfile .

##
# Add osism specific scripts below here (so they appear below helper header)
# Add osism specific scripts below here
# Note: use #osism# so command appear under header in menu
##

.PHONY: get-config
get-config: #osism# Gets configuration files from the OSISM testbed
./scripts/osism/get_osism_configs_from_testbed.sh
./scripts/osism/get_configs_from_testbed.sh
6 changes: 6 additions & 0 deletions README.md
NotTheEvilOne marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ __TODO__

Type `make` to get a list of available development specific commands.

## Troubleshooting

### OSISM Testbed

- ssh-issues: make sure the id-rsa keys are "clean" and do not contain unexpected strings like "\<\<EOF"

## Support
For issues, questions, or contributions, please open an issue or pull request in the GitHub repository. We welcome community feedback and contributions to enhance rookify.

Expand Down
28 changes: 28 additions & 0 deletions scripts/osism/get_configs_from_testbed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Helperscript: Gets configs from testbed
#
# NOTE: this is for test purposes and specific for the OISISM testbed
# it requires .ssh/config to be set accordingly, e.g.:
#
# Host testbed-*
# StrictHostKeyChecking no
# IdentityFile <id_rsa of testbed>
# IdentitiesOnly yes
# user dragon
#
# Host testbed-manager
# Hostname <ip of manager of testbed>
#
# Host testbed-node-0
# Hostname 192.168.16.10
#
# Host testbed-node-1
# Hostname 192.168.16.11
# Host testbed-node-2
# Hostname 192.168.16.12
#

# copy .kube to ./.k8s
scp -r testbed-manager:.kube ./.k8s

# copy /etc/ceph/ from node1 to ./.k8s
ssh testbed-manager "docker cp cephclient:/etc/ceph /tmp/cephclientconfig" && scp -r testbed-manager:/tmp/cephclientconfig ./.ceph && ssh testbed-manager "rm -rf /tmp/cephclientconfig"
Loading