Node.js - traceroute equivalent - javascript

I have a situation where, for the last 4 months, I've been running deployments via Codeship to MediaTemple Wordpress Managed Hosting for 10 different sites.
Then, out of no where, I started receiving this error for all deployments:
ssh_exchange_identification: read: Connection reset by peer
In troublehsooting, I hit a brick wall from MediaTemple as they want to run a traceroute from Codeship to hit the MediaTemple hosting server before they'll look into anything else. Only problem is, traceroute is not installed on Codeship. Neither is MTR.
My deployment is extremely basic. Runs with GIT over SSH.
git config --global user.name "username"
git config --global user.email user#email.com
git remote add production user#server.name:reponame.git
git push production master
I'm looking for any way to run a traceroute equivalent via node or Javascript. I've been a few npm wrappers for traceroute, but if native traceroute is a dependency, that doesn't do me any good.

There is a Node script called sloppy traceroute clone by Liam Griffiths. I haven't used it myself but it is supposed to do what traceroute does but all in JavaScript.
It needs raw-socket and dns modules from npm.
Keep in mind that it may still not work on Codeship due to permissions and network configuration.

Related

How to deploy Laravel + Nuxt application?

I have built Web application using Laravel As API and Nuxt As Front and. These 2 built desperately. When the development ongoing Its isn't an issue. Because i can run them using their own development servers. Then i have bought a VPS server for host this. Now the question in how i deploy these two apps on my VPS. Specially How i can deploy nuxt app correctly in vps. Its not static side. It is ssr app.
Essentially, you are going to need a few things:
A server (which you already have)
nginx
PM2
Node/NPM installed
The tricky part of this, is to make sure the server continues running and auto-restarts in case of a crash. PM2 solves that issue, and you can read more information on how to use it here: https://nuxtjs.org/docs/2.x/deployment/deployment-pm2
You can install it by:
npm install -g pm2
Which will install PM2 globally on your server and you'll have access to the pm2 command.
Follow the documentation above, and all you gotta do is run:
pm2 start all
This will start the Nuxt service and it will run on whichever port you've defined on your nuxt.config.js or package.json files.
Now that you've got your Nuxt instance running, you need to make sure that requests that come through the browser end up on the port that Nuxt is running on, that's achievable by using nginx's reverse proxy feature that you can read more about:
https://nuxtjs.org/docs/2.x/deployment/nginx-proxy/
That documentation provides you with an example of an nginx config file, and you shouldn't really have to change anything other than the server_name, and the proxy_pass in case you've changed the default Nuxt port from 3000 to something else.
Additionally make sure that you have allowed port 80 to be listen on your server.

How to deploy angular 7 project directly to my webserver, so that i shouldn't migrate my dist folder always after deployment?

Currently, I am deploying my Angular 7 Project by using FileZilla to migrate my local files from ./dist folder to server public_HTMl. This is a quite tides job to carry in a daily basis, so I want to deploy my code directly to the server, when I hit ng build --prod then those compiled files have to be migrated directly to the server. Do anybody here who can help me to solve this problem?
To get rid of this problem I have tried lots of steps:
I was using bitbucket pipelines to execute my code, it came to be costly and I cannot run it as well, It took several hours but cannot give output for me.
I also tried by using new Git Repository even it's a good way but cannot give me the solution because when I deploy my code locally it creates a new folder every time while I execute a command.
So, I want to get help and deploy this code directly to the server that is going to host my application. Thank you all and hope all of you provide me good tips regarding this problem.
You can do it in the simple way. Create basic bash/sh script or windows executable and use rsync to do this automatically:
deploy.sh:
#!/bin/bash
ng build --prod
rsync -arvt ./dist remoteuser#remotehost:/var/www/remotedirectory
To avoid entering login and password every time add RSA public key to your remote machine(trusted host). You can combine this solution with Bitbucket pipelines, when the free plan ends I run this script manually from my developer machine.
bitbucket-pipelines.yml:
image: mycustomimage:latest
pipelines:
default:
- step:
name: Build and deploy to production
caches:
- node
deployment: production
script:
- npm install
- npm install -g #angular/cli
- ng config -g cli.warnings.versionMismatch false
- ./deploy.sh
Instead of a simple script you can use some more complex solution like Capistrano, Shipit or some other more advanced tool. All depends on your needs...
The simplest solution is always the best :)

How should I handle package-lock.json when I deploy from git via ssh?

I have a deployment process where I check code into a git repository, and via web hooks a deployment script is run on the production server. On that server, I connect to git using ssh and a .pem key, pull from git, npm install, build webpack and restart the service process.
I never intend to commit anything from the prod servers - they should be able to deploy automatically. However, this does not work, because the package-lock.json file is frequently updated when I run npm install, and so the next time I deploy, the git pull step fails, saying that I conflict with existing package-lock.json file because it has changes that are not committed.
My current solution is to .gitignore the package-lock.json file. But that defeats its purpose, to provide builds that are identical to the ones on my dev machine.
What would be the right way to handle package-lock.json?
There's a helpful StackOverflow Question/Answer about why your package.lock is changing. The closest most useful answer seems to reference an NPM bug that's seeing much activity here in October 2017.
But currently, package.json overrides package-lock.json, meaning if you use ~2.1 and there's a 2.2 version of that package, your production deploy will get upgraded.
Assuming you're not from the future, there's two different ideas here:
Use only non-prefixed, specific version numbers (2.1 vs ~2.0) in your package.json. (This is not great)
npm install --no-save... which doesn't solve the underlaying issue of lock files getting ignored, but I think will keep the package-lock.json from being updated.

How can I use nodemon without using npm install

My network doesn't allowed using npm install.
How can I install and use nodemon? Node run only after set PATH variables on windows I tried set the path for nodemon, but I dont have results.
The easiest way to install an npm package is going to be to either tunnel out of your network with a proxy, or to simply install the package while you're on a different network. The reason it's not as simple to just download it is that npm packages have a list of dependencies that need to be installed along with it. Npm takes care of installing the dependency graph for you. If you try to install it manually you would have to manually go over nodemon's package.json file and install all of its dependencies. That might not be so bad until you realize that you then have to go through all those dependencies and install their dependencies, and so on...
I'm not at all affiliated with IPVanish but I recently signed up for their service for the same reason as you. My computer has a VPN configured that connects to an IPVanish server and then my computer tunnels all internet traffic through that VPN. It's nice for simple anonymous web browsing, but more importantly there is no way for network admins here to see where any of my traffic is going. To them it appears that I'm just talking to a random server. They'd have to block every single IPVanish server (and there's a lot!).
There are other alternatives but that one had good reviews and it's only $10 a month. I haven't tried any others but I'm sure they're just as good.
If tunneling out of your network or installing the module on a different network isn't an option, I'm happy to install it myself and upload a zip of the completed install to Google Drive so you can just extract it to the global npm folder. However, that would obviously not be a permanent solution for you and even though I have good intentions, you don't know me and I don't recommend downloading random stuff off of a stranger's Google Drive.
I recommend getting a friend to do the following from another network:
Install nodemon: npm install -g nodemon
Find where global npm modules install to: npm config get prefix
Navigate to the global npm module path, find the nodemon directory, and zip it up.
Email/Dropbox you the archived module.
On your machine figure out where global npm modules install to: npm config get prefix
Extract the nodemon zip to that location.

Bootstrap: Can't get grunt to run the server

I downloaded the source code from getbootstrap.com and ran npm install, then grunt connect without any luck.
I see this in my terminal:
Running "connect:server" (connect) task
Started connect web server on 0.0.0.0:3000
But when I navigate over, all I see is this:
What have I missed? I feel I've missed something basic here but unsure why I'm not seeing anything at all?
In the Internet Protocol version 4 the address 0.0.0.0 is a non-routable meta-address used to designate an invalid, unknown or non applicable target.
Unfortunately,bootstrap doc is not build in grunt, you need to install Jekyll to run the web local.so you need install ruby first,and install gem second,then install jekyll,finally,use
jekyll serve
to run the local server.
watch the guide

Categories

Resources