I’m new to CircleCI and having some trouble with getting Postgres implemented in the config file, albeit I am new to Postgres as well so maybe it’s an error on my part with that tech and not CircleCI.
I input my environment variables via the settings for the repository instead of in the config file. Now the way I have things set to run is that when running yarn test
the below piece of code will check what environment Node is operating in and create the appropriate Sequelize database connection:
if (process.env.NODE_ENV === 'test') {
sequelize = new Sequelize(env.PSQL_URI, { logging: false })
} else if (process.env.NODE_ENV === 'development') {
sequelize = new Sequelize(env.PSQL_URI)
} else if (process.env.NODE_ENV === 'production') {
sequelize = new Sequelize(env.PSQL_URI)
}
In my environment.js file, I have separate env.PSQL_URI
based on the NODE_ENV
const testConfig = {
EXPIRE_TIME: '1s',
JWT_SECRET: 'm3LL0wY3ll0w',
PSQL_URI: `postgres://${process.env.PSQL_USER}:${process.env
.PSQL_PASSWORD}@localhost:5432/graphql_todo_test`
}
When running locally I have the PSQL_USER
set to my local user and the password is set up the same. When I pushed and Circle began the setup I got back:
waiting for server to shut down…LOG: received fast shutdown request
.LOG: aborting any active transactions
LOG: autovacuum launcher shutting down
LOG: shutting down
LOG: database system is shut down
done
server stopped
PostgreSQL init process complete; ready for start up.
LOG: database system was shut down at 2017-07-22 11:26:19 UTC
LOG: MultiXact member wraparound protections are now enabled
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
LOG: incomplete startup packet
FATAL: role “rockchalkwushock” does not exist
rockchalkwushock
is my local user value that is stored in env.PSQL_USER
. I’m guessing that there is either a default value I’m overriding by accident with this or there is a specific user that must be set for this to work.
Any tips or pointers would be greatly appreciated. Liking Circle just lots to learn.