Grunt-SSH error: Malformed cygwin unix socket file - javascript

I am trying to set up a Grunt task to ssh into a remote server and perform some operations using grunt-ssh. I am using git bash on a windows machine. The relevant parts of my Gruntfile.js are the following:
grunt.initConfig({
sshconfig: {
portfolioServer: {
host: 'myWebsite.com',
username: 'root',
agent: process.env.SSH_AUTH_SOCK,
}
},
sshexec:{
deploy:{
command: [
'cd portfolio',
'git pull'
].join(' && ')
},
options:{
config: 'portfolioServer'
}
},
........etc.
grunt.loadNpmTasks('grunt-ssh');
My problem is that when I run my grunt deploy task, i get the following error:
Running "sshexec:deploy" (sshexec) task
Warning: Connection :: error :: Error: Malformed cygwin unix socket file Use --force to continue.
Aborted due to warnings.
If I then run using the --force flag, I get the following output:
Running "sshexec:deploy" (sshexec) task
Warning: Connection :: error :: Error: Malformed cygwin unix socket file Used --force, continuing.
Warning: Connection :: error :: Error: Authentication failure. Available authentication methods: publickey,password Used --force, continuing.
Done, but with warnings.
This seems to suggest I have either set up my SSH authentication incorrectly, or that the commands I have used to get the command line to recognize my keys are poorly formed. This confuses me a little, as I have followed the instructions here to set up SSH keys on the command line, and am able to successfully ssh into my server by typing ssh root#myWebsite.com
What is going wrong?

Related

Moralis-Server in vscode

when I type this code ( npm run moralis:sync), I run into this error:
my-app#0.1.0 moralis:sync
moralis-admin-cli connect-local-devchain --chain hardhat --moralisSubdomain cxdjddn5lxdh.usemoralis.com --frpcPath ./frp/frpc
Starting connection to Hardhat
exec error: Error: Command failed: "./frp/frpc" http -s cxdjddn5lxdh.usemoralis.com:7000 -t GCqiUSu6wG -l 8545 -d cxdjddn5lxdh.usemoralis.com
'"./frp/frpc"' is not recognized as an internal or external command,
operable program or batch file.
Hello which version of frp have you installed? Make sure your fprcPath is correct.
Two related threads:
https://forum.moralis.io/t/unable-to-connect-hardhat-local-node-to-moralis/17154
https://forum.moralis.io/t/which-frpc-file-to-download-to-connect-moralis-server-to-blockchain/17294/15
If you have more questions or issues with this, you can post on the Moralis forum: https://forum.moralis.io

How To Deploy a Node.js and MongoDB Application on Linux server

I am developing an app and I want to deploy it on a linux server. I already have copy my local files to the server . I have read this article but not so clear to me https://github.com/keystonejs/keystone/issues/4687.
things i have already done
Remote server has appropriate versions of Node.js & npm installed (ideally the same as what you have been testing with in development)
Check out (or copy) the latest version of your application source to the remote server.
Run npm install (or npm install --production if this will be a production environment) in the top-level of your application source directory.
but when i run npm start on the server it gives me error which is
Mongoose connection "error" event fired with:
{ MongoError: failed to connect to server [localhost:27017] on first connect
my settings
keystone.init({
'name': 'Test',
'brand': 'Test',
'sass': 'public',
'static': 'public',
'favicon': 'public/favicon.ico',
'auto update': true,
'views': 'templates/views',
'view engine': '.html',
'custom engine': cons.nunjucks,
'mongo': 'mongodb://localhost/test',
'auto update': true,
'emails': 'templates/email',
'session': true,
'auth': true,
'user model': 'User',
});
Do i need to configure more settings on mongo on the server?
Mongoose connection "error" event fired with: { MongoError: failed to connect to server [localhost:27017] on first connect
The above error means that your mongodb service was not started.
To enable & start the mongodb service you can run following command:
1. Enable mongodb service
sudo systemctl enable mongod.service
2. Start mongodb service
sudo service mongod start
3. Start your nodejs app
npm start

How to set up SSH Agent Forwarding in node.js (simple-ssh module)?

I am new to this node.js and using module simple-ssh for executing shell commands from my windows to remote server.
Whenever I run my code, the console curses me with [Error: Authentication failure. Available authentication methods: publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive].
I have already put an RSA private-key file, and set the Windows ENV variable SSH_AUTH_SOCK. But still it keeps giving the error.
Below is the code snippet which I wrote for simple-ssh:
var ssh = new SSH({
host: sshHost,
user: 'root',
timeout: 11000000,
key: require('fs').readFileSync("D:/Keys_pair_prvt_pub/rsa_key"),
agent: process.env.SSH_AUTH_SOCK,
agentForward: true
});
When I am trying to SSH the remote from my windows cmd-prompt, it is giving me error:
$> ssh -A <myRemote.host.com>
ssh : The term 'ssh' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
Am I missing anything? If yes, then how do I overcome this ?
Any help will be appreciated :)
Thanks.
Your key needs to be added to ~/.ssh/authorized_keys on the server for your key to work.
mscdex npm package SSH2, which simple-ssh wraps, has this in the docs for using ssh.agent on windows:
`agent - string - Path to ssh-agent's UNIX socket for ssh-agent-based user authentication. Windows users: set to 'pageant' for authenticating with Pageant or (actual) path to a cygwin "UNIX socket."

How to run openshift MEAN project in localhost or development system Ubuntu?

I have created a MEAN stack application on https://openshift.redhat.com/ and it was successfully running on the web.
Default source code of the project synced form: https://github.com/linnovate/mean-on-openshift.git
For further development I am cloning the hosted git source using using git url mentioned in the applications page. (e.g git clone ssh://55e86e9f89f5cf1d29000001#nodejs-tapslab.rhcloud.com/~/git/nodejs.git/).
After clone the source code to local system, opening the project in sublime text editor. I can see in the config/env/development.js there are lot of configuration are used like process.env.OPENSHIFT_XXX. I was changed the some config value mentioned below and trying to start server using command : 'node server', but server was not starting throwing error.
{
db: db: 'mongodb://' + (process.env.DB_PORT_27017_TCP_ADDR || 'localhost:27017') + ':' + '/mean-dev',
hostname: process.env.OPENSHIFT_NODEJS_IP || 'http://localhost:3000'
}
Can someone help me how to run Openshift mean project in local system and what all configuration needed before running it in local system.
System Config :
Ubuntu 12.04
MongoDB v2.6.6
Nodejs v0.10.40
npm 1.4.28
grunt-cli v0.1.13
Error :
$ node server
Mean app started on port 3000 (development)
events.js:72
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND
at errnoException (dns.js:37:11)
at Object.onanswer [as oncomplete] (dns.js:124:16)
Git:
$ NODE_ENV=test node server

GruntFile automated deployment using ssh (Windows)

I am trying to set up a GruntFile.js file to automate the process of logging on to my personal website's server via ssh and pulling the latest version of the git repo. The relevant part of my grunt file looks like this:
sshconfig: {
portfolioServer: {
host: 'mySite.com',
username: 'root',
agent: process.env.SSH_AUTH_SOCK,
}
},
sshexec:{
deploy:{
command: [
'cd portfolio',
'git pull'
].join(' && ')
},
options:{
config: 'portfolioServer'
}
},
However, when I run the associated task (I named it "grunt deploy"). I get the following error.
Running "sshexec:deploy" (sshexec) task
Warning: Connection :: error :: Error: Authentication failure. Available authentication methods: publickey,password Use --force to continue.
Aborted due to warnings.
My understanding is that this error means that I have not set up the public/private ssh keys correctly. However, I have already gone through the process of setting up public/private keys.I am already able to run the following command through git bash and log in successfully:
ssh root#mySite.com
I have searched online for this problem and it seems like it might have something to do with process.env.SSH_AUTH_SOCK not behaving in git bash on windows in the same way that it might be expected to be have in a native linux distribution.
What further steps in my setup do I have to take in order to make this deployment configuration work?

Categories

Resources