mirror of
https://github.com/d0zingcat/ghost-docker.git
synced 2026-05-24 07:26:48 +00:00
Improve Tinybird login experience
- This helps clean up the TB setup since we no longer need to install the CLI tools locally - The service dependency chaining is a bit annoying here but it should all work - We have to change some of the mounts around because of how TB works and where it expects tokens to be
This commit is contained in:
33
compose.yml
33
compose.yml
@@ -116,21 +116,39 @@ services:
|
|||||||
|
|
||||||
# Suporting Services
|
# Suporting Services
|
||||||
|
|
||||||
|
tinybird-login:
|
||||||
|
build:
|
||||||
|
context: ./tinybird
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
working_dir: /home/tinybird
|
||||||
|
command: /usr/local/bin/tinybird-login
|
||||||
|
volumes:
|
||||||
|
- tinybird_home:/home/tinybird
|
||||||
|
- tinybird_files:/data/tinybird
|
||||||
|
profiles: [analytics]
|
||||||
|
networks:
|
||||||
|
- ghost_network
|
||||||
|
tty: true
|
||||||
|
restart: no
|
||||||
|
|
||||||
tinybird-sync:
|
tinybird-sync:
|
||||||
# Do not alter this without updating the Ghost container as well
|
# Do not alter this without updating the Ghost container as well
|
||||||
image: ghost:${GHOST_VERSION:-5-alpine}
|
image: ghost:${GHOST_VERSION:-5-alpine}
|
||||||
command: >
|
command: >
|
||||||
sh -c "
|
sh -c "
|
||||||
if [ -d /var/lib/ghost/current/core/server/data/tinybird ]; then
|
if [ -d /var/lib/ghost/current/core/server/data/tinybird ]; then
|
||||||
rm -rf /shared/tinybird/*;
|
rm -rf /data/tinybird/*;
|
||||||
cp -rf /var/lib/ghost/current/core/server/data/tinybird/* /shared/tinybird/;
|
cp -rf /var/lib/ghost/current/core/server/data/tinybird/* /data/tinybird/;
|
||||||
echo 'Tinybird files synced into shared volume.';
|
echo 'Tinybird files synced into shared volume.';
|
||||||
else
|
else
|
||||||
echo 'Tinybird source directory not found.';
|
echo 'Tinybird source directory not found.';
|
||||||
fi
|
fi
|
||||||
"
|
"
|
||||||
volumes:
|
volumes:
|
||||||
- tinybird_files:/shared/tinybird
|
- tinybird_files:/data/tinybird
|
||||||
|
depends_on:
|
||||||
|
tinybird-login:
|
||||||
|
condition: service_completed_successfully
|
||||||
networks:
|
networks:
|
||||||
- ghost_network
|
- ghost_network
|
||||||
profiles: [analytics]
|
profiles: [analytics]
|
||||||
@@ -140,14 +158,14 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ./tinybird
|
context: ./tinybird
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
working_dir: /home/tinybird
|
working_dir: /data/tinybird
|
||||||
command: >
|
command: >
|
||||||
sh -c "
|
sh -c "
|
||||||
tb --cloud deploy
|
tb-wrapper --cloud deploy
|
||||||
"
|
"
|
||||||
volumes:
|
volumes:
|
||||||
- .tinyb:/home/tinybird/.tinyb
|
- tinybird_home:/home/tinybird
|
||||||
- tinybird_files:/home/tinybird
|
- tinybird_files:/data/tinybird
|
||||||
depends_on:
|
depends_on:
|
||||||
tinybird-sync:
|
tinybird-sync:
|
||||||
condition: service_completed_successfully
|
condition: service_completed_successfully
|
||||||
@@ -172,6 +190,7 @@ volumes:
|
|||||||
caddy_data:
|
caddy_data:
|
||||||
caddy_config:
|
caddy_config:
|
||||||
tinybird_files:
|
tinybird_files:
|
||||||
|
tinybird_home:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
ghost_network:
|
ghost_network:
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
WORKDIR /home/tinybird
|
WORKDIR /home/tinybird
|
||||||
|
|
||||||
# Install Tinybird using the standard installation script
|
# Install Tinybird using the standard installation script
|
||||||
|
COPY handleLogin.sh /usr/local/bin/tinybird-login
|
||||||
|
COPY tb-wrapper /usr/local/bin/tb-wrapper
|
||||||
|
|
||||||
RUN curl https://tinybird.co | sh
|
RUN curl https://tinybird.co | sh
|
||||||
|
|
||||||
ENV PATH="/root/.local/bin:$PATH"
|
ENV PATH="/root/.local/bin:$PATH"
|
||||||
|
|||||||
11
tinybird/handleLogin.sh
Executable file
11
tinybird/handleLogin.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Check if already logged in
|
||||||
|
if [[ -f "/home/tinybird/.tinyb" ]]
|
||||||
|
then
|
||||||
|
echo "Tinybird already logged in"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Login to Tinybird
|
||||||
|
tb login --method code
|
||||||
18
tinybird/tb-wrapper
Executable file
18
tinybird/tb-wrapper
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Check if .tinyb exists in current directory
|
||||||
|
if [[ ! -f "./.tinyb" ]]
|
||||||
|
then
|
||||||
|
# If not, try to copy from home directory
|
||||||
|
if [[ -f "/home/tinybird/.tinyb" ]]
|
||||||
|
then
|
||||||
|
cp /home/tinybird/.tinyb ./.tinyb
|
||||||
|
echo "Copied .tinyb auth file to current directory"
|
||||||
|
else
|
||||||
|
echo "No .tinyb auth file found, please run 'docker compose run --rm tinybird-login' first to login"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run the tinybird command
|
||||||
|
tb "$@"
|
||||||
Reference in New Issue
Block a user