Skip to content

Commit

Permalink
Add /etc/hosts fix and initial pnpm install
Browse files Browse the repository at this point in the history
  • Loading branch information
Twixes committed Dec 17, 2024
1 parent c0ef743 commit d3b1289
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
10 changes: 5 additions & 5 deletions .flox/env/manifest.lock
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@
"POSTHOG_SKIP_MIGRATION_CHECKS": "1"
},
"hook": {
"on-activate": "export CARGO_HOME=\"$FLOX_ENV_CACHE/cargo\"\nexport PATH=\"$CARGO_HOME/bin:$PATH\"\n\n# Set up a Python virtual environment\nexport PYTHON_DIR=\"$FLOX_ENV_CACHE/venv\"\nuv venv \"$PYTHON_DIR\" --allow-existing\n\nsource \"$PYTHON_DIR/bin/activate\"\n\n# Install Python dependencies (this is practically instant thanks to uv)\nuv pip install -q -r requirements.txt -r requirements-dev.txt\n"
"on-activate": "export CARGO_HOME=\"$FLOX_ENV_CACHE/cargo\"\nexport PATH=\"$CARGO_HOME/bin:$PATH\"\n\n# Set up a Python virtual environment\nexport PYTHON_DIR=\"$FLOX_ENV_CACHE/venv\"\nuv venv \"$PYTHON_DIR\" --allow-existing\necho -e \"Python interpreter path for your code editor: \\033[32m.flox/cache/venv/bin/python\\033[0m\"\n\nsource \"$PYTHON_DIR/bin/activate\"\n\n# Install Python dependencies (this is practically instant thanks to uv)\nuv pip install -q -r requirements.txt -r requirements-dev.txt\n\n# Install top-level Node dependencies (only if not present all yet, because this takes almost a second even with pnpm)\n# This also sets up pre-commit hooks via Husky\nif [ ! -d \"node_modules\" ]; then\n pnpm install -s\nfi\n\n# Add required entries to /etc/hosts if not present\nif ! grep -q \"127.0.0.1 kafka clickhouse\" /etc/hosts; then\n echo \"\"\n echo \"🚨 Amending /etc/hosts to map hostnames 'kafka' and 'clickhouse' to 127.0.0.1...\"\n echo \"127.0.0.1 kafka clickhouse\" | sudo tee -a /etc/hosts 1> /dev/null\n echo \"✅ /etc/hosts amended\"\nfi\n\necho -e \"\n👉 IT'S DANGEROUS TO GO ALONE! RUN THIS:\n\\033[38;2;255;0;0m1.\\033[0m bin/migrate - to run all migrations\n\\033[38;2;0;255;0m2.\\033[0m bin/start - to start the entire stack\n\\033[38;2;0;0;255m3.\\033[0m ./manage.py generate_demo_data - to create a user with demo data\n\"\n"
},
"profile": {
"bash": " source \"$PYTHON_DIR/bin/activate\"\n cat .flox/env/greeting.txt\n",
"zsh": " source \"$PYTHON_DIR/bin/activate\"\n cat .flox/env/greeting.txt\n",
"fish": " source \"$PYTHON_DIR/bin/activate.fish\"\n cat .flox/env/greeting.txt\n",
"tcsh": " source \"$PYTHON_DIR/bin/activate.csh\"\n cat .flox/env/greeting.txt\n"
"bash": " source \"$PYTHON_DIR/bin/activate\"\n",
"zsh": " source \"$PYTHON_DIR/bin/activate\"\n",
"fish": " source \"$PYTHON_DIR/bin/activate.fish\"\n",
"tcsh": " source \"$PYTHON_DIR/bin/activate.csh\"\n"
},
"options": {
"systems": [
Expand Down
26 changes: 22 additions & 4 deletions .flox/env/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,33 @@ export PATH="$CARGO_HOME/bin:$PATH"
# Set up a Python virtual environment
export PYTHON_DIR="$FLOX_ENV_CACHE/venv"
uv venv "$PYTHON_DIR" --allow-existing
echo -e "Python interpreter path for your code editor: \033[32m.flox/cache/venv/bin/python\033[0m"
source "$PYTHON_DIR/bin/activate"
# Install Python dependencies (this is practically instant thanks to uv)
uv pip install -q -r requirements.txt -r requirements-dev.txt
# Install top-level Node dependencies (only if not present all yet, because this takes almost a second even with pnpm)
# This also sets up pre-commit hooks via Husky
if [ ! -d "node_modules" ]; then
pnpm install -s
fi
# Add required entries to /etc/hosts if not present
if ! grep -q "127.0.0.1 kafka clickhouse" /etc/hosts; then
echo ""
echo "🚨 Amending /etc/hosts to map hostnames 'kafka' and 'clickhouse' to 127.0.0.1..."
echo "127.0.0.1 kafka clickhouse" | sudo tee -a /etc/hosts 1> /dev/null
echo "✅ /etc/hosts amended"
fi
echo -e "
👉 IT'S DANGEROUS TO GO ALONE! RUN THIS:
\033[38;2;255;0;0m1.\033[0m bin/migrate - to run all migrations
\033[38;2;0;255;0m2.\033[0m bin/start - to start the entire stack
\033[38;2;0;0;255m3.\033[0m ./manage.py generate_demo_data - to create a user with demo data
"
'''

# Scripts defined in the `[profile]` section are *sourced* by *your shell* and
Expand All @@ -69,19 +91,15 @@ uv pip install -q -r requirements.txt -r requirements-dev.txt
[profile]
bash = '''
source "$PYTHON_DIR/bin/activate"
cat .flox/env/greeting.txt
'''
fish = '''
source "$PYTHON_DIR/bin/activate.fish"
cat .flox/env/greeting.txt
'''
tcsh = '''
source "$PYTHON_DIR/bin/activate.csh"
cat .flox/env/greeting.txt
'''
zsh = '''
source "$PYTHON_DIR/bin/activate"
cat .flox/env/greeting.txt
'''

# The `[services]` section of the manifest allows you to define services.
Expand Down
2 changes: 1 addition & 1 deletion bin/temporal-django-worker
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cleanup() {

trap cleanup SIGINT SIGTERM EXIT

python manage.py start_temporal_worker "$@"
python manage.py start_temporal_worker "$@" &

worker_pid=$!

Expand Down

0 comments on commit d3b1289

Please sign in to comment.