[英]Unable to use Postgis on Bluemix Compose for Postgresql
I have a Compose for Postgresql service on IBM Bluemix which isn't allowing me run PostGIS functions on my cloud foundry rails app. 我在IBM Bluemix上有一个Compose for Postgresql服务,该服务不允许我在我的Cloud Foundry Rails应用程序上运行PostGIS功能。 I have run "CREATE EXTENSION PostGIS;"
我已经运行了“ CREATE EXTENSION PostGIS;” and I have also added the adapter to database.yml.
并且我还将适配器添加到了database.yml中。 Compose for Postgresql says PostGIS comes installed by default
Compose for Postgresql表示PostGIS默认安装
I am using Ruby on Rails with the rgeo gem and the error is 我在rgeo gem中使用Ruby on Rails,错误是
ERR NoMethodError: undefined method `st_point' for # ERR NoMethodError:#的未定义方法“ st_point”
Can you please let me know if there is anything I need to do to get PostGIS working? 您能否让我知道让PostGIS工作需要做些什么?
请提出支持请求,要求在撰写实例上启用postgis插件。
Answered my own question. 回答了我自己的问题。 The problem was with the rgeo gem and the adapter.
问题出在rgeo gem和适配器上。 I needed the postgis:// adapter for working with the gem.
我需要postgis://适配器才能使用gem。
Bluemix does not allow you to change the adapter in their connections. Bluemix不允许您更改适配器的连接。 It will always be postgresql.
它将始终是postgresql。 To get around this I set a CUSTOM_DATABASE_URL environment variable with the connection string
postgis://<username>:<password>@host:port/<db_name>
. 为了解决这个问题,我用连接字符串
postgis://<username>:<password>@host:port/<db_name>
设置了一个CUSTOM_DATABASE_URL环境变量。 Using the cf client this would look like 使用cf客户端,这看起来像
cf set-env <app-name> CUSTOM_DATABASE_URL postgis://<username>:<password>@host:port/<db_name>
Then in the command for my container in the manifest.yml, I prepended setting DATABASE_URL = CUSTOM_DATABASE_URL, specifically 然后在manifest.yml中用于我的容器的命令中,我预先设置了DATABASE_URL = CUSTOM_DATABASE_URL
DATABASE_URL=$CUSTOM_DATABASE_URL &&.....
Its a workaround for now until Bluemix allows us to change the adapter in the connections. 在Bluemix允许我们更改连接中的适配器之前,这是目前的解决方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.