Skip to content

Commit c9aa626

Browse files
CopilotBYKaldy505
authored
Add dcx shortcut for docker compose exec with HTTP proxy env vars (#4067)
* Initial plan * Add dcep shortcut for docker compose exec with http proxy Co-authored-by: BYK <[email protected]> * Quote environment variable values in dcep shortcut Co-authored-by: BYK <[email protected]> * Rename dcep to dcx (docker compose exec shortcut) Co-authored-by: BYK <[email protected]> * Move dcx after if/else block and use exec_proxy_args for DRY Co-authored-by: BYK <[email protected]> * Remove exec_proxy_args and inline proxy flags in dcx Co-authored-by: BYK <[email protected]> * Add exec_proxy_args variable and use it in dcx definition Co-authored-by: BYK <[email protected]> * Use $dcx shortcut in bootstrap-s3-profiles.sh Co-authored-by: aldy505 <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: BYK <[email protected]> Co-authored-by: Reinaldy Rafli <[email protected]> Co-authored-by: aldy505 <[email protected]>
1 parent a73563f commit c9aa626

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

install/bootstrap-s3-nodestore.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
echo "${_group}Bootstrapping seaweedfs (node store)..."
22

33
start_service_and_wait_ready seaweedfs postgres
4-
$dc exec -e "HTTP_PROXY=${HTTP_PROXY:-}" -e "HTTPS_PROXY=${HTTPS_PROXY:-}" -e "NO_PROXY=${NO_PROXY:-}" -e "http_proxy=${http_proxy:-}" -e "https_proxy=${https_proxy:-}" -e "no_proxy=${no_proxy:-}" seaweedfs apk add --no-cache s3cmd
4+
$dcx seaweedfs apk add --no-cache s3cmd
55
$dc exec seaweedfs mkdir -p /data/idx/
66
s3cmd="$dc exec seaweedfs s3cmd"
77

install/bootstrap-s3-profiles.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if [[ "$COMPOSE_PROFILES" == "feature-complete" ]]; then
1414
echo "${_group}Bootstrapping seaweedfs (profiles)..."
1515

1616
start_service_and_wait_ready seaweedfs
17-
$dc exec -e "HTTP_PROXY=${HTTP_PROXY:-}" -e "HTTPS_PROXY=${HTTPS_PROXY:-}" -e "NO_PROXY=${NO_PROXY:-}" -e "http_proxy=${http_proxy:-}" -e "https_proxy=${https_proxy:-}" -e "no_proxy=${no_proxy:-}" seaweedfs apk add --no-cache s3cmd
17+
$dcx seaweedfs apk add --no-cache s3cmd
1818
s3cmd="$dc exec seaweedfs s3cmd"
1919

2020
bucket_list=$($s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' ls)
@@ -80,7 +80,7 @@ if [[ "$COMPOSE_PROFILES" == "feature-complete" ]]; then
8080

8181
# Use a temporary container to copy files from the volume to SeaweedFS
8282

83-
$dc exec -e "HTTP_PROXY=${HTTP_PROXY:-}" -e "HTTPS_PROXY=${HTTPS_PROXY:-}" -e "NO_PROXY=${NO_PROXY:-}" -e "http_proxy=${http_proxy:-}" -e "https_proxy=${https_proxy:-}" -e "no_proxy=${no_proxy:-}" -u root vroom sh -c 'mkdir -p /var/lib/apt/lists/partial && apt-get update && apt-get install -y --no-install-recommends s3cmd'
83+
$dcx -u root vroom sh -c 'mkdir -p /var/lib/apt/lists/partial && apt-get update && apt-get install -y --no-install-recommends s3cmd'
8484
$dc exec vroom sh -c 's3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=seaweedfs:8333 --host-bucket="seaweedfs:8333/%(bucket)" sync /var/vroom/sentry-profiles/ s3://profiles/'
8585

8686
echo "Migration completed."

install/dc-detect-version.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ else
4848
fi
4949

5050
proxy_args="--build-arg HTTP_PROXY=${HTTP_PROXY:-} --build-arg HTTPS_PROXY=${HTTPS_PROXY:-} --build-arg NO_PROXY=${NO_PROXY:-} --build-arg http_proxy=${http_proxy:-} --build-arg https_proxy=${https_proxy:-} --build-arg no_proxy=${no_proxy:-}"
51+
exec_proxy_args="-e HTTP_PROXY=${HTTP_PROXY:-} -e HTTPS_PROXY=${HTTPS_PROXY:-} -e NO_PROXY=${NO_PROXY:-} -e http_proxy=${http_proxy:-} -e https_proxy=${https_proxy:-} -e no_proxy=${no_proxy:-}"
5152
if [[ "$CONTAINER_ENGINE" == "podman" ]]; then
5253
proxy_args_dc="--podman-build-args HTTP_PROXY=${HTTP_PROXY:-},HTTPS_PROXY=${HTTPS_PROXY:-},NO_PROXY=${NO_PROXY:-},http_proxy=${http_proxy:-},https_proxy=${https_proxy:-},no_proxy=${no_proxy:-}"
5354
# Disable pod creation as these are one-off commands and creating a pod
@@ -60,6 +61,7 @@ else
6061
fi
6162
dcb="$dc build $proxy_args"
6263
dbuild="$CONTAINER_ENGINE build $proxy_args"
64+
dcx="$dc exec $exec_proxy_args"
6365
echo "$dcr"
6466
# Utility function to handle --wait with docker and podman
6567
function start_service_and_wait_ready() {

0 commit comments

Comments
 (0)