Skip to content
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

Make CLI wait for init to complete #225

Merged
merged 6 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ jobs:

# In order to optimize for speed, we use the latest init image.
- name: Start services
run: FAROS_EMAIL=integration.tests@faros.ai FAROS_INIT_IMAGE=farosai/faros-ce-init:latest docker-compose up --quiet-pull -d
run: FAROS_EMAIL=integration.tests@faros.ai FAROS_INIT_IMAGE=farosai/faros-ce-init:latest docker compose up --quiet-pull -d

- name: Show logs
run: docker-compose logs --tail all
run: docker compose logs --tail all

- name: Show services
run: docker-compose ps -a
run: docker compose ps -a

- name: Wait for init to complete
run: |
CONTAINER_EXIT_CODE=$(docker wait faros-community-edition_faros-init_1)
CONTAINER_EXIT_CODE=$(docker wait faros-community-edition-faros-init-1)
echo "Faros init container exit code was ${CONTAINER_EXIT_CODE}"
[[ $CONTAINER_EXIT_CODE -eq 0 ]]

Expand All @@ -85,6 +85,6 @@ jobs:
working-directory: cli

- name: Stop services
run: docker-compose down
run: docker compose down


10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}

- name: Start services
run: FAROS_EMAIL=integration.tests@faros.ai FAROS_INIT_IMAGE=farosai/faros-ce-init:${{ github.sha }} docker-compose up --quiet-pull -d
run: FAROS_EMAIL=integration.tests@faros.ai FAROS_INIT_IMAGE=farosai/faros-ce-init:${{ github.sha }} docker compose up --quiet-pull -d

- name: Show logs
run: docker-compose logs --tail all
run: docker compose logs --tail all

- name: Show services
run: docker-compose ps -a
run: docker compose ps -a

- name: Wait for init to complete
run: |
CONTAINER_EXIT_CODE=$(docker wait faros-community-edition_faros-init_1)
CONTAINER_EXIT_CODE=$(docker wait faros-community-edition-faros-init-1)
echo "Faros init container exit code was ${CONTAINER_EXIT_CODE}"
[[ $CONTAINER_EXIT_CODE -eq 0 ]]

Expand All @@ -105,7 +105,7 @@ jobs:
working-directory: cli

- name: Stop services
run: docker-compose down
run: docker compose down

- name: Docker login
uses: docker/login-action@v1
Expand Down
16 changes: 10 additions & 6 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ email_prompt() {
}

function setDefaults() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets delete this unused function

detach=""
:
}

function parseFlags() {
while (($#)); do
case "$1" in
--run-cli)
run_cli=1
detach="--detach"
shift 1 ;;
*)
echo "Unrecognized arg: $1"
Expand Down Expand Up @@ -55,17 +54,22 @@ main() {
# Ensure we're using the latest faros-init image
export FAROS_INIT_IMAGE=farosai.docker.scarf.sh/farosai/faros-ce-init:latest

docker-compose pull faros-init
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ypc-faros can you confirm removing that is ok? I don't know why it was in in the first place.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I missed this. We actually need it to make sure we pull the latest faros init image.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


if [[ $(uname -m 2> /dev/null) == 'arm64' ]]; then
# Use Metabase images built for Apple M1
METABASE_IMAGE="farosai.docker.scarf.sh/farosai/metabase-m1" \
docker-compose up --build --remove-orphans $detach
docker compose up --build --remove-orphans --detach && docker compose logs --follow faros-init
else
docker-compose up --build --remove-orphans $detach
docker compose up --build --remove-orphans --detach && docker compose logs --follow faros-init
fi

if ((run_cli)); then
CONTAINER_EXIT_CODE=$(docker wait faros-community-edition-faros-init-1)
if [ "$CONTAINER_EXIT_CODE" != 0 ]; then
printf "An error occured during the initialization of Faros CE.\n"
printf "For troubleshooting help, you can bring this log on our Slack workspace:\n"
printf "https://community.faros.ai/docs/slack \n"
exit 1
fi
docker pull farosai/faros-ce-cli:latest
AIRBYTE_URL=$(grep "^WEBAPP_URL" .env| sed 's/^WEBAPP_URL=//')
METABASE_PORT=$(grep "^METABASE_PORT" .env| sed 's/^METABASE_PORT=//')
Expand Down