Skip to content

Commit fa2b9a6

Browse files
Merge pull request #3 from patternhelloworld/fix/more-on-remote
fix : Relation on SKIP_BUILDING_APP_IMAGE and ONLY_BUILDING_APP_IMAGE…
2 parents debeeb0 + 143d4e8 commit fa2b9a6

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed

run.sh

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -150,21 +150,16 @@ _main() {
150150
local initially_cached_old_state=${state}
151151
check_env_integrity
152152

153-
display_checkpoint_message "Deployment target between Blue and Green has been decided... (3%)"
154-
display_planned_transition "$initially_cached_old_state" "$new_state"
155-
sleep 2
156-
157-
if [[ "${git_image_load_from}" == "build" && -n "${project_git_sha}" && -n "${docker_build_sha_insert_git_root}" ]]; then
158-
commit_message=$(get_commit_message "$project_git_sha" "$docker_build_sha_insert_git_root")
159-
display_checkpoint_message "Build this GIT version: $project_git_sha : $commit_message"
160-
sleep 1
161-
fi
162-
163153
## Build the App Image and save it to '.docker/binary' to be used on your production servers.
164154
if [[ ${only_building_app_image_for_production} == 'true' ]]; then
165-
display_checkpoint_message "Building Docker image for the app... ('skip_building_app_image' is set to false) (50%)"
166-
load_app_docker_image
167-
save_app_docker_image
155+
if [[ ${skip_building_app_image} != 'true' ]]; then
156+
display_checkpoint_message "Building Docker image for the app... ('only_building_app_image_for_production' is set to true) (50%)"
157+
load_app_docker_image
158+
save_app_docker_image
159+
display_checkpoint_message "Saved as a Docker image binary for the app... ('only_building_app_image_for_production' is set to true) (60%)"
160+
else
161+
display_checkpoint_message "Skip building image (skip_building_app_image : ${skip_building_app_image}). We will use the previous images on the remote server... (50%)"
162+
fi
168163
# Call remote distribution only when all 4 REMOTE_* envs are provided and lists are non-empty
169164
need_remote=false
170165
if [[ -n "${remote_deployment_runner_path}" && -n "${remote_deployment_ip_address_list}" && -n "${remote_deployment_port_number_list}" && -n "${remote_deployment_ssh_private_key_local_path_with_file}" ]]; then
@@ -177,16 +172,33 @@ _main() {
177172
fi
178173

179174
if [[ ${need_remote} == true ]]; then
180-
remote_deployment_connect_and_save_binary
175+
if [[ ${skip_building_app_image} != 'true' ]]; then
176+
remote_deployment_connect_and_save_binary
177+
else
178+
display_checkpoint_message "Skip saving binary on the remote server (skip_building_app_image : ${skip_building_app_image}). We will use the previous images on the remote server... (60%)"
179+
fi
181180
if [[ -n "${remote_deployment_failure_strategy}" ]]; then
182181
remote_deployment_run_on_remotes
183182
fi
184183
display_checkpoint_message "[NOTICE] Deployed the App image for all Production servers... Check the detailed logs. (100%)" && exit 0
185184
else
186185
display_checkpoint_message "[NOTICE] App image binary saved to ./.docker/binary/${project_name}... (100%)" && exit 0
187186
fi
187+
188+
exit 0
188189
fi
189190

191+
display_checkpoint_message "Deployment target between Blue and Green has been decided... (3%)"
192+
display_planned_transition "$initially_cached_old_state" "$new_state"
193+
sleep 2
194+
195+
if [[ "${git_image_load_from}" == "build" && -n "${project_git_sha}" && -n "${docker_build_sha_insert_git_root}" ]]; then
196+
commit_message=$(get_commit_message "$project_git_sha" "$docker_build_sha_insert_git_root")
197+
display_checkpoint_message "Build this GIT version: $project_git_sha : $commit_message"
198+
sleep 1
199+
fi
200+
201+
190202
## App (This is for running Docker for your App, not for building the App Docker Image)
191203
display_checkpoint_message "Setting up the app configuration 'yml' for orchestration type: ${orchestration_type}... (6%)"
192204
initiate_docker_compose_file

samples/laravel-crud-boilerplate/.docker/sh/update/run.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ cd ${rootPath} || exit 1
88

99
chown -R www-data:${shared_volume_group_id} storage bootstrap/cache public
1010

11+
php artisan migrate --no-interaction --verbose
12+
1113
php artisan key:generate
1214

1315
if [[ ! -f ${rootPath}"/storage/oauth-private.key" || ! -f ${rootPath}"/storage/oauth-public.key" ]]

use-remote-deployment.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ remote_deployment_connect_and_save_binary(){
5151
fi
5252

5353
echo "[NOTICE] Checking connectivity to ${remote_host}:${port_item}"
54-
ssh -o StrictHostKeyChecking=no -o BatchMode=yes -o ConnectTimeout=8 -p "${port_item}" -i "${key_item}" "${remote_host}" "echo yes" >/dev/null 2>&1 || (echo "[ERROR] SSH connection failed: ${remote_host}:${port_item}" && exit 1)
54+
ssh -o StrictHostKeyChecking=no -o BatchMode=yes -o ConnectTimeout=10 -p "${port_item}" -i "${key_item}" "${remote_host}" "echo yes" >/dev/null 2>&1 || (echo "[ERROR] SSH connection failed: ${remote_host}:${port_item}" && exit 1)
5555
done
5656

5757
for ((i=1; i<=${ip_len}; i++))

0 commit comments

Comments
 (0)