Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

added - env_file to 'plandex-server' service in docker-compose file so vars in .env get passed through to server. added a note on cleaning out local files to self-hosting guide. updated start_local.sh script to not overwrite .env with _env if .env file already exists. fixes #124 and #125

Dane Schneider6f0c44ad1a3d
diff --git a/app/docker-compose.yml b/app/docker-compose.yml
index 81821b78..0a8be93a 100644
--- a/app/docker-compose.yml
+++ b/app/docker-compose.yml
@@ -26,6 +26,8 @@ services:
- "./scripts:/scripts" # Mount the directory containing wait-for-it.sh
ports:
- "8080:8080"
+ env_file:
+ - ./.env
environment:
DATABASE_URL: "postgres://${PLANDEX_USER}:${PLANDEX_PASSWORD}@plandex-postgres:5432/${PLANDEX_DB}?sslmode=disable"
GOENV: $GOENV
diff --git a/app/start_local.sh b/app/start_local.sh
index 64775ac4..25cfce89 100755
--- a/app/start_local.sh
+++ b/app/start_local.sh
@@ -20,11 +20,16 @@ if ! [ -x "$(command -v docker-compose)" ]; then
exit 1
fi
-cp _env .env
-
-echo "Setup Plandex, please add custom details to the .env file that has been created ..."
-
-echo "For security and stability please add custom values to the .env file that has been created ..."
+# copy the _env file to .env unless it already exists
+if [ -f .env ]; then
+ echo ".env file already exists, won't overwrite it with _env"
+ echo "Add any custom values to .env"
+else
+ echo "Copying _env file to .env"
+ cp _env .env
+ echo ".env has been populated with default values"
+ echo "Add any custom values to .env"
+fi
echo "Setup complete!"
diff --git a/guides/HOSTING.md b/guides/HOSTING.md
index ae439f72..98ac6c47 100644
--- a/guides/HOSTING.md
+++ b/guides/HOSTING.md
@@ -109,3 +109,21 @@ Once the server is running, you can create a new account by running `plandex sig
```bash
plandex sign-in # follow the prompts to create a new account on your self-hosted server
```
+
+### Note: Local CLI Files
+
+If you use the Plandex CLI and then for some reason you reset the database or use a new one, you'll need to remove the local files that the CLI creates in directories where you used Plandex in order to start fresh. Otherwise, the CLI will with an account that doesn't exist in the new database and you'll get errors. This could also happen if you use Plandex Cloud and then switch to self-hosting.
+
+To resolve this, remove the following in any directory you used the CLI in:
+
+- `.plandex-dev` directory if you ran the CLI with `PLANDEX_ENV=development`
+- `.plandex` directory otherwise
+
+Then run `plandex sign-in` again to create a new account.
+
+If you're still having trouble with accounts, you can also remove following from your $HOME directory to fully reset them:
+
+- `.plandex-home-dev` directory if you ran the CLI with `PLANDEX_ENV=development`
+- `.plandex-home` directory otherwise
+
+