Skip to content

Commit cf35585

Browse files
committed
feat: configuration values for linux provider
1 parent a696150 commit cf35585

File tree

6 files changed

+28
-14
lines changed

6 files changed

+28
-14
lines changed

scripts/linux-provider/_config.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
echo "[Configuration]"
4+
echo "- Using sudo: ${LINUX_SUDO}"
5+
echo "- Client max body size: ${LINUX_CLIENT_MAX_BODY_SIZE}"
6+
echo "NOTE: You can configure these in taito-config.sh"
7+
echo

scripts/linux-provider/taito-deployment-deploy#post.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
set -e
1414

15+
. "${taito_project_path}/scripts/linux-provider/_config.sh"
16+
. "${taito_cli_path}/plugins/ssh/util/opts.sh"
17+
1518
image_tag=$1
1619
if [[ ! $image_tag ]]; then
1720
echo "[Getting commit sha of the latest commit on branch ${taito_branch}]"
@@ -30,8 +33,6 @@ echo "NOTE: Deployment is done using the taito-config.sh and"
3033
echo "docker-compose-remote.yaml currently located on your local directory."
3134
echo
3235

33-
. "${taito_cli_path}/plugins/ssh/util/opts.sh"
34-
3536
echo "[Copy docker-compose-remote.yaml to ${taito_host}:/tmp]"
3637
(
3738
set -e
@@ -45,15 +46,15 @@ echo
4546

4647
echo "[Execute on host ${taito_host}]"
4748
ssh ${opts} "${taito_ssh_user}@${taito_host}" "
48-
sudo bash -c '
49+
${LINUX_SUDO} bash -c '
4950
set -e
5051
${taito_setv:?}
5152
cd ${taito_host_dir}
5253
echo
5354
echo [Check that Docker images exist]
54-
if ! sudo docker images | grep ${taito_container_registry} | grep ${image_tag} &> /dev/null; then
55+
if ! docker images | grep ${taito_container_registry} | grep ${image_tag} &> /dev/null; then
5556
echo Latest images on remote host:
56-
sudo docker images | grep ${taito_container_registry}
57+
docker images | grep ${taito_container_registry}
5758
echo
5859
echo ERROR: No image with tag ${image_tag}
5960
exit 1

scripts/linux-provider/taito-env-apply#post.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
set -e
1111

12-
CLIENT_MAX_BODY_SIZE=1m
13-
12+
. "${taito_project_path}/scripts/linux-provider/_config.sh"
1413
. "${taito_cli_path}/plugins/ssh/util/opts.sh"
1514

1615
echo "[Copy changed secrets to ${taito_host}:/tmp]"
@@ -26,7 +25,7 @@ echo
2625

2726
echo "[Execute on ${taito_host}]"
2827
ssh ${opts} "${taito_ssh_user}@${taito_host}" "
29-
sudo bash -c '
28+
${LINUX_SUDO} bash -c '
3029
set -e
3130
${taito_setv:?}
3231
echo [Extract /tmp/${taito_namespace}-secrets.tar]
@@ -36,7 +35,7 @@ ssh ${opts} "${taito_ssh_user}@${taito_host}" "
3635
echo
3736
3837
if which createtaitosite &> /dev/null; then
39-
createtaitosite ${taito_namespace} ${taito_domain} $CLIENT_MAX_BODY_SIZE
38+
createtaitosite ${taito_namespace} ${taito_domain} $LINUX_CLIENT_MAX_BODY_SIZE
4039
else
4140
echo NOTE: createtaitosite command does not exist.
4241
echo Configure routing for domain ${taito_domain} yourself.

scripts/linux-provider/taito-env-destroy#post.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77

88
set -e
99

10+
. "${taito_project_path}/scripts/linux-provider/_config.sh"
1011
. "${taito_cli_path}/plugins/ssh/util/opts.sh"
1112

1213
echo "[Execute on ${taito_host}]"
1314
ssh ${opts} "${taito_ssh_user}@${taito_host}" "
14-
sudo bash -c '
15+
${LINUX_SUDO} bash -c '
1516
set -e
1617
${taito_setv:?}
1718
if which deletetaitosite &> /dev/null; then

scripts/linux-provider/taito-env-rotate#post.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88

99
set -e
1010

11+
. "${taito_project_path}/scripts/linux-provider/_config.sh"
1112
. "${taito_cli_path}/plugins/ssh/util/opts.sh"
1213

13-
# TODO: duplicate code with taito-env-apply#post.sh
14+
# TODO: some duplicate code with taito-env-apply#post.sh
1415

1516
echo "[Copy changed secrets to ${taito_host}:/tmp]"
1617
(
@@ -25,7 +26,7 @@ echo
2526

2627
echo "[Execute on ${taito_host}]"
2728
ssh ${opts} "${taito_ssh_user}@${taito_host}" "
28-
sudo bash -c '
29+
${LINUX_SUDO} bash -c '
2930
set -e
3031
${taito_setv:?}
3132
echo [Extract /tmp/${taito_namespace}-secrets.tar]
@@ -36,6 +37,7 @@ ssh ${opts} "${taito_ssh_user}@${taito_host}" "
3637
3738
echo [Restart docker-compose]
3839
cd ${taito_host_dir}
40+
. taito-config.sh
3941
docker-compose stop
4042
docker-compose -d up
4143
'

taito-config.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,17 +359,21 @@ case $taito_provider in
359359
gcloud_service_account_enabled=true
360360
;;
361361
linux)
362+
# Enable ssh and run plugins
362363
taito_plugins="
363364
ssh:-local
364365
run:-local
365366
${taito_plugins}
366367
"
367368
run_scripts_location="scripts/linux-provider"
368-
# Use docker-compose instead of Kubernetes and Helm
369+
# Set some configuration parameters for scripts/linux-provider scripts
370+
LINUX_SUDO=sudo # NOTE: Put empty value if sudo is not required or allowed
371+
LINUX_CLIENT_MAX_BODY_SIZE=1m
372+
# Use Docker Compose instead of Kubernetes and Helm
369373
taito_plugins="${taito_plugins/docker-compose:local/docker-compose}"
370374
taito_plugins="${taito_plugins/kubectl:-local/}"
371375
taito_plugins="${taito_plugins/helm:-local/}"
372-
# ssh plugin as database proxy
376+
# Use SSH plugin as database proxy
373377
if [[ -f taito-user-config.sh ]]; then
374378
. ./taito-user-config.sh # TODO: hack
375379
fi

0 commit comments

Comments
 (0)