How do I install a dependency on Circle 2.0?

dependencies
2.0
apt

#1

I’m trying to install postgres as a -run: step in circle 2.0. I know that the best solution here would be to build our own docker image, but right now we are using a stock node image so that feels like a lot of infrastructure to spin up for a single dependency, right now.

I have a config.yaml that looks like this:

- run: sudo apt-get update && sudo apt-get install -y postgresql postgresql-contrib
- run: npm run init-test-db

init-test-db is a script that as part of it’s set up runs command -v psql and that is failing. If I SSH into the machine and run that command directly, it succeeds. Why is the install not being seen by the next line in the run command? What am I not understanding? For now, I’m going to combine the two commands, but I’d like to know why this isn’t working as is.

Thanks!


#2

My next attempt has also failed:

sudo apt-get update && sudo apt-get install -y postgresql postgresql-contrib && npm run init-test-db

I am getting the same error. When the init-test-db script runs command -v psql it is returning a non-zero error.


#3

Ok, i’ve tracked things down further. Looks like my question was all wrong. apt-get is installing things just fine but when I run command -v psql I’m getting an error because it can’t find command.

Any idea why I would be able to run that after logging in to the instance, but when run in a script it can’t find it?


#4

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.