-
Notifications
You must be signed in to change notification settings - Fork 1
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
Convert to docker #1
Closed
Closed
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
599bdb3
Conversion to docker-compose
212223 7b2eb15
Update README.md
212223 2f2111b
Repair broken links
212223 b2d4eb5
Repair broken links
212223 f49cd5f
Repair broken link
212223 a9e2892
Repair broken link
212223 26d24fb
Repair broken links
212223 f6bbf95
Repair broken links
212223 83f3230
Update github link so it points to 212223
212223 4e6222a
Update comment
212223 9862bc7
Update comment
212223 46708e8
Update comment
212223 718b5aa
Add new line at the end of files.
212223 59e47a7
Revert all changes to the webapp excluding src/Elasticsearch/Service/…
212223 29e9892
Variable name change ELASTICSEARCH_HOST to camelCase
212223 a9d3747
Use parameter app.elasticsearch.host in ApiClient
212223 f23be2c
Remove not neccessary files from nginx-v1 service.
212223 61bd5c0
Remove non essential files from php-fpm-v8 service.
212223 f346468
Remove redundant mkdir for nginx-v1 service
212223 9cdc91e
Remove redundant env vars for php-fpm-v8 service
212223 e884fb8
Update comments in elasticsearch-v7 service.
212223 d162070
Resolve branch conflicts.
212223 0dbce96
Simplify elasticsearch-v7 - remove redundant files
212223 8046dd3
Merge branch 'main' into convert-to-docker
212223 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"; | ||
|
||
"$SCRIPTPATH/request.sh" "$SCRIPTPATH/Index/Delete.http" || true | ||
"$SCRIPTPATH/request.sh" "$SCRIPTPATH/Index/Create.http" && \ | ||
"$SCRIPTPATH/request.sh" "$SCRIPTPATH/Index/Bulk.http" && sleep 1 && \ | ||
"$SCRIPTPATH/request.sh" "$SCRIPTPATH/Index/Count.http" | ||
|
||
printf "Done!\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/bin/sh | ||
|
||
# Example usage: | ||
# ./request.sh ./Index/Create.http | ||
# ./request.sh /app/default/.elasticsearch-http-requests/Index/Delete.http | ||
|
||
set -eu | ||
|
||
http_request_path="${1:-}" | ||
|
||
[ -n "$http_request_path" ] || \ | ||
{ printf "Usage: $1 <path to request file>\n" && exit 1; } | ||
|
||
[ -n "${DOCKER_ELASTICSEARCH_HOST:-}" ] || \ | ||
{ printf "Set ENV varialbe DOCKER_ELASTICSEARCH_HOST first\n" && exit 1 ;} | ||
|
||
RED='\033[31;5;7m' | ||
GREEN='\033[1;0;42m' | ||
NC='\033[0m' # No Color | ||
|
||
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"; | ||
|
||
# if request path is not absolute make it relative to the script | ||
[ ! "$http_request_path" = "${http_request_path#/}" ] || \ | ||
http_request_path="$SCRIPTPATH/$http_request_path" | ||
|
||
[ -f $http_request_path ] || \ | ||
{ printf "Path does not point to a file, path: $1\n" && exit 1; } | ||
|
||
[ -r "$http_request_path" ] || \ | ||
{ printf "File is not readable, check permissions, path: $1\n" && exit 1; } | ||
|
||
# read content of a file | ||
content="$(cat "$http_request_path" || { 1>&2 printf "Could not read the file: $http_request_path\n" && exit 1; })" | ||
|
||
# dissasemble request to its part | ||
request="$(printf "$content" | head -n1)" | ||
method="$(printf "$request" | grep -oE '^\w+')" | ||
url=$(printf "$request" | sed 's/^\w* //') | ||
header="$(printf "$content\n" | awk '/http/,/^$/' | tail -n+2 | sed '$d')" | ||
body="$(printf "$content" | tail -n+"$(printf "$content\n" | awk '/http/,/^$/' | wc -l)" | tail -n+2)" | ||
|
||
# convert localhost to elasticsearch service host | ||
find='http://localhost:9200' | ||
replace="$DOCKER_ELASTICSEARCH_HOST" | ||
url="$(printf "$url\n" | awk -v r="$replace" -v f="$find" '{ gsub(f,r); print $0 }')" | ||
|
||
# create header options for curl | ||
curl_header='' | ||
newline="$(printf "\nx")" && newline="${newline%x}" | ||
IFS="$newline" | ||
for head in $header; do | ||
curl_header="${curl_header} -H '$head'" | ||
done | ||
|
||
option_data='' | ||
[ -z "$body" ] || option_data=" --data-raw \\${newline}'$body${newline}'" | ||
|
||
# escape body's single quote ' | ||
body="$(printf "$body" | sed "s/'/\\\'/g")" | ||
|
||
from_newline='' | ||
[ -z "$option_data" ] || from_newline="\\${newline}" | ||
|
||
#Bugfix for: elasticsearch 7 deprec. use of _doc: '{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."}],"type":"illegal_argument_exception","reason":"The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."},"status":400}' | ||
[ ! "$method" = 'PUT' ] || url="${url}?include_type_name=true" | ||
|
||
command_request="curl -sSL -X ${method:-GET}${curl_header}${option_data} ${from_newline}'$url'" | ||
printf "Performing cURL request:\n${command_request}\n" | ||
|
||
# example success responses | ||
# expected_pattern='\{"count":0,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0}}' | ||
# expected_pattern='^\{"acknowledged":true' # Delete, | ||
|
||
# check for error response | ||
expected_pattern='^\s*\{\s*"error"' # Delete, | ||
response="$(printf "$command_request\n" | sh || ec=$? )" | ||
|
||
# validate response | ||
printf "$response" | grep -vE "$expected_pattern" > /dev/null || \ | ||
{ printf "${RED}FAIL${NC}\nThere was an error with cURL exit code: ${ec:-0}, and response: $response\n" && exit ${ec:-1}; } | ||
|
||
printf "$response\n" | ||
printf "${GREEN}Success.${NC}\n" |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Łukasz Rynek | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
0
bin/console → app/default/bin/console
100755 → 100644
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# name of the project, if blank then docker sets it to a name of a dir that docker-compose.yaml is inside | ||
COMPOSE_PROJECT_NAME=carrental | ||
|
||
# profile to run with docker-compose up (may be multiple separated by comma) makes docker-compose --profile flag not having any effect | ||
# COMPOSE_PROFILES= | ||
|
||
# list of files to combine the total docker-compose.yaml (a kind of include files) | ||
COMPOSE_FILE=_network.yaml:_restart-policy.yaml:_limit-memory.yaml:_service-dependency.yaml:_profiles.yaml:docker-compose.yaml:php-composer-v2.yaml:elasticsearch-v7.yaml:php-fpm-v8.yaml:nginx-v1.yaml | ||
|
||
# application path relative to the docker-compose.yaml file. | ||
app_path=./../../app | ||
|
||
# Path where different service images, their files, Dockerfiles are stored (relative to the docker-compose.yaml) | ||
service_path=. | ||
|
||
# path inside service_path where is Dockerfile and .env files stored | ||
image_path=image | ||
|
||
# path inside service_path where all image files are stored ${service_path}/${image_files_path}/usr/share => /usr/share (path inside a container) | ||
image_files_path=image/files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docker-compose.override.yaml |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@212223 why this directory move from
app
toapp/default
here and in lots of places? 🤔There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is good to have a web application served by
nginx
from a sub-directoryapp/default
instead of a parent directoryapp
because this allows to switch between applications instantaneously.For example instead of having your application inside the
app/default
dir you may have it inapp/bar
dir and a symlinkapp/default -> app/bar
that points to the dir of the application you want to serve. Demo commit.Then if you want to change the application you serve you don't need to reconfigure nginx nor restarting any of the services is required but only changing the symlink target, for example:
like in the Demo commit
and you are ready to serve the new application.
Example use cases:
Currently the web app is in the
app/default
dir. Would you like me to:default
that points to that dirapp
dir fromapp/default
and reconfigure docker-compose?