Skip to content

Commit

Permalink
Merge branch 'main' into i5okie/helm-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
i5okie authored Oct 18, 2024
2 parents 9d94177 + 255c387 commit 2e2adcf
Show file tree
Hide file tree
Showing 13 changed files with 1,549 additions and 931 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/on_pr_opened.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install OpenShift CLI tools
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: "4.14"

- name: Authenticate and set context
uses: redhat-actions/oc-login@v1
with:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/on_push_main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ jobs:
services
path: trust-over-ip-configurations

- name: Install OpenShift CLI tools
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: "4.14"

- name: Authenticate and set context
uses: redhat-actions/oc-login@v1
with:
Expand Down
12 changes: 6 additions & 6 deletions plugins/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.12-1.0.0 AS base
FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.12-1.0.1 AS base

# Install and Configure Poetry
USER root
Expand All @@ -24,16 +24,16 @@ RUN poetry install --only main
RUN ln -s $(poetry env info -p)/lib/python3.6/site-packages site-packages


FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.12-1.0.0
FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.12-1.0.1
COPY --from=base --chown=aries:aries /home/aries/.venv /home/aries/.venv
ENV PATH="/home/aries/.venv/bin:$PATH"

COPY --chown=aries:aries docker/default.yml ./
COPY --chown=aries:aries traction_innkeeper/traction_innkeeper traction_plugins/traction_innkeeper
RUN pip install git+https://github.com/hyperledger/[email protected].0#subdirectory=basicmessage_storage
RUN pip install git+https://github.com/hyperledger/[email protected].0#subdirectory=connection_update
RUN pip install git+https://github.com/hyperledger/[email protected].0#subdirectory=multitenant_provider
RUN pip install git+https://github.com/hyperledger/[email protected].0#subdirectory=rpc
RUN pip install git+https://github.com/hyperledger/[email protected].1#subdirectory=basicmessage_storage
RUN pip install git+https://github.com/hyperledger/[email protected].1#subdirectory=connection_update
RUN pip install git+https://github.com/hyperledger/[email protected].1#subdirectory=multitenant_provider
RUN pip install git+https://github.com/hyperledger/[email protected].1#subdirectory=rpc


ENTRYPOINT ["/bin/bash", "-c", "aca-py \"$@\"", "--"]
Expand Down
4 changes: 2 additions & 2 deletions plugins/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ readme = "README.md"

[tool.poetry.dependencies]
python = "^3.12"
aries-cloudagent = { version = "1.0.0" }
aries-cloudagent = { version = "1.0.1" }
python-dateutil = "^2.8.2"
typing-extensions = "4.8.0"
traction-innkeeper = {path = "./traction_innkeeper", develop = true}
Expand All @@ -22,7 +22,7 @@ ursa-bbs-signatures = { version = "~1.0.1" }
python3-indy = { version = "^1.11.1" }

[tool.poetry.dev-dependencies]
ruff = "^0.5.7"
ruff = "^0.6.9"

[build-system]
requires = ["setuptools", "poetry-core>=1.2"]
Expand Down
1,266 changes: 697 additions & 569 deletions plugins/traction_innkeeper/poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions plugins/traction_innkeeper/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ packages = [{include = "traction_innkeeper"}]

[tool.poetry.dependencies]
python = "^3.12"
aries-cloudagent = { version = "1.0.0" }
aries-cloudagent = { version = "1.0.1" }
python-dateutil = "^2.8.2"
bcrypt = "^4.2.0"
mergedeep = "^1.3.4"
typing-extensions = "4.8.0"
anoncreds = "^0.2.0"
multitenant-provider = {git = "https://github.com/hyperledger/aries-acapy-plugins", rev = "1.0.0", subdirectory = "multitenant_provider"}
multitenant-provider = {git = "https://github.com/hyperledger/aries-acapy-plugins", rev = "1.0.1", subdirectory = "multitenant_provider"}

[tool.poetry.dev-dependencies]
black = "^24.8.0"
black = "^24.10.0"
flake8 = "^7.1.1"

[build-system]
Expand Down
5 changes: 2 additions & 3 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,11 @@ CountryMac:scripts jason$ docker-compose version
### start

1. copy `.env-example` to `.env` and adjust as necessary for your environment
2. bring up traction
2. Run the ./manage script in a bash-compatible shell to start Traction.

```sh
cp .env-example .env
docker compose build
docker compose up
./manage
```

**Note:** to use your `ngrok` auth token and prevent the tunnels from expiring, add the value in the `.env` file after uncommenting the line defining `NGROK_AUTHTOKEN` and then start the project with `docker compose up`.
Expand Down
4 changes: 2 additions & 2 deletions scripts/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ services:
- host.docker.internal:host-gateway

endorser-agent:
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.12-1.0.0
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.12-1.0.1
depends_on:
endorser-db:
condition: service_healthy
Expand Down Expand Up @@ -205,7 +205,7 @@ services:
- host.docker.internal:host-gateway

endorser-agent-1:
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.12-1.0.0
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.12-1.0.1
depends_on:
endorser-db:
condition: service_healthy
Expand Down
181 changes: 181 additions & 0 deletions scripts/manage
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
#!/bin/bash

# Function to generate Traction ASCII Art
generate_traction_ascii_art() {
echo " _______ _ _ "
echo " |__ __| | | (_) "
echo " | |_ __ __ _ ___| |_ _ ___ _ __ "
echo " | | '__/ _\` |/ __| __| |/ _ \| '_ \ "
echo " | | | | (_| | (__| |_| | (_) | | | |"
echo " |_|_| \__,_|\___|\__|_|\___/|_| |_|"
echo " "
echo " "
echo "--------------------------------------------"
echo " Traction Management Script"
echo "--------------------------------------------"
echo " Select an Action you want to perform:"
echo " 1) Build"
echo " 2) Start"
echo " 3) Stop"
echo " 4) Restart"
echo " 5) Down (Stop and remove containers)"
echo " 6) Exit"
}

# Global variable to hold Docker Compose command
compose_cmd=""

# Function to determine the correct Docker Compose command
get_docker_compose_command() {
if command -v "docker" > /dev/null && docker compose version > /dev/null 2>&1; then
compose_cmd="docker compose"
elif command -v docker-compose > /dev/null 2>&1; then
compose_cmd="docker-compose"
else
echo "Error: Neither 'docker compose' nor 'docker-compose' is installed." >&2
exit 1
fi
}

# Function to build Docker images
build_docker_images() {
echo "Building Docker images..."
if [ -d "../plugins/docker" ]; then
pushd ../plugins/docker > /dev/null
docker build -f ./Dockerfile --tag traction:plugins-acapy .. --no-cache
popd > /dev/null
else
echo "Error: Directory '../plugins/docker' does not exist. Check the path."
exit 1
fi

if [ -d "../services/aca-py" ]; then
pushd ../services/aca-py > /dev/null
if [ -f "./Dockerfile.acapy" ]; then
docker build -f ./Dockerfile.acapy --tag traction:traction-agent . --no-cache
else
echo "Error: File 'Dockerfile.acapy' not found in '../services/aca-py'."
popd > /dev/null
exit 1
fi
popd > /dev/null
else
echo "Error: Directory '../services/aca-py' does not exist. Please verify the path."
exit 1
fi

built_services="traction-acapy-image-builder tenant-ui tenant-proxy endorser-api endorser-api-1"
pulled_services="ngrok-traction-agent traction-db endorser-db endorser-db-1 maildev endorser-agent endorser-agent-1"
$compose_cmd build $built_services --no-cache --parallel
$compose_cmd pull $pulled_services
}

# Function to start Docker containers
start_docker_containers() {
echo "Starting Docker containers..."
$compose_cmd up -d
}

# Function to stop Docker containers
stop_docker_containers() {
echo "Stopping Docker containers..."
$compose_cmd stop
}

# Function to restart Docker containers
restart_docker_containers() {
echo "Restarting Docker containers..."
stop_docker_containers
start_docker_containers
}

# Function to stop and remove Docker containers
down_docker_containers() {
echo "Stopping and removing Docker containers..."
$compose_cmd down
}

# Check for Mac OS and set platform options if applicable
set_mac_os_options() {
if [[ $OSTYPE == 'darwin'* ]]; then
echo "Setting Mac OS specific options..."

architecture=$(uname -m)
if [[ "${architecture}" == 'arm'* ]] || [[ "${architecture}" == 'aarch'* ]]; then
export DOCKER_DEFAULT_PLATFORM=linux/amd64
fi

export TA_RATIFICATION_TIME_OPS='-jf %Y-%m-%dT%H:%M:%S%Z +%s'
export STAT_OPS='-f %A'
fi
}

# Display menu
show_menu() {
generate_traction_ascii_art
}

# Main function to control script flow based on user input
main() {
set_mac_os_options
get_docker_compose_command

if [ "$#" -eq 0 ]; then
# No command-line arguments provided, show the menu
while true; do
show_menu
read -p "Action [1-6]: " action
case "$action" in
1)
build_docker_images
;;
2)
start_docker_containers
;;
3)
stop_docker_containers
;;
4)
restart_docker_containers
;;
5)
down_docker_containers
;;
6)
echo "Exiting..."
exit 0
;;
*)
echo "Invalid option, please select a number between 1 and 6."
;;
esac
done
else
# Command-line argument is provided, execute corresponding function
case "$1" in
build)
build_docker_images
;;
start)
start_docker_containers
;;
stop)
stop_docker_containers
;;
restart)
restart_docker_containers
;;
down)
down_docker_containers
;;
*)
echo "Unknown command: $1"
echo "Usage: $0 {build|start|stop|restart|down}"
exit 1
;;
esac
fi
}

# Execute the main function
main "$@"
Loading

0 comments on commit 2e2adcf

Please sign in to comment.