Problem with node.js and Redis-server? - node.js

I intended to implement a chat feature in my rails application. After a brief backup work I found JUGGERNAUT is the best option. By going to through http://juggernaut.rubyforge.org/
I have successfully implemented the juggernaut in my application.
Presently I'm all set to implement chat feature and after a vigorous surfing over web I couldn't get good tutorial to implement it but I found the some part of implementation at http://www.golygon.com/2010/12/private-chat-room-in-ruby-on-rails-3-0/. I decided to follow it but initially to implement the tutorial we need to have redis server and node.js in our system. I installed both in my environment.
But I'm facing the following problem as follows:
If I try
redis-server, I'm getting the following error
[11440] 08 Aug 10:08:16 # Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf'
[11440] 08 Aug 10:08:16 # Opening port: bind: Address already in use
and as per the tutorial
if I try
sudo node server.js, I'm getting the following error
[sudo] password for re5:
node.js:63
throw e;
^
Error: ENOENT, No such file or directory '/home/re5/Documents/task17/server.js'
at Object.openSync (fs:153:18)
at Object.readFileSync (fs:94:15)
at Module._loadScriptSync (node.js:468:39)
at Module.loadSync (node.js:338:12)
at Object.runMain (node.js:522:24)
at Array.<anonymous> (node.js:756:12)
at EventEmitter._tickCallback (node.js:55:22)
at node.js:773:9
As I don't know much about the redis and node I'm unable to figure out what was the problem regarding to this errors.
I'm stuck and couldn't go further as I'm not sure whether this two are configured perfectly or not.
currently I'm using rails 3.0.7 and ruby 1.8.7
Can any one help me out.

Well your first error is quite simple to understand.
[11440] 08 Aug 10:08:16 # Opening port: bind: Address already in use
This means that there is aready a server bound to that port and using it as a server, this can happen if you have other applications/servers running or if you try to have mutiple instances of the server run at one time. To fix this you need to stop the process and then start it back up again. You can usually do this by closing all of your terminal windows or using your operating systems process manager to terminate the process, if those methods dont work for you try shutting your computer down and starting it back up. If you are still unable to start the Redis server after this then there are some more steps we can take.
The next error is due to node.js not being able to find a file that it needs. Reinstalling node.js should fix this problem for you.
Let me know if this fixes your problem or if you need more help.

Related

django.db.utils.DatabaseError: Error while trying to retrieve text for error ORA-01804

Q1. What versions are we using?
Ans.
Python 3.6.12
OS : CentOS 7 64-bit
DB : Oracle 18c
Django 2.2
cx_Oracle : 8.1.0
Q2. Describe the problem
Ans. While running server with "python3 manage.py runserver"
application is able to contact Oracle DB and show the Django Administration page and login also works.
But when we access the application using the Apache (HTTPD) based URL over secure SSL port, we do see the Django page and the admin page as well but Login to Admin page with Internal server error.
In the logs, we see
"django.db.utils.DatabaseError: Error while trying to retrieve text for error ORA-01804"
cx_oracle is otherwise able to connect to the database properly, another application is also using the same database behind the same httpd proxy and works fine
Q3. Show the directory listing where your Oracle Client libraries are installed (e.g. the Instant Client directory). Is it 64-bit or 32-bit?
Ans. 64-bit
Q4. Show what the PATH environment variable (on Windows) or LD_LIBRARY_PATH (on Linux) is set to?
LD_LIBRARY_PATH=/srv/vol/db/oracle/product/18.0.0/dbhome_1/lib:/lib:/usr/lib
PATH=$ORACLE_HOME/bin:/srv/vol/db/oracle/product/18.0.0/dbhome_1/lib:$PATH
Q5. Show any Oracle environment variables set (e.g. ORACLE_HOME, ORACLE_BASE).
ORACLE_HOME=/srv/vol/db/oracle/product/18.0.0/dbhome_1
TNS_ADMIN=$ORACLE_HOME/network/admin
NLS_LANG=AMERICAN_AMERICA.AL32UTF8
ORACLE_BASE=/srv/vol/db/oracle
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/lib
Any suggestions/help is highly appreciated.
Thank you
I found the problem
So I just removed all the variable declarations from /etc/sysconfig/httpd and checked, the application was still able to access the lib files, so these were now redundant.
Then undid all variable declarations done earlier in .localsh and .localrc files for the os users. To start from scratch, and go step by step to see where it breaks.
So now, cx_Oracle was looking for the lib files in wrong directory
$ORACLE_HOME/client_1/lib
instead of
$ORACLE_HOME/lib
DPI-1047: Cannot locate a 64-bit Oracle Client library: "$ORACLE_HOME/client_1/lib/libclntsh.so: cannot open shared object file: No such file or directory". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help
I did not have any subfolder named "client_1" inside dbhome_1
so I just created a symlink client_1 that points to dbhome_1 (still unsure on this, but at least it works :) )
So, now, this error was gone but now again ORA-01804 was coming. πŸ˜‘
I had read somewhere that this error can be fixed by adding "libociei.so" but I did not have one on my instance, so I generated it using these commands:-
mkdir -p $ORACLE_HOME/rdbms/install/instantclient/light
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk igenliboci
Then I just moved this libociei.so file from
$ORACLE_HOME/instantclient to $ORACLE_HOME/lib
Now there was a new error (so.. progress πŸ˜‰ ):
ORA-12546 - TNS Permission Denied.
This was easy to solve πŸ˜€
I used this command to address this :-
setsebool -P httpd_can_network_connect on
And...... That was all! It worked.

Launch fails after meteor build

I am creating a build from meteor source in a docker container.
It worked well so far (since last creation 1 or 2 weeks ago) but today an exception raises !
at /home/meteor/build/bundle/programs/server/boot.js:462:11
at /home/meteor/build/bundle/programs/server/boot.js:423:13
at Function.run (/home/meteor/build/bundle/programs/server/profile.js:510:12)
at /home/meteor/build/bundle/programs/server/boot.js:464:5
at Function.time (/home/meteor/build/bundle/programs/server/profile.js:309:28)
TypeError: Object.getOwnPropertyDescriptors is not a function
at insert (packages/mongo/collection.js:435:12)
at packages/autoupdate.js:189:3
at updateVersions (packages/autoupdate.js:125:20)
throw(ex);
/home/meteor/build/bundle/programs/server/node_modules/fibers/future.js:280
NB : log may be not ordered as I use ELK stack to handle it
What happened ? And what to do to solve it ?
FYI: the application works well locally (not builded)
Node 6 is currently default in alpine, that was the issue. I switch to node image which is safer (but bigger).

Application with wrong code even after a git force push

I am under the impression that my application on Bluemix is running an older (wrong) version of the code. I have made several updates and now the application doesn't deploy nor will it start. When I check the log files, I see some errors due to Express middleware changes that are no longer supported and should be replaced by external components, for example, replace bodyParser with body-parser. I have made all these changes replacing express.middlewarename with the new components according to this page: https://github.com/senchalabs/connect#middleware
However, I am still getting error messages in the log file when I try to deploy the application. The message is:
throw new Error('Most middleware (like ' + name + ') is no longer bundled with
Express and must be installed separately. Please see
https://github.com/senchalabs/connect#middleware.');
2017/4/5 午後2ζ™‚42εˆ†48η§’ ERR APP at Function.Object.defineProperty.get
(/home/vcap/app/node_modules/express/lib/express.js:107:13)
2017/4/5 午後2ζ™‚42εˆ†48η§’ ERR APP at Module._compile (module.js:409:26)
2017/4/5 午後2ζ™‚42εˆ†48η§’ ERR APP at Object.Module._extensions..js (module.js:416:10)
2017/4/5 午後2ζ™‚42εˆ†48η§’ ERR APP at Module.load (module.js:343:32)
I am able to run the application on my machine. If I download the code from the compile pipeline, it seems fine. However, I see some errors, which point to a line of code that is a comment or a blank line in my files.
All of these issues leads me to believe that Bluemix is trying to deploy a wrong version of code.
Does anyone know how can I fix it?
Thank you in advance.
First you have make sure your all node process is killed.
On linux you can check using : ps aux|grep node.
After that rebuild your npm. using "npm build" command.
Start you server it will work.
You can do a couple of things
1. Add a git commit tag as apart of your end point. Maven and other build tools have this capability and it good practice especially for micro service architectures. Spring has one and I would be surprised if node didn't have something similar. This is what I found with a brief search. [1]
2. Trying doing a cf d ${app_name} then re-push your app.
3. If you're using a manifest file or using the cf p command make sure you specify the path to the application being deployed. There are some other nuances with node on CF but you can also assign start scripts to the build pack when the app is being deployed.
I hope this helps.
[1] https://github.com/ktoso/maven-git-commit-id-plugin/

OpenMPI: ORTE was unable to reliably start one or more daemons

I've been at it for days but could not solve my problem.
I am running:
mpiexec -hostfile ~/machines -nolocal -pernode mkdir -p $dstpath where $dstpath points to current directory and "machines" is a file containing:
node01
node02
node03
node04
This is the error output:
Failed to parse XML input with the minimalistic parser. If it was not
generated by hwloc, try enabling full XML support with libxml2.
[node01:06177] [[6421,0],0] ORTE_ERROR_LOG: Error in file base/plm_base_launch_support.c at line 891
--------------------------------------------------------------------------
ORTE was unable to reliably start one or more daemons.
This usually is caused by:
* not finding the required libraries and/or binaries on
one or more nodes. Please check your PATH and LD_LIBRARY_PATH
settings, or configure OMPI with --enable-orterun-prefix-by-default
* lack of authority to execute on one or more specified nodes.
Please verify your allocation and authorities.
* the inability to write startup files into /tmp (--tmpdir/orte_tmpdir_base).
Please check with your sys admin to determine the correct location to use.
* compilation of the orted with dynamic libraries when static are required
(e.g., on Cray). Please check your configure cmd line and consider using
one of the contrib/platform definitions for your system type.
* an inability to create a connection back to mpirun due to a
lack of common network interfaces and/or no route found between
them. Please check network connectivity (including firewalls
and network routing requirements).
--------------------------------------------------------------------------
[node01:06177] 1 more process has sent help message help-errmgr-base.txt / failed-daemon-launch
[node01:06177] Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages
Failed to parse XML input with the minimalistic parser. If it was not
generated by hwloc, try enabling full XML support with libxml2.
[node01:06181] [[6417,0],0] ORTE_ERROR_LOG: Error in file base/plm_base_launch_support.c at line 891
I have 4 machines, node01 to node04. In order to log into these 4 nodes, I have to first log in to node00. I am trying to run some distributed graph functions. The graph software is installed in node01 and is supposed to be synchronised to the other nodes using mpiexec.
What I've done:
Made sure all passwordless login are setup, every machine can ssh to any other machine with no issues.
Have a hostfile in the home directory.
echo $PATH gives /home/myhome/bin:/home/myhome/.local/bin:/usr/include/openmpi:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
echo $LD_LIBRARY_PATH gives
/usr/lib/openmpi/lib
This has previously worked before, but it just suddenly started giving these errors. I got my administrator to install fresh machines but it still gave such errors. I've tried doing it one node at a time but it gave the same errors. I'm not entirely familiar with command line at all so please give me some suggestions. I've tried reinstalling OpenMPI from source and from sudo apt-get install openmpi-bin. I'm on Ubuntu 16.04 LTS.
You should focus on fixing:
Failed to parse XML input with the minimalistic parser. If it was not
generated by hwloc, try enabling full XML support with libxml2.
[node01:06177] [[6421,0],0] ORTE_ERROR_LOG: Error in file base/plm_base_launch_support.c at line 891

Error: EPERM, operation not permitted with Node.js and Etherpad Lite

I'm attempting to get an Etherpad Lite site up and running with IIS on my computer before I upload it to Azure for Web Sites, but I get this error when I try (http://pastebin.com/4rZWbqix):
iisnode encountered an error when processing the request. HRESULT: 0x2
HTTP status: 500 HTTP reason: Internal Server Error
You are receiving this HTTP 200 response because
system.webServer/iisnode/#devErrorsEnabled configuration setting is
'true'.
In addition to the log of stdout and stderr of the node.exe process,
consider using debugging and ETW traces to further diagnose the
problem.
The last 64k of the output generated by the node.exe process to stdout
and stderr is shown below: fs.js:520 return
binding.lstat(pathModule._makeLong(path));
^ Error: EPERM, operation not permitted 'C:\Users\Matthew'
at Object.fs.lstatSync (fs.js:520:18)
at Object.realpathSync (fs.js:1047:21)
at tryFile (module.js:142:15)
at Function.Module._findPath (module.js:181:18)
at Function.Module._resolveFilename (module.js:336:25)
at Function.Module._load (module.js:280:25)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
There is no fs.js file in Etherpad's directory, so I would assume that it's some part of Node.js that's having a problem. I'm new to Node.js, so any help would be appreciated.
EDIT 1: I'm currently looking into alternatives to Azure, and granting permissions to C:\Users\Matthew. But would it be possible to somehow modify fs.js to put a try/catch around binding.lstat?
EDIT 2: After playing around with it a little (adding the permissions worked!), I've gotten it to work. But now loading 127.0.0.1:81 returns:
iisnode encountered an error when processing the request. HRESULT: 0x2
HTTP status: 500 HTTP reason: Internal Server Error
You are receiving this HTTP 200 response because
system.webServer/iisnode/#devErrorsEnabled configuration setting is
'true'.
In addition to the log of stdout and stderr of the node.exe process,
consider using debugging and ETW traces to further diagnose the
problem.
The last 64k of the output generated by the node.exe process to stdout
and stderr is shown below:
[x1B][33m[2012-10-03 20:28:13.587] [WARN]
console - [x1B][39mNo settings file found. Continuing using defaults!
[x1B][32m[2012-10-03 20:28:14.338] [INFO] console - [x1B][39mInstalled
plugins:
It would seem like this isn't an error, since what's outputted is what's expected, but it seems to stop at plugins.formatPlugins().
Make sure the user identity associated with the IIS application pool running your node.js application has appropriate filesystem permissions to the location where you deployed your application (looks like c:\users\matthew in this case).
If you are running your app within the Default App Pool and using default IIS user, you should be able to grant necessary permissions with:
%systemdrive%\windows\system32\icacls.exe c:\users\matthew /grant IIS_IUSRS:(OI)(CI)F
Case
Error: EPERM, operation not permitted 'C:\Users\Matthew'
This error occour because the user IIS_IUSRS, does not have access to this folder C:\Users\Matthew
Resolution
You can put your application on a 'public folder', example: 'C:\Test\[yourapplication]' and gives access to user IIS_IUSRS only to this folder.
It is about permission on the folder 'C:\Users\Matthew'. Take ownership and give modify permissions.
I had the same issue, and when I tried to use the latest node version via
nvm use [some node version 10.12.0 in my case] it output that it succeed but when I run node -v it showed to me that actually I'm on a node of 8.
I solved that by login as second windows user (although they both admins and node installed on C:/) and there I use the nvm use 10.12.0 to replace the node version, and when I back login with current user it worked.
I wouldn't recommend Azure for hosting Etherpad Lite, we don't optimize for Microsoft's services, this includes Microsoft Windows. If it's an option please use linux to host your node instances, you will be much happier in my experience.

Resources