I am trying to get a Rails app with a Postgres/Postgis db with Geos working and I am not able to do so. I found this link:
https://discuss.circleci.com/t/libgeos-not-recognized-in-circleci-2-0-environment/22451
That eventually led me here:
Libgeos is installed:
circleci@8e954f13d764:~/project$ sudo apt list | grep libgeos
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libgeos++-dev/oldstable,now 3.5.1-3 amd64 [installed]
libgeos-3.5.1/oldstable,now 3.5.1-3 amd64 [installed,automatic]
libgeos-c1v5/oldstable,now 3.5.1-3 amd64 [installed,automatic]
libgeos-dbg/oldstable 3.5.1-3 amd64
libgeos-dev/oldstable,now 3.5.1-3 amd64 [installed]
libgeos-doc/oldstable 3.5.1-3 all
But ultimately my issue is the same:
[1] pry(main)> RGeo::Geos.supported?
=> false
The interesting thing about my setup is that we are using a remote database - it’s a static database containing Who’s On First location data, and we know for a fact that extension is working on that db because it’s been configured correctly. The trouble here is that RGeo
doesn’t know that, and we need the libraries for it to work to be installed locally so the local gem can communicate with the remote server.
Here’s my config.yml.
version: 2.1
orbs:
ruby: circleci/ruby@1.1.0
node: circleci/node@3.0.1
jobs:
test:
docker:
- image: circleci/ruby:2.6.5-stretch-node-browsers
- image: circleci/postgres:11.6-postgis-ram # Do I even need this, since I'm not creating a db locally?
- image: circleci/mysql:8.0.21-ram
command: [--default_authentication_plugin=mysql_native_password]
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
MYSQL_ROOT_HOST: "%"
- image: circleci/redis:6.0.6
environment:
RAILS_ENV: test
executor: ruby/default
steps:
- checkout
- run:
name: Install postgis stuff
command: |
sudo apt-get install libgeos-dev
sudo apt-get install libgeos++-dev
sudo apt-get install libproj-dev
- run:
name: Install dockerize
command: wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
environment:
DOCKERIZE_VERSION: v0.3.0
- ruby/install-deps
- run:
name: Which bundler?
command: bundle -v
- run:
name: Waiting for MySQL to be ready
command: dockerize -wait tcp://localhost:3306 -timeout 1m
- run:
name: Waiting for PostgreSQL to be ready
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run:
name: Waiting for Redis to be ready
command: dockerize -wait tcp://localhost:6379 -timeout 1m
- run:
name: Create DB
command: bundle exec rails db:create --trace
- run:
name: Load DB schema
command: bundle exec rails db:schema:load --trace
- node/install-packages:
pkg-manager: yarn
- restore_cache:
keys:
- packs-test-cache-v1
- run:
name: Compile Webpack
command: bin/webpack
- save_cache:
key: packs-test-cache-v1
paths:
- public/packs-test
- ruby/rubocop-check
- ruby/rspec-test
workflows:
version: 2
test:
jobs:
- test
I’ll keep digging and see if I can find anything that works.