wasp start db fails inside CI pipeline
We are attempting to run some automated tests against our wasp app inside of a Bitbucket pipelines step as part of our CI automation.
wasp start db
fails start due the the volume parameter on the docker command docker run --name wasp-dev-db-OpenSaaS-f93feb5239 --rm --publish 5432:5432 -v wasp-dev-db-OpenSaaS-f93feb5239:/var/lib/postgresql/data --env POSTGRES_PASSWORD=postgresWaspDevPass --env POSTGRES_USER=postgresWaspDevUser --env POSTGRES_DB=OpenSaaS-f93feb5239
Bitbucket pipelines rejects this due to the -v
Error response from daemon: authorization denied by plugin pipelines: -v only supports $BITBUCKET_CLONE_DIR and its subdirectories. Its possible to run postgres with the data stored in memory instead of on a volume by omitting that flag but I don't know if this capability is exposed to the wasp CLI9 Replies
Hi @donmackinnon. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the knowledge sources provided, there isn't specific information about running Wasp in a CI pipeline or using Bitbucket Pipelines. However, I can provide some insights and suggestions based on the available information about Wasp's database setup.
The issue you're encountering is related to the Docker volume restriction in Bitbucket Pipelines. Wasp's default
wasp start db
command uses a Docker volume to persist the database data, which is not allowed in your CI environment.
While Wasp doesn't directly expose an option to run the database without a volume, you might be able to work around this limitation by manually starting the database without the volume flag. Here are a few suggestions:
1. Custom Docker command: Instead of using wasp start db
, you could try running a custom Docker command in your CI pipeline that omits the volume flag. For example:
This command is based on the one shown in the Github Issue about PostgreSQL setup (https://github.com/wasp-lang/wasp/issues/173).
2. Environment variable: Wasp uses the DATABASE_URL
environment variable to connect to the database. You could set this variable in your CI pipeline to point to a PostgreSQL instance that you set up separately, without using Docker volumes.
3. Alternative database setup: For CI purposes, you might consider using a different database setup that's compatible with your pipeline restrictions. This could involve using a managed database service or a different local setup method.
It's worth noting that these are workarounds and may not fully replicate the exact behavior of wasp start db
. You might need to adjust your tests or CI process accordingly.
For a more definitive solution, you may want to:
1. Open an issue on the Wasp GitHub repository (https://github.com/wasp-lang/wasp) requesting support for running the database without a volume in CI environments.
2. Check if there are any updates or new features in the latest version of Wasp that might address this issue.
3. Reach out to the Wasp community on their Discord channel (https://discord.com/channels/686873244791210014) for more specific advice on CI integration.
Remember to test any workarounds thoroughly to ensure they meet your CI requirements and don't introduce unexpected behavior in your tests.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @donmackinnon, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?@kapa.ai how is the "f93feb5239" portion determined
Let me check the knowledge base for you again. One moment! :books:
----------------------
The "f93feb5239" portion you're referring to is part of the database name and Docker container name generated by Wasp. Based on the knowledge sources provided, I can explain how this is determined.
This alphanumeric string is a unique identifier that Wasp generates for each project. It's derived from the project name and is used to ensure uniqueness when creating database resources.
According to the Github Issue about managed dev db (https://github.com/wasp-lang/wasp/issues/1049), Wasp generates a unique identifier for each project to avoid conflicts when multiple Wasp apps are running on the same machine. The issue mentions:
"Name the docker volume by the Wasp app."
This practice helps prevent conflicts between different Wasp projects that might be running simultaneously on the same system.
In the example you provided, "OpenSaaS-f93feb5239" is likely the unique identifier for your project, where:
- "OpenSaaS" is your project name
- "f93feb5239" is the generated unique hash
This naming convention is used in various parts of the Wasp setup, including:
1. The Docker container name:
wasp-dev-db-OpenSaaS-f93feb5239
2. The Docker volume name: wasp-dev-db-OpenSaaS-f93feb5239
3. The PostgreSQL database name: OpenSaaS-f93feb5239
By using this unique identifier, Wasp ensures that each project has its own isolated database resources, even if multiple projects are running on the same machine or if the project name itself is not unique.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @donmackinnon, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?wasp start db
is there for your convenience, but you can always run the database whatever way you like. So in this situation, it would probably be best to run it manually in the CI and just provide wasp app with the url to it via DATABASE_URL. You can e.g. run it with postgres
, or maybe there is a recommended way to run postgres db in bitbucket CI.We ended up running it directly, i just wasn't sure if there were other implications of doing so
Nope, running it direclty is perfectly fine!
wasp start db
here is just to speed you up in development.Awesome thank you for responding and for the work you guys do on Wasp! We are trying to launch our site by January, I’ll make sure to drop a link in the other channel when it’s out!
Wohooo @donmackinnon, you just became a Waspeteer level 2!
@donmackinnon , awesome, looking forward to it, and we are here for any help :)!