puppetdb no route to host when installing with PuppetDB module - puppet

Trying to install PuppetDB on a separate node using PuppetDB (v5.1.2) module and I'm getting
Notice: Unable to connect to puppetdb server (https://puppetdb.example.com:8081): Connection refused - connect(2) for "puppetdb.example.com" port 8081 when running Puppet agent on Puppet Server (trying to configure the server with PuppetDB module).
Here's my site.pp
node 'puppetserver.example.com' {
class { 'puppetdb::master::config':
puppetdb_server => 'puppetdb.example.com',
}
}
node 'puppetdb.example.com' {
class { 'puppetdb::database::postgresql':
listen_addresses => '0.0.0.0',
}
class { 'puppetdb::server':
database_host => 'puppetdb.example.com',
}
}
PuppetDB is running, in jetty.ini host and ssl-host is set to 0.0.0.0. Ssl certificates are okay.
What am I doing wrong?

Could you please verify the following config files too
/etc/puppetlabs/puppet/puppetdb.conf
[main]
server_urls = https://puppetdb.example.com:8081
And
/etc/puppetlabs/puppet/routes.yaml
---
master:
facts:
terminus: puppetdb
cache: yaml
These files should have been populated by your puppetdb and should have the exact entry as above.
Another important config is your ssl setup for puppetdb ,verify it using below command .
puppetdb ssl-setup

Related

redis is working in local but not working in server

I have a redis server which is working fine in my local but in ubuntu server is not working can someone gives the comment for installing redis in server
it is not working even with docker it is working only while i am running in local
const redis=require('redis');
var redisClient:any;
(async () => {
try {
redisClient = redis.createClient({ socket: { port: 6379 } });
await redisClient.connect();
// const redisClient = redis.createClient({
// port:"6379",
// host:'redis-service'
// });
redisClient.on('connect',()=>{
console.log('server connected to redis')
})
redisClient.on('ready',()=>{
console.log('Client Connect to redis and ready to use')
})
redisClient.on('error',(err:any)=>{
console.log(err)
})
redisClient.on('end',()=>{
console.log('Server disconnected from redis')
})
process.on('SIGINT',()=>{
redisClient.quit()
})
console.log('connected');
} catch (err) {
console.error(err)
}
})()
export{
redisClient
};
Make sure that Redis is not already running on the server. You can check this by running the command ps aux | grep redis. If Redis is running, you should see a line with the redis-server process.
Confirm that Redis is properly installed on your server by running redis-cli ping. If Redis is installed and running, it should return "PONG"
Check the Redis configuration file (redis.conf) and ensure that the IP and port settings match the settings on your local machine.
Make sure that the Redis server has the necessary permissions to access its data directory and that the correct ownership and permissions are set on its files.
Verify that the firewall rules on the server allow incoming connections on the Redis port (usually 6379)
Check for any compatibility issues between the version of Redis that you're running on your local machine and the version of Redis that's running on the Ubuntu server. If there's a version mismatch, it may be necessary to upgrade or downgrade one of the installations.
Try to run the Redis server with verbose output by running the command redis-server -v, this can give you some more information about the errors that are causing the server to fail.
Look at Redis log files, usually located in /var/log/redis for further clues about the cause of the problem.

Server runs locally but crashes on Heroku

I deployed my server on Heroku but when I make any requests it returns a "500 Internal Server" error. It runs fine locally though. Could anyone help figure out what's going on?
When I check my logs this is what I'm getting.
2021-06-08T18:43:09.715406+00:00 app[web.1]: error: no pg_hba.conf entry for host "3.90.138.215", user "detmvsbueicsez", database "da9nlve42hcp91", SSL off
Repo Link: https://github.com/zcason/Restaurant-Review-Server
Live App: https://restaurant-review-phi.vercel.app/
As mentioned here on Heroku help, this indicate that there was a failed authentication attempt to the database, so the connection couldn't be established. This can happen because of different reasons.
In your case i suspect it's something related to not using ssl.
So after taking a look on the code provided in the github repo i noticed you are using knex and getting the connection string from .env
Try this :
Just add this ?ssl=true and append it to the end of DATABASE_URL in your .env file.
Edit your server.js (i didn't take a good look at the code so you need to add this ssl: { rejectUnauthorized: false } in your connection config) :
const db = knex({
client: 'pg',
connection: {
connectionString: DATABASE_URL,
ssl: { rejectUnauthorized: false }
}
});
Also make sure you're using the wright user and password and database name etc
OR Alternatively :
Run this command heroku config:set PGSSLMODE=no-verify in terminal to omit the ssl configuration object and set PGSSLMODE to no-verify

Kubernetes + consul: kv.get: connect ETIMEDOUT

I have deployed consul using hashicorp-consul-helm-chart
now, I want to connect to the consul from my Node.js project.
Therefore, I created an object like this : (using 'consul' npm package)
import consul from 'consul';
var consulObj = new consul({
host: 'xxx.xxx.xxx.xxx',
promisify: true
});
var watch = consulObj.watch({
method: consulObj.kv.get,
options: { key: 'config' },
backoffFactor: 1000,
});
I have got the host value from kubectl get endpoints
used the value opposite to consul-server
still, i get consul: kv.get: connect ETIMEDOUT when I run the code.
what could be the reason?
Thanks in advance!
You should be accessing the Consul client which is running on the node where your app is located instead of directly accessing the server.
Details can be found in the accepted answer for Hashicorp Consul, Agent/Client access.

Error starting nodejs: openssl config failed

Got the following error starting Express node:
openssl config failed: error:02001003:system library:fopen:No such
process
The node start anyway.
I am not attempting to use SSL.
Here the starting code:
...
app = Express;
app.set('port', process.env.PORT || config.port);
try {
var server = app.listen(app.get('port'), function () {
console.log('Express server listening on port ' + server.address().address + ':' + server.address().port);
});
} catch (e) {
log.fatal(e);
}
Only happens on deploy server. Running in developer machine starts ok.
The problem was that Express looks for the environment variable OPENSSL_CONF to lookup to SSL configuration file.
The variable OPENSSL_CONF was pointing to a non existence location on the drive.
I removed from the system and the message disappear.
Note: must use a new console to launch the node so environment variable OPENSSL_CONF is not present. Or simple deleted on the current console.
Additional information at github
Removing global environment variable OPENSSL_CONF (leftover from previous troubleshooting) solved my problem.
Running on Windows you might try:
Set environment in local command window and verify problem:
set OPENSSL_CONF=c:\dummy
npm -v
=> you now probably see this ssl error message
Remove environment and verify problem is gone:
set OPENSSL_CONF=
npm -v
=> no ssl error message
Source: https://github.com/npm/npm/issues/17261
Please check the System Variables and confirm if the location of openssl.cnf file listed there is correct. Cross check it and update the location in System Variables.

Grunt server not working in nitrous.io

I created a node env using nitrous.io. Inside of their terminal I installed yeoman.
If I try to run grunt server I get an error stating:
Fatal error: Unable to find local grunt.
If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:
http://gruntjs.com/getting-started
If i go to preview than connect to port 3000 i get this
The Reference states for node to change 127.0.0.1 or "localhost" to 0.0.0.0
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(3000, '0.0.0.0');
console.log('Server running at http://0.0.0.0:3000/');
Grunt syntaxes are a bit different for a server
connect: {
options: {
port: 3000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: '0.0.0.0' //
},
Even after this change the errors persist. Failing when I run grunt server or go to preview port 3000
Any ideas on what I'm doing incorrect? How do I run my grunt server so I may see my site in the broswer?
Have you gone through the advice on the first error message you got? You need both Gruntfile.js and package.json (with Grunt listed as a dependency); this is covered in the official documentation. Then, by running npm install you will be able to pull down a local Grunt to your project.
To summarize the comments this worked for me:
gem install sass; gem install compass
yo webapp
Edit Gruntfile.js around line 43:
connect: {
options: {
port: 3000, // <- changed this line
livereload: 35729,
hostname: '0.0.0.0' // <- changed this line
Run grunt server and click on the Preview-Button / Port 3000.

Resources