I'm using PM2 to deploy my apps, so far it worked great, however now that I have sensitive API credentials I made my repos private and now I'm unable to deploy via PM2. I have ssh set up and can successfully connect to github via
ssh git#github.com
Here is my ecosystem.json file used for deployment (which works when in public mode):
"deploy" : {
"production" : {
"key" : "../.ssh/id_rsa.pem",
"user" : "root",
"host" : "xxx.xxx.xxx.xx",
"ref" : "origin/master",
"repo" : "git#github.com/AndreasGalster/productnews-graphql.git,
"path" : "/var/www/production",
"post-deploy" : "yarn install && pm2 startOrRestart ecosystem.json --env production"
}
}
Is it not possible to deploy a private repository? If so, how should I do it? I always get "could not read Username for 'https://github.com': No such device or address" Any ideas what I could do?
Related
I am trying to create a pipeline in Azure DevOps for my Nightwatch-Cucumber project. I have everything set, and when I run the tests locally everything is working fine, but when I run the tests in Azure DevOps I get an error. This is the error from the log that I get.
This are the tasks that I added
Can anyone help me with this error and how to make it work
Error connecting to localhost on port 4445
The possible cause of this issue is that port 4445 of the machine where the agent is located is not open.
Based on the error log, it seems that you are using the Microsoft-hosted agent(ubuntu agent).
You could try the following two methods:
1.You can try to change the connection port to 80. Based on my test, the port 80 is opened by default.
Here is an example:
nightwatch.json:
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_port" : 80,
"selenium_host" : "hub.testingbot.com",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : ""
},
"skip_testcases_on_fail": false,
"desiredCapabilities": {
"javascriptEnabled": true,
"acceptSslCerts": true
}
},
2.Since this project could work fine on your local machine, the configuration should be correct on your local machine. So you could try to create a Self-hosted agent.
Then you could run the pipeline on your local machine.
I made it work. I switched to Ubuntu agent and installed chrome latest version and latest jdk. Also I had wrong chromedriver version installed, changed that in package.json file. Now its working fine. Thanks all for your answers.
I'm trying to build a docker image for centos:7 that restricts system commands which any user (including root) can execute inside a docker machine. My intention is that I want to build an docker image with security profile that I need and then use that as my base image to build other application images thereby inheriting security profile from the base image. Is this doable? Am I missing something?
Here is a sample security profile I'm testing:
{
"defaultAction" : "SCMP_ACT_ALLOW",
"syscalls": [
{
"name": "mkdir",
"action": "SCMP_ACT_ERRNO"
},
{
"name": "chown",
"action":"SCMP_ACT_ERRNO"
}
]
}
When i run:
docker build -t test . --security-opt seccomp:policy.json
It throws an error :
Error response from daemon: The daemon on this platform does not support setting security options on build
Thoughts on how to get past this or other approaches I could use?
From Github...
"Docker engine does not support the parameter "--security-opt seccomp=" when executing command "docker build"
#cason you can supply a custom default profile to the daemon.
`--secomp-profile /path/to/profile.json'
https://github.com/moby/moby/issues/34454#issuecomment-321135510
I am trying to deploy ElasticSearch on Azure Cloud. Installed the Elastic template from Azure Marketplace and able to access in kibana by hitting this url http://ipaddress:5601 with user id and password given at the time of creation.
Also able to access elastic search http://ipaddress:9200/ and getting below configuration
{
"name" : "myesclient-1",
"cluster_name" : "myes",
"cluster_uuid" : "........",
"version" : {
"number" : "6.2.4",
"build_hash" : "ccec39f",
"build_date" : "",
"build_snapshot" : false,
"lucene_version" : "7.2.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
Now i am facing problem in,
On which VM runs logstash?
How to start logstash?
Where to store the config files and jdbc config file and how to run BAT file periodically. Bat file syntax for normal VM is like
Run
cd C:\logstash\logstash-6.2.2\bin
logstash -f C:\Users\basudeb\Desktop\config\jdbc.config
pause
The Elastic Azure ARM template does not currently deploy Logstash, only Elasticsearch and Kibana. There's an open issue to track this. If you feel it would be useful, please +1 the issue :)
When I run pm2 deploy development setup I get the following error. Which is strange because this key has no password set.
Enter passphrase for key '/Users/spongebob/.ssh/dev.pub':
Permission denied (publickey,keyboard-interactive).
setup paths failed
Deploy failed
I have created a key pair with no password, and trasnfered it to my development machine like so:
ssh-copy-id -i ~/.ssh/virtualbox_dev -o "IdentityFile /Users/spongebob/.ssh/dev" -f dev#192.168.0.17
I can log into SSH fine with no password:
ssh -o 'IdentityFile /Users/spongebob/.ssh/dev' 'dev#192.168.0.17'
Last login: Sun May 27 12:39:57 2018 from 192.168.0.11
I have added this key as a deployment key to Github as this is a private repo (and also added the virtualbox_dev key just incase). And tested whether it works ...
Hi MyUsername/blue-mask-api! You've successfully authenticated, but GitHub does not provideshell access.
And here is my deployment configuration (I have this in package.json):
"deploy": {
"development": {
"key": "/Users/spongebob/.ssh/dev.pub",
"user": "dev",
"host": "192.168.0.17",
"ref": "origin/master",
"path": "/home/dev/",
"repo": "git#github.com:MyUsername/blue-mask-api.git",
"post-deploy": "echo 999999999999",
"ssh_options": [
"StrictHostKeyChecking=no",
"PasswordAuthentication=no"
]
}
It's confusing because it's asking for a password and there isn't one set. And when I leave it blank I still get permission denied.
Enter passphrase for key '/Users/spongebob/.ssh/dev.pub':
It appears that you're trying to use the wrong key file. The file with the ".pub" extension is the public key file. The corresponding file without the ".pub" extension is the private key file. When you run an ssh client to connect to a remote server, you have to provide the private key file to the ssh client. The contents of the public key file are stored on the server (github in this case), where it's used by the ssh server software to confirm that this key can be accepted for authentication.
You ought to have a private key file with the same name as the public file, except without the ".pub" extension:
"development": {
"key": "/Users/spongebob/.ssh/dev",
^^^--note no .pub
I'm developing a large scale system (MEAN Stack + ElasticSearch + RabbitMQ),
There are many different nodejs projects and queues working together.
I a few questions.
When I want run and test the whole system, I have to open a lot of terminal windows to run each project. How do I run them at once with ease of monitoring.
When I want to run the same project on multiple machine, How can I easily config all of them because sometime it takes too much time to move around and config them one bye one.
How to config, run, monitor and manage the whole system easily. For example, I want to know how many machine is running a project. Or sometime I want to change message queue name or ip address at once, I don't want to go to every machine on both project to change them one bye one
Sorry for my bad gramma, Feel free the edit.
Thanks in advance.
Have a look at PM2.
I'm using it for developement and in production
With this tool you can define a simple JSON file that defines your environment.
pm2_services.json
[{
"name" : "WORKER",
"script" : "worker.js",
"instances" : "3",
"port" : 3002,
"node-args" : "A_CONFIG_KEY"
}, {
"name" : "BACKEND",
"script" : "backend.js",
"instances" : "3",
"port" : 3000,
"node-args" : "A_CONFIG_KEY"
}, {
"name" : "FRONTEND",
"script" : "frontend.js",
"instances" : "3",
"port" : 3001,
"node-args" : "A_CONFIG_KEY"
}]
Then run pm2 start pm2_services.json
Relevant commands:
pm2 logs show the logs of all services
pm2 ls show the running
pm2 monit show the current cpu and memory state
pm2 start FRONTEND to start a service
pm2 stop FRONTEND to stop a service
NOTE:
Be careful with the watch feature of PM2.
In my case my CPU jumps up to permanent 100%.
To watch many file for change i use node-dev.
And here's the solution ti use it with PM2
[{
"name" : "WORKER",
"script" : "worker.js",
"instances" : 1,
"watch" : false,
"exec_interpreter" : "node-dev",
"exec_mode" : "fork_mode"
}]
You could write a Node project which launches all the other ones with appropriate arguments using child_process.
You could consider a tool like Puppet or Chef.
Same as #2.