Howto hook into a running Heroku Clojure repl - deployment

Is there a way to hook into a heroku dyno's running Clojure repl? There are 2 cases where I want to see what's going on.
i. I want to initialize my MongoLab DB. But when I get to my heroku repl, if I try to make a DB call, I get an error.
ii. When running my Clojure app on Heroku, I get a NullPointerException. But the logs don't show me enough info to know where to look. So it would be nice to dig into the dyno's running repl.
Thanks in advance

heroku's filesystem is read-only, not support MongoLab DB, source: https://devcenter.heroku.com/articles/read-only-filesystem, heroku's clojure docs: https://devcenter.heroku.com/categories/clojure

Related

my postgres is unable to connect ever since heroku did a maintenance update 12 hours ago

anyone facing something similar? sadly I'm on a free plan so I can't open a ticket... does anyone know of a way to restart the service/machine of the DB? maybe that would just solve it...
ok so the issue in my case is that indeed heroku performed some sort of maintenance on the DB, and apparently it's connection params (host/url/user/password) had changed... and since it was embedded throughout all my interfaces (the app, my db tools, admin app I also have) - none were able to connect (they'd timeout).
while trying to figure out, I used the wonderful CLI tools of heroku pg:info and heroku pg:diagnose and even heroku pg:psql and tested to see that my data is still there... eventually I went to the online admin and that's where I saw the connections params had changed. BTW - I have this project for 2 years and this is the first time this had happened...
I was in the same situation. Heroku will email you that your database is scheduled for maintenance. After it's complete, connecting to the database fails because of this error:
error: no pg_hba.conf entry for host "IP_ADDRESS", user "DB_USER", database "DB_NAME", no encryption
This is telling us that incorrect credentials were given, meaning the database connection string has changed. I first checked the credentials on the website for the Heroku Postgres Add-on (data.heroku.com), but the connection string was still the same as before; it has not updated or changed at all, therefore this was misleading. Instead, the updated connection string is found inside of the DATABASE_URL config variable, located in the Settings tab of your app on the Heroku dashboard (dashboard.heroku.com), under Config Vars. To avoid manually correcting this problem again, get the connection string from the DATABASE_URL config variable directly, as opposed to hard coding it in your app.
Yes, Im in the same situation. Heroku are a bunch of amateurs. They did some maintenance on the DB, and after it was done, credentials don't work, even those listed in admin/dashboard section of web. Bunch of loosers... #heroku

Is there a way to copy a postgres db to heroku?

I have a django project that I was initially running on pythonanywhere using a postgres database. However, pythonanywhere doesn't support ASGI, so I am migrating the project over to heroku. Since heroku either much prefers or mandates use of its own postgres functionality, I need to migrate the data from elephantsql. However, I'm really coming up short on how... I tried running pg_dumpall but it didn't seem to want to work and/or the file disappeared into the ether. I'm at a loss for how to make this migration... If anyone could help, I'd appreciate it so much. T-T
After hours of searching and doing what I can to scour heroku's listed info, I found it by running heroku pg:push --help.
For a locally running server, run
heroku pg:push '<db_name>' <heroku_db_name> --app <app_name>
For a hosted one, run
heroku pg:push <postgres_link> <heroku_db_name> --app <app_name>

Unicorn Procfile and development databases (Ruby on Rails 4, PostgreSQL, Heroku, Resque)

I am developing a RoR4 app using a Postgre database that does some background database processing with resque and is hosted on Heroku. My question regards running locally for development.
It is my understanding (in this particular project) that when I start the web server using rails server, it connects to a development database, and when I start it using foreman start (with an appropriate Procfile), it connects to some other local database.
My problem is that my Resque jobs look for ActiveRecords in the development database, forcing me to use rails server. However, I need to access some environment variables, stored in a .env file, and it is my understanding that only foreman is able to read these environment variables.
How do I approach a workaround for this problem?
More specifically, how can I get my Resque jobs to look for ActiveRecords in the same database that foreman start uses? Or, how do I have foreman start use the the development database?
My guess for the latter would be edit the Procfile, but I haven't had luck finding a simple solution.
Procfile.dev:
web: bundle exec unicorn -c ./config/unicorn.rb -E $RAILS_DEV
NOTE: $RAILS_DEV=development
Any help would be appreciated. Thanks.
I found out what the problem is. It turns out that my .env file had an explicit URL to connect to my Heroku database. Once I removed that line, foreman start connected to my development database.

Client-side Postgres Logging

I need to analyze Postgres queries generated by a web application. However, server-side logging is not enabled, and as it's a database used by many other developers I don't have permission to turn it on. For those familiar with MSSQL, a tool like SQL Profiler would be ideal, but my searches haven't found anything similar for Postgres. I'd certainly settle for something that creates a log file that I can examine.
Does anyone know a way to do this that doesn't involve straight-up debugging of the web app?
Thanks in advance!
-Steve
PS No Windows tools/solutions please, I'm running Linux and Mac OSX.
If you have superuser access in the database system, you can run
SET log_statements = all;
SET client_min_messages = log;
and see the statement log on the client side.

PostgreSQL installation as a user on Cygwin, database server setup

I'm trying to install PostgreSQL on Cygwin as a user and i'm getting stuck on the part where I have to create a database server, after i execute the pg_ctl command, it just prints "server starting" and runs in the foregorund indefinitely, here's a picture of what I'm talking about:
http://postimg.org/image/oh7ucgt9h/
Im generally a beginner to databases so any pointers would be great.
Chances you are hanging allocating shared memory. Please go with the native Windows build instead. It is far easier to manage.
However if you insist, make sure the ipc-daemon is running before you run PostgreSQL. This will probably solve your problem.
You could run:
ipc-daemon --install-as-service
net start ipc-daemon
And this should do it.