-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Custom auto-setup temporal docker image #7681
Merged
Merged
Changes from all commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
0f06d95
Remove the use of docker compose to build
benmoriceau e85f1a9
Update .dockerignore
benmoriceau dbbb298
Add explicit dependencies
benmoriceau 9b00dc5
Allign .dockerfileingnore, rm implicit dependencies
benmoriceau 0f049e7
improve scheduler gradle
benmoriceau 8957cd7
Clean up migration gradle file
benmoriceau e3dd246
Clean up server gradle
benmoriceau 8f83ea8
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/rem…
benmoriceau 5ab190c
tmp
benmoriceau 7d32b90
Look at diff
benmoriceau d693c5c
rm unwanted files
benmoriceau 8084031
Make sure that we don't commit file that will be copied to the docker…
benmoriceau e63c0f2
Make the scheduler docker build to be increamental
benmoriceau 1b6bc9b
Make the worker docker build to be incremental
benmoriceau 3b9efe9
make a the server docker build to be incremental
benmoriceau 5b3f566
Make the airbyte-migration to be incremental
benmoriceau dee7b07
Make the webapp docker build incremental
benmoriceau 2976178
Make the config init docker build to be incremental
benmoriceau cb538db
Remove the dockerignorfile
benmoriceau fecb366
remove unused gradle block
benmoriceau 71e79da
Make the airbyte cli docker build incremental
benmoriceau 24a7cf8
Rm the use of composeBuild
benmoriceau c9251d9
Fix cli docker image name
benmoriceau d12c485
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/rem…
benmoriceau 07d67f6
Fix migration build
benmoriceau b8bbbab
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/rem…
benmoriceau 23ed511
Use the same version than prod
benmoriceau 3acd34e
Add missing version update in the airbyte scheduler
benmoriceau d279ca2
Move all the docker build related files to the build folder
benmoriceau b32056c
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/rem…
benmoriceau d53150c
Remove outdated file updates
benmoriceau 0c47eb7
Fix workers project
benmoriceau 014a29a
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/rem…
benmoriceau cba2bce
update config docker build
benmoriceau fa899f9
Pr comments and factorization example
benmoriceau 43bb8b0
Single definition of the incremental docker tasks
benmoriceau a52643f
Add documentation
benmoriceau b0ae593
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/rem…
benmoriceau 8a3b1fc
test
benmoriceau 317ae87
Make the factorize incremental to work
benmoriceau 86b22b2
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/rem…
benmoriceau d64750a
Update docs and remove unused import
benmoriceau d42857a
Fix build and remove unused pluggins
benmoriceau 24fd33c
Update doc based on PR comments
benmoriceau 2bf9b18
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/rem…
benmoriceau af63336
Make 2 seperate docker compose task for temporal
benmoriceau 5f3e59d
Auto update the temporal DB upon start
benmoriceau 3cd260c
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/tem…
benmoriceau cc873f1
rename to temporal
benmoriceau f555334
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/tem…
benmoriceau c6b488c
Add generated file
benmoriceau 8768e38
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/tem…
benmoriceau 6f3b1f3
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/tem…
benmoriceau a94f912
tmp
benmoriceau 57dbc40
tmp
benmoriceau c218c23
Tmp
benmoriceau 11adb75
Tmp
benmoriceau 528ef60
Tmp
benmoriceau 63bd053
update script
benmoriceau 48db2f5
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/tem…
benmoriceau 9a77dec
update script
benmoriceau aadaa4f
Fix docker-compose down
benmoriceau 57c7f83
Finalize script
benmoriceau ddc3197
PR comments
benmoriceau d88110a
add temporal to the generate-docker task
benmoriceau 142d30c
Wait before killing the process
benmoriceau 686f248
get rid of timeout
benmoriceau e15f8fc
use docker-compose down
benmoriceau ae45d3c
Fix compose down
benmoriceau 6791ad6
Update doc
benmoriceau 2400b1e
Merge branch 'master' into bmoric/temporal-possible-migration
benmoriceau 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
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,8 @@ | ||
# A test describe in the README is available to test a version update | ||
FROM temporalio/auto-setup:1.13.0 | ||
|
||
ENV TEMPORAL_HOME /etc/temporal | ||
|
||
COPY bin/scripts/update-and-start-temporal.sh update-and-start-temporal.sh | ||
|
||
ENTRYPOINT ["./update-and-start-temporal.sh"] |
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,14 @@ | ||
## Testing a temporal migration | ||
|
||
`tools/bin/test_temporal_migration.sh` is available to test that a bump of the temporal version won't break the docker compose build. Here is what | ||
the script does: | ||
- checkout master | ||
- build the docker image | ||
- run docker compose up in the background | ||
- Sleep for 75 secondes | ||
- shutdown docker compose | ||
- checkout the commit being tested | ||
- build the docker image | ||
- run docker compose up. | ||
|
||
At the end of the script you should be able to access a local airbyte in `localhost:8000`. |
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,10 @@ | ||
task copyScripts(type: Copy) { | ||
dependsOn copyDocker | ||
|
||
from('scripts') | ||
into 'build/docker/bin/scripts' | ||
} | ||
|
||
Task dockerBuildTask = getDockerBuildTask("temporal", "$project.projectDir") | ||
dockerBuildTask.dependsOn(copyScripts) | ||
assemble.dependsOn(dockerBuildTask) |
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,136 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -x | ||
|
||
DBNAME="${DBNAME:-temporal}" | ||
VISIBILITY_DBNAME="${VISIBILITY_DBNAME:-temporal_visibility}" | ||
DB_PORT="${DB_PORT:-3306}" | ||
|
||
POSTGRES_SEEDS="${POSTGRES_SEEDS:-}" | ||
POSTGRES_USER="${POSTGRES_USER:-}" | ||
POSTGRES_PWD="${POSTGRES_PWD:-}" | ||
|
||
SCHEMA_DIR=${TEMPORAL_HOME}/schema/postgresql/v96/temporal/versioned | ||
VISIBILITY_SCHEMA_DIR=${TEMPORAL_HOME}/schema/postgresql/v96/visibility/versioned | ||
|
||
SKIP_DEFAULT_NAMESPACE_CREATION="${SKIP_DEFAULT_NAMESPACE_CREATION:-false}" | ||
DEFAULT_NAMESPACE="${DEFAULT_NAMESPACE:-default}" | ||
DEFAULT_NAMESPACE_RETENTION=${DEFAULT_NAMESPACE_RETENTION:-1} | ||
|
||
# See https://github.com/temporalio/temporal/blob/release/v1.13.x/docker/entrypoint.sh | ||
init_entry_point() { | ||
echo "Start init" | ||
export BIND_ON_IP="${BIND_ON_IP:-$(hostname -i)}" | ||
|
||
if [[ "${BIND_ON_IP}" =~ ":" ]]; then | ||
# ipv6 | ||
export TEMPORAL_CLI_ADDRESS="[${BIND_ON_IP}]:7233" | ||
else | ||
# ipv4 | ||
export TEMPORAL_CLI_ADDRESS="${BIND_ON_IP}:7233" | ||
fi | ||
|
||
dockerize -template ./config/config_template.yaml:./config/docker.yaml | ||
echo "Done init" | ||
} | ||
|
||
wait_for_postgres() { | ||
until nc -z "${POSTGRES_SEEDS%%,*}" "${DB_PORT}"; do | ||
echo 'Waiting for PostgreSQL to startup.' | ||
sleep 1 | ||
done | ||
|
||
echo 'PostgreSQL started.' | ||
} | ||
|
||
update_postgres_schema() { | ||
{ export SQL_PASSWORD=${POSTGRES_PWD}; } 2> /dev/null | ||
|
||
CONTAINER_ALREADY_STARTED="CONTAINER_ALREADY_STARTED_PLACEHOLDER" | ||
if [ ! -e $CONTAINER_ALREADY_STARTED ]; then | ||
touch $CONTAINER_ALREADY_STARTED | ||
temporal-sql-tool --plugin postgres --ep "${POSTGRES_SEEDS}" -u "${POSTGRES_USER}" -p "${DB_PORT}" create --db "${DBNAME}" | ||
temporal-sql-tool --plugin postgres --ep "${POSTGRES_SEEDS}" -u "${POSTGRES_USER}" -p "${DB_PORT}" --db "${DBNAME}" setup-schema -v 0.0 | ||
|
||
|
||
temporal-sql-tool --plugin postgres --ep "${POSTGRES_SEEDS}" -u "${POSTGRES_USER}" -p "${DB_PORT}" create --db "${VISIBILITY_DBNAME}" | ||
temporal-sql-tool --plugin postgres --ep "${POSTGRES_SEEDS}" -u "${POSTGRES_USER}" -p "${DB_PORT}" --db "${VISIBILITY_DBNAME}" setup-schema -v 0.0 | ||
fi | ||
echo "Starting to update the temporal DB" | ||
temporal-sql-tool --plugin postgres --ep "${POSTGRES_SEEDS}" -u "${POSTGRES_USER}" -p "${DB_PORT}" --db "${DBNAME}" update-schema -d "${SCHEMA_DIR}" | ||
echo "Update the temporal DB is done" | ||
|
||
echo "Starting to update the temporal visibility DB" | ||
temporal-sql-tool --plugin postgres --ep "${POSTGRES_SEEDS}" -u "${POSTGRES_USER}" -p "${DB_PORT}" --db "${VISIBILITY_DBNAME}" update-schema -d "${VISIBILITY_SCHEMA_DIR}" | ||
echo "Update the temporal visibility DB is done" | ||
|
||
} | ||
|
||
setup_server(){ | ||
echo "Temporal CLI address: ${TEMPORAL_CLI_ADDRESS}." | ||
|
||
until tctl cluster health | grep SERVING; do | ||
echo "Waiting for Temporal server to start..." | ||
sleep 1 | ||
done | ||
echo "Temporal server started." | ||
|
||
if [ "${SKIP_DEFAULT_NAMESPACE_CREATION}" != true ]; then | ||
register_default_namespace | ||
fi | ||
|
||
if [ "${SKIP_ADD_CUSTOM_SEARCH_ATTRIBUTES}" != true ]; then | ||
add_custom_search_attributes | ||
fi | ||
} | ||
register_default_namespace() { | ||
echo "Registering default namespace: ${DEFAULT_NAMESPACE}." | ||
if ! tctl --ns "${DEFAULT_NAMESPACE}" namespace describe; then | ||
echo "Default namespace ${DEFAULT_NAMESPACE} not found. Creating..." | ||
tctl --ns "${DEFAULT_NAMESPACE}" namespace register --rd "${DEFAULT_NAMESPACE_RETENTION}" --desc "Default namespace for Temporal Server." | ||
echo "Default namespace ${DEFAULT_NAMESPACE} registration complete." | ||
else | ||
echo "Default namespace ${DEFAULT_NAMESPACE} already registered." | ||
fi | ||
} | ||
|
||
add_custom_search_attributes() { | ||
echo "Adding Custom*Field search attributes." | ||
# TODO: Remove CustomStringField | ||
# @@@SNIPSTART add-custom-search-attributes-for-testing-command | ||
tctl --auto_confirm admin cluster add-search-attributes \ | ||
--name CustomKeywordField --type Keyword \ | ||
--name CustomStringField --type Text \ | ||
--name CustomTextField --type Text \ | ||
--name CustomIntField --type Int \ | ||
--name CustomDatetimeField --type Datetime \ | ||
--name CustomDoubleField --type Double \ | ||
--name CustomBoolField --type Bool | ||
# @@@SNIPEND | ||
} | ||
|
||
setup_server(){ | ||
echo "Temporal CLI address: ${TEMPORAL_CLI_ADDRESS}." | ||
|
||
until tctl cluster health | grep SERVING; do | ||
echo "Waiting for Temporal server to start..." | ||
sleep 1 | ||
done | ||
echo "Temporal server started." | ||
|
||
if [ "${SKIP_DEFAULT_NAMESPACE_CREATION}" != true ]; then | ||
register_default_namespace | ||
fi | ||
|
||
if [ "${SKIP_ADD_CUSTOM_SEARCH_ATTRIBUTES}" != true ]; then | ||
add_custom_search_attributes | ||
fi | ||
} | ||
|
||
init_entry_point | ||
wait_for_postgres | ||
update_postgres_schema | ||
|
||
echo "starting temporal server" | ||
setup_server & | ||
./start-temporal.sh |
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
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
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
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
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,30 @@ | ||
#! /bin/bash | ||
|
||
set -ex | ||
|
||
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | ||
|
||
if ! command -v timeout &> /dev/null | ||
then | ||
echo "timeout could not be found, installing it" | ||
brew install coreutils | ||
fi | ||
|
||
NEW_HASH="$( git rev-parse HEAD )" | ||
|
||
git checkout master | ||
git pull --no-rebase | ||
|
||
SUB_BUILD=PLATFORM "$SCRIPT_DIR"/../../gradlew -p "$SCRIPT_DIR"/../.. generate-docker | ||
|
||
cd "$SCRIPT_DIR"/../.. | ||
VERSION=dev docker-compose -f "$SCRIPT_DIR"/../../docker-compose.yaml up & | ||
|
||
sleep 75 | ||
VERSION=dev docker-compose down | ||
|
||
git stash | ||
git checkout $NEW_HASH | ||
SUB_BUILD=PLATFORM "$SCRIPT_DIR"/../../gradlew -p "$SCRIPT_DIR"/../.. generate-docker | ||
|
||
VERSION=dev docker-compose -f "$SCRIPT_DIR"/../../docker-compose.yaml up |
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.
Any reason you're copying this as opposed to just defining the
update-and-start-temporal.sh
in thedocker/scripts
directory? It's not a build artifact.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.
The docker build task will copy the dockerfile to the
build/docker
folder so I need to copy the script in this folder too.