So I've triple checked my config.json to make sure that all of the keys are aligned with the heroku database:
"production": {
"name": "NAME",
"user": "USER",
"port": "5432",
"pass": "PASSWORD",
"host": "HOST",
"dialect": "postgres"
}
I know these values are working because I can access the db with pgcommander. I then do the following steps:
heroku config:set NODE_ENV='production' --app APP_NAME
heroku run node_modules/.bin/sequelize db:migrate
but always end up with the following error after the migration fails:
[00:27:42] Finished 'db:migrate' after 88 ms
Unable to connect to database: Error: SequelizeConnectionError: no PostgreSQL user name specified in startup packet
A google search for the error returns a surprisingly small amount of relevant results.
Any help appreciated.
I just solved this by changing my config.json and using a different order of heroku commands:
First I had to promote the heroku db: instructions for promoting db then change my
config.json
to the following:
"production": {
"use_env_variable": "DATABASE_URL"
}
Then run the following commands in terminal:
heroku run bash
now inside heroku bash:
sequelize db:migrate
I'm still not sure why specifying each key of the db url in config.json was giving me an error as they should be exactly the same.
Related
I'm trying to get my BitBucket Pipeline to deploy to Heroku using the method described here:
https://confluence.atlassian.com/bitbucket/deploy-to-heroku-872013667.html
but it fails with the error:
remote: ! WARNING:
remote: ! Do not authenticate with username and password using git.
remote: ! Run `heroku login` to update your credentials, then retry
the git command.
Can I login through a Heroku Pipeline as it describes or is there another solution?
Be sure to include actual token in the HEROKU_API_KEY env var:
$ heroku authorizations
Heroku CLI login from emily d7cefd7d-6570-40cd-b510-84158323c238 global
# this is _not_ what you need
$ heroku authorizations:info d7cefd7d-6570-40cd-b510-84158323c238
...
Token: f1a255ee-c92c-49ee-8935-c430a7ad6a53 <-- this is what you need
...
An alternative:
$ heroku authorizations --json
...
"access_token": {
"expires_in": null,
"id": "a890965c-bebd-43c7-af17-41225e92d0df",
"token": "f1a255ee-c92c-49ee-8935-c430a7ad6a53" // <-- this is what you need
},
...
I have the following release phase in my Procfile:
release: bundle exec rake db:migrate
It works great when I merge PR's into my staging and production apps, but it fails when running on a new review app. The Heroku docs say that the release phase is run after a successful build, so I don't know why it can't find bundle.
This is my output
heroku releases:output 9 --app my-app-pr-253
/bin/sh: 1: bundle: not found
For Heroku's review apps, you must specify all buildpacks and ENV vars you need in the app.json file. You can either manually create one, or have Heroku generate one for you.
https://devcenter.heroku.com/articles/github-integration-review-apps#app-json
Confirm that in your app.json you have specified
1) The required buildpacks https://devcenter.heroku.com/changelog-items/670. Since you are using bundle I'm guessing heroku/ruby will be one. Below is an example.
"buildpacks": [
{
"url": "https://github.com/heroku/heroku-buildpack-ruby.git"
},
2) Also make sure you specify any config variables that you want to inherit from the app off which your review app is being built. https://devcenter.heroku.com/articles/app-json-schema#env Missing one of these could also be causing a build to fail.
If neither of these work, try checking the logs for your heroku app. Watch the ones in the Heroku GUI during the build. Also try to tail the logs in the CLI.
heroku logs -t -a <review_app_name>
I figured out my problem. It was a silly typo:
"buildpacks": [
{
"url": "heroku/ruby",
"url": "https://github.com/guillaume-tgl/heroku-buildpack-ghostscript.git"
}
]
should have been:
"buildpacks": [
{ "url": "heroku/ruby"},
{ "url": "https://github.com/guillaume-tgl/heroku-buildpack-ghostscript.git" }
]
I am following this tutorial
https://hyperledger.github.io/composer/integrating/deploying-the-rest-server.html
I have done all the steps. But when I run rest-server through github, it prints following stack trace.
Error
404 Cannot GET /auth/github
status: 404
Error: Cannot GET /auth/github
at raiseUrlNotFoundError (/home/praval/.nvm/versions/node/v6.11.1/lib/node_modules/composer-rest-server/node_modules/loopback/server/middleware/url-not-found.js:21:17)
I presume you installed the Github strategy via npm install -g passport-github?
If so did it create a folder /auth/github?
You are required to go to this Folder per documentation: "Authenticate to the REST server by navigating to the value of the authPath property specified in the environment variable COMPOSER_PROVIDERS. In the example above, this is http://localhost:3000/auth/github"
In my case that folder was not created. I read on Github website: https://github.com/cfsghost/passport-github
"The author of Passport-Github has not maintained the original module for a long time. Features in his module don't work since Github upgraded their API to version 3.0. We forked it and re-published it to NPM with a new name passport-github2"
I'm looking for guidance on this.
Before create private api just execute this command in your terminal.
export COMPOSER_PROVIDERS='{
"github": {
"provider": "github",
"module": "passport-github",
"clientID": "<your id>",
"clientSecret": "<your secret>",
"authPath": "/auth/github",
"callbackURL": "/auth/github/callback",
"successRedirect": "http://localhost(domain of angular app):4200(port)/home(page to redirect)",
"failureRedirect": "http://localhost(domain of angular app):4200(port)/login-github(page to redirect)""
}
}'
To check if all is fine - run command
echo $COMPOSER_PROVIDERS
After this you will see your COMPOSER_PROVIDERS value.
And after in github profile app (https://github.com/settings/applications/) you must configure "Homepage URL" (ex. http://APIdomain:3000/) and "Authorization callback URL" (ex. http://APIdomain:3000/auth/github/callback)
Parse had a nice development command utility where you could read and stream logs.
Heroku has that, but it shows only Heroku logs, not Parse logs.
Is there some way to see a console.log or console.error statement now that we're all switching over to parse-server?
If you use PM2, it is really easy to see logs.
For my project, I have parse-server and parse-dashboard running on my server.
Here is the PM2 config I use for them:
{
"apps": [
{
"script": "parse-server",
"args": "config/server.json",
"log_file": "logs/server.log",
"error_file": "logs/server-error.log",
"log_date_format" : "YYYY-MM-DD HH:mm:ss Z",
"instances": 1,
"watch": true,
"ignore_watch": ["cloud", "logs"],
"env": {
"VERBOSE": "1"
}
},
{
"script": "parse-dashboard",
"args": "--config config/dashboard.json",
"log_file": "logs/dashboard.log",
"error_file": "logs/dashboard-error.log",
"log_date_format" : "YYYY-MM-DD HH:mm:ss Z",
"instances": 1,
"watch": true,
"ignore_watch": ["cloud", "logs"]
}
]
}
In my case, it is the "VERBOSE": "1" argument that allows me to see all the queries executed by parse-server.
If you want to see the logs of both parse-server and parse-dashboard, you then only have to type pm2 logs.
In my configuration, parse-server and parse-dashboard are installed globally (npm install -g parse-server and npm install -g parse-dashboard).
If you have Heroku CLI installed you can run these lines inside your project
heroku logs
for the last 100 lines or
heroku logs --tail
to show logs in real time
The latest versions of Parse dashboard have Logs page out of the box
I dont know about how you can see logs on Heroku, but i am able to see logs locally. What you need to do is when your run your application using command => node app.js then you will be able to see all console.log(""); statements in the console.
If you want you check this link . How to setup Parse on local machine.
https://www.webniraj.com/2016/01/31/parse-com-setting-up-the-open-source-parse-api-server/.
I hope this helps.Thanks
here are 2 ways, in case of selfhosted parse-server:
#1 view logs by url
create a symbolic link of your log-folder to /public/logs
add this middleware:
app.get(/^\/logs*/,(req,res,next) => {
if( req.url == '/logs/' || req.url == '/logs' )
return res.redirect('/logs/parse-server.info.'+new Date().toISOString().slice(0,10))
if( req.url.match(/parse-server\./) )
res.set('content-type','text/plain') // lets hint the browser for a logfile
next()
})
// *TODO* please run basic-auth middleware on /logs url
BOOM...now surfing to '/logs' will always redirect to the latest log-url.
You can just modify the dates to go back in time.
#2 view realtime logs
see this package https://www.npmjs.com/package/express-logio
You can use request.log.info() and request.log.error() and they will be show in the parse dashboard
Cloud Code function
Log on Parse dashboard
I trying to launch app with StrongOps on DotCloud, but information about process/app does not appear in dashboard.Locally it works fine.
API-key and APP-name passed directly in the code. Also, i try to set ENV vars (SL_APP_NAME and SL_KEY), but no result.
App name - is random string and shoudn't represent any real variable, right?
Logs. Only this
strong-agent profiling
Cluster controls unavailable.
My code
require('strong-agent').profile(KEY,APP_NAME);
My package.json
{
"name": "slovohvat",
"version": "0.0.2",
"strongAgentKey": "607dbd9b5cd4c6dd20ae05d128b63652",
"scripts": {
"start": "node app.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"express": "3.4.0",
"nunjucks": "0.1.9",
"socket.io": "0.9.16",
"bigint-node": "1.0.1",
"connect": "2.9.0",
"request":"2.27.0",
"node-logentries": "0.0.2",
"redis": "0.8.6",
"socket.io-clusterhub": "0.2.0",
"connect-redis": "1.4.x",
"async": "0.2.9",
"nodetime": ">=0.8.0",
"emailjs ":"0.3.6",
"strong-agent":"0.2.18",
"raygun": "~0.3.0"
},
"repository": "",
"author": "",
"license": "BSD"
}
And my dotcloud.yaml
www:
type: nodejs
approot: app
process: node app.js 0
config:
node_version: v0.8.x
smtp_server: smtp.XXX.org
smtp_port: 587
smtp_username: XX#XX.XX
smtp_password: XXX
data:
type: redis
strongloop.json exists at same dir as dotcloud.yaml and looks correct.
Please, give me any advice i should to try.
Thank you. And sorry for my English :)
You should create a strongloop.json by using the slc strongops command, it will write the config file after you login. It sounds like you might already have done that.
Note that if you have a stongloop.json, you should NOT provide any args to .profile(). The API arguments are a mechanism for fine-grained control, and for environments when you cannot deploy a config file.
Also, you should remove strongAgentKey from your package.json (it lets anyone on stackoverflow publish data to your account), and the env variables. It sounds like you are configuring strong-agent using all 4 mechanisms at the same time! Sorry about the confusion.
After clearing the redundant config, you should be able to run your app (node .). Login to your strongops console, and see the app after a few minutes as data starts coming in.
If that doesn't work, we will need more details. It might be easier to work through this over irc or email, check out our support page: http://strongloop.com/developers/forums/