Firefox hangs after opening Karma Server URL in Docker - javascript

Context
I have always been running my Karma tests locally in PhantomJS, Google Chrome and Firefox without any problems. Currently, I'm looking to run the Karma tests in Docker and have been having problems with running the Karma tests in Firefox inside a Docker container although the Docker container can run the Karma tests in Google Chrome without any problems.
Problem
When I created a Docker container that contains Google Chrome, Firefox, JS libraries (node, npm, grunt ... etc), and VNC utilities (Xvfb, x11vnc). I started the VNC server and ran the tests. Firefox was started and the socket was created with a unique ID. When I entered a VNC session, I could see that firefox was started, the URL was loaded to the URL bar, and the Karma page was loaded. However, after about 2 seconds, the webpage would freeze and the Firefox is hanged. Therefore I could not see LOG: 'INFO[2015-10-16 20:19:15]: Router Started' message as well.
Interesting Find while Reproducing this Manually
I've tired commenting the lines that starts Firefox, so that will only start the karma server when I run the Karma tests. I then tried to run the tests with the following 2 methods -
Start a Bash session through docker exec -it <container_tag>, execute firefox, and typed the server url with the corresponding ID of the test run. Firefox didn't hang in this case and proceeded to start the test run.
Start a Bash session through docker exec -it <container_tag>, execute firefox <server_url_with_coresponding_id>. Firefox didn't hang in this case and proceeded to start the test run.
My DockerFile
FROM ubuntu:14.04
#========================
# Environment Variables for Configuration
#========================
ENV GEOMETRY 1920x1080x24
ENV DISPLAY :0
#========================
# Install Required Packages
#========================
RUN apt-get update -qq && apt-get install -qqy wget \
wget \
firefox \
xvfb \
x11vnc \
nodejs \
npm
#========================
# Install Google Chrome (Latest Stable Version)
#========================
RUN \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
apt-get update -qq && \
apt-get install -qqy google-chrome-stable
#========================
# Clean up Apt
#========================
RUN \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
#========================
# Setup VNC Server
#========================
RUN \
mkdir -p ~/.vnc && \
x11vnc -storepasswd 1234 ~/.vnc/passwd
#========================
# Symlink NodeJS
#========================
RUN ln -s /usr/bin/nodejs /usr/bin/node
#========================
# Install Grunt and Grunt-CLI
#========================
RUN \
npm install -g grunt && \
npm install -g grunt-cli
#========================
# Setup Entry Point
#========================
COPY entry_point.sh /opt/bin/entry_point.sh
RUN chmod +x /opt/bin/entry_point.sh
ENTRYPOINT ["/opt/bin/entry_point.sh"]
I believe that this is a problem relating to the karma-firefox-launcher or karma main library. If anyone can give me some pointers and ideas, that would be great!

I have already submitted PR to karma-firefox-launcher https://github.com/karma-runner/karma-firefox-launcher/pull/45.
This is just for others which might have fall into this.
Firefox has issue with having profile folder on VirtualBox shared folders see https://bugzilla.mozilla.org/show_bug.cgi?id=801274 which is used with Docker setup. Trick is to specify profile folder outside of shared folder like so:
in karma.conf.js:
browsers: [ 'FirefoxDocker' ],
browserNoActivityTimeout: 30000, // < might be necessary for slow machines
customLaunchers: {
FirefoxDocker: {
base: 'Firefox',
profile: '/tmp/firefox' // < location is up to you but make sure folder exists
}
},
Remember to update to version v0.1.7 to make this work.

Related

Dockerize a simple Vanilla Javascript Application

I have a simple javascript application index.html, index.css, a folder called photos and index.js. I don't have any node modules or config file.
I am trying to dockerize by app by creating a dockerfile and docker-build.sh file. I have searched online, but i keep seeing dockerfiles with nodejs examples. Any guide on how I can dockerize a simple vanilla js app?
Here's what I have, but it currently gets stock at Attaching to display-ui
dockerfile
# pull a nginx image
FROM nginx:alpine
ARG UID=101
RUN apk update \
&& apk upgrade \
&& apk add bash \
&& apk add jq \
&& rm -rf /var/cache/apk/*
# Set working directory to nginx asset directory
WORKDIR /usr/share/nginx/html
# Remove default nginx static assets
RUN rm -rf ./*
# Copy assets over so Nginx can properly serve
COPY apps/explorer.css .
COPY apps/explorer.js .
COPY apps/index.html .
RUN chown -R nginx:nginx /usr/share/nginx/html
# implement changes required to run NGINX as an unprivileged user
RUN sed -i 's,listen 80;,listen 8080;,' /etc/nginx/conf.d/default.conf \
&& sed -i '/user nginx;/d' /etc/nginx/nginx.conf \
&& sed -i 's,/var/run/nginx.pid,/tmp/nginx.pid,' /etc/nginx/nginx.conf \
&& sed -i "/^http {/a \ proxy_temp_path /tmp/proxy_temp;\n client_body_temp_path /tmp/client_temp;\n fastcgi_temp_path /tmp/fastcgi_temp;\n uwsgi_temp_path /tmp/uwsgi_temp;\n scgi_temp_path /tmp/scgi_temp;\n" /etc/nginx/nginx.conf \
# nginx user must own the cache and etc directory to write cache and tweak the nginx config
&& chown -R $UID:0 /var/cache/nginx \
&& chmod -R g+w /var/cache/nginx \
&& chown -R $UID:0 /etc/nginx \
&& chmod -R g+w /etc/nginx
EXPOSE 8080
USER nginx
# Containers run nginx with global directives and daemon off
CMD ["nginx", "-g", "daemon off;"]
docker-compose.yml
services:
s3-ui:
container_name: display-ui
image: display-ui:latest
build:
context: .
dockerfile: Dockerfile
restart: always
stdin_open: true
tty: true
ports:
- "8080:8080"
environment:
APP_ADDR: ":8080"
MONITOR_ADDR: ":3090"
To run, I do:
docker-compose build
docker-compose up
What am I missing?
You can use the nginx image and copy your content to it. See "Hosting some simple static content" # https://hub.docker.com/_/nginx/:
a simple Dockerfile can be used to generate a new image that includes the necessary content...
FROM nginx
COPY static-html-directory /usr/share/nginx/html
Place this file in the same directory as your directory of content ("static-html-directory"), run docker build -t some-content-nginx ., then start your container:
$ docker run --name some-nginx -d some-content-nginx

Combine two docker images to prevent docker inside docker

I've got a nodejs server inside docker:
FROM node:12
WORKDIR /app
COPY package.json /app
RUN yarn install
COPY . /app
EXPOSE 8080
CMD [ "yarn", "start" ]
And then I've got a dockerfile that is used for converting 3D models:
FROM leon/usd:latest
WORKDIR /usr/src/ufg
# Configuration
ARG UFG_RELEASE="3bf441e0eb5b6cfbe487bbf1e2b42b7447c43d02"
ARG UFG_SRC="/usr/src/ufg"
ARG UFG_INSTALL="/usr/local/ufg"
ENV USD_DIR="/usr/local/usd"
ENV LD_LIBRARY_PATH="${USD_DIR}/lib:${UFG_SRC}/lib"
ENV PATH="${PATH}:${UFG_INSTALL}/bin"
ENV PYTHONPATH="${PYTHONPATH}:${UFG_INSTALL}/python"
# Build + install usd_from_gltf
RUN git init && \
git remote add origin https://github.com/google/usd_from_gltf.git && \
git fetch --depth 1 origin "${UFG_RELEASE}" && \
git checkout FETCH_HEAD && \
python "${UFG_SRC}/tools/ufginstall/ufginstall.py" -v "${UFG_INSTALL}" "${USD_DIR}" && \
cp -r "${UFG_SRC}/tools/ufgbatch" "${UFG_INSTALL}/python" && \
rm -rf "${UFG_SRC}" "${UFG_INSTALL}/build" "${UFG_INSTALL}/src"
RUN mkdir /usr/app
WORKDIR /usr/app
# Start the service
ENTRYPOINT ["usd_from_gltf"]
CMD ["usd_from_gltf"]
The image works like so: When run, the 3d model passed as an argument is converted and then the image stops running
I want to have my node.js server running all the time, and when there's a request for conversion, the second image converts the file. I don't really care whether the second image runs on request, or runs all the time.
How can I do this?

Mongodb v4.0 Transaction, MongoError: Transaction numbers are only allowed on a replica set member or mongos

I've installed MongoDB v4.0 for the most amazing feature of it Transaction in Nodejs with mongodb 3.1 as a driver.
When I try to use a transaction session I've faced this error:
MongoError: Transaction numbers are only allowed on a replica set member or mongos.
What's that and how can I get rid of it?
Transactions are undoubtedly the most exciting new feature in MongoDB 4.0. But unfortunately, most tools for installing and running MongoDB start a standalone server as opposed to a replica set. If you try to start a session on a standalone server, you'll get this error.
In order to use transactions, you need a MongoDB replica set, and starting a replica set locally for development is an involved process. The new run-rs npm module makes starting replica sets easy. Running run-rs is all you need to start a replica set, run-rs will even install the correct version of MongoDB for you.
Run-rs has no outside dependencies except Node.js and npm. You do not need to have Docker, homebrew, APT, Python, or even MongoDB installed.
Install run-rs globally with npm's -g flag. You can also list run-rs in your package.json file's devDependencies.
npm install run-rs -g
Next, run run-rs with the --version flag. Run-rs will download MongoDB v4.0.0 for you. Don't worry, it won't overwrite your existing MongoDB install.
run-rs -v 4.0.0 --shell
Then use replicaSet=rs in your connection string.
You find more details about it here.
I got the solution, and it's just three lines configuration inside the MongoDB config file.
After switching from MongoDB atlas and installing MongoDB v 4.4.0 on my CentOS 7 VPS with WHM, I faced that issue also.
the run-rs solution does not work for me, but I managed to solve this issue without any third-party tool, following these steps:
1. turn off mongod.
the most efficient way is by entering the MongoDB shell with the command mongo
checkout the method
db.shutdownServer()
You will be no ability to use the MongoDB server.
For me, the shutdown process took too long, and then I killed the process with the command:
systemctl stop -f mongod
if you killed the mongod process,s probably you will need to run
mongod --dbpath /var/db --repair
The var/db should point to your database directory.
2. setting replicaSet configuration.
for the replicaSet settings step, check out the /etc/mongod.conf file,
look for the replication value line, and you should add the following lines as below:
replication:
oplogSizeMB: <int>
replSetName: <string>
enableMajorityReadConcern: <boolean>
use the replSetName value on the next step.
an example of those settings:
oplogSizeMB: 2000
replSetName: rs0
enableMajorityReadConcern: false
3. add your connection string URL.
add the value of replSetName to your connection URL &replicaSet=--YourReplicationSetName--
if you used the name rs0 from our example, then you should add to your DB connection URL query replicaSet=rs0
4. turn on mongod again
enter the command: systemctl start mongod
5. Access your replicaSet database
enter MongoDB shell with the command mongo, enter the command rs.initiate()
now you should be in your replicaSet database.
Possible solution for local development using docker
Create Dockerfile
FROM mongo:4.4.7
RUN echo "rs.initiate();" > /docker-entrypoint-initdb.d/replica-init.js
CMD [ "--replSet", "rs" ]
Build this Dockerfile
docker build ./ -t mongodb:4.7-replset
Run this created image
docker run --name mongodb-replset -p 27017:27017 -d mongodb:4.7-replset
Connect to database using this URI
mongodb://localhost:27017/myDB
For those who wants to develop against of the dockerized MongoDB instance, here is the single-file docker-compose.yaml solution based on the official MongoDB docker image:
version: '3.9'
services:
mongodb:
image: mongo:5
command: --replSet rs0
ports:
- "28017:27017"
environment:
MONGO_INITDB_DATABASE: attachment-api-local-dev
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongo localhost:27017/admin --quiet
interval: 2s
timeout: 3s
retries: 5
mongo-init:
image: mongo:5
restart: "no"
depends_on:
mongodb:
condition: service_healthy
command: >
mongo --host mongodb:27017 --eval
'
rs.initiate( {
_id : "rs0",
members: [
{ _id: 0, host: "localhost:27017" }
]
})
'
A much easier solution is to just use Bitnami MongoDB image:
services:
mongodb:
image: bitnami/mongodb:5.0
ports:
- "27017:27017"
environment:
MONGODB_REPLICA_SET_MODE: primary
ALLOW_EMPTY_PASSWORD: 'yes'
I faced the same issue recently. In my case it's because I'm connecting to a remote Mongo server with a different version than my local development environment.
To quickly solve the issue, I added the following param to my connection string:
?retryWrites=false
In order to use transactions, you need a MongoDB replica set, and starting a replica set locally for development is an involved process.
You can use the run-rs npm module. Zero-config MongoDB runner. Starts a replica set with no non-Node dependencies, not even MongoDB.
Or you can simply create an account in MongoDB Atlas which gives you a limited resource MongoDB cluster and so you can run/test your application.
MongoDB Atlas
When running MongoDB on a Linux Machine, you can simply use replication by updating connection string via editing service file
/usr/lib/mongod.service or /lib/systemd/system/mongod.service
and update it with following
ExecStart=/usr/bin/mongod --config "/etc/mongod.conf" --replSet rs0
where --config "/etc/mongod.conf" is pointing to your MongoDB Configuration file and --replSet rs0 is telling it to use replication with the name of rs0
and then restart
sudo systemctl daemon-reload //<--To reload service units
sudo systemctl restart mongod //<--To Restart MongoDB Server
and then initiate replication through your mongod instance in terminal
$ mongosh
$ rs.initiate()
I've been fighting against this issue for weeks. I let you my conclusion.
In order to be able to use transactions on a sharded cluster, you need to run at least MongoDB 4.2 on your cluster. If the cluster is not sharded, from 4.0.
I was using a library that has as a sub-dependency mongodb NodeJS driver. This driver from version 3.3.x fails against the sharded MongoDB cluster with version 4.0.4.
The solution for me was to update my cluster to 4.2 version.
src: https://www.bmc.com/blogs/mongodb-transactions/
Works for mongo:5.0.5-focal image.
Dockerfile:
FROM mongo:5.0.5-focal AS rs-mongo
# Make MongoDB a replica set to support transactions. Based on https://stackoverflow.com/a/68621185/1952977
RUN apt-get update && apt-get install patch
# How to create scripts/docker-entrypoint.sh.patch
# 1. Download the original file:
# wget https://github.com/docker-library/mongo/raw/master/5.0/docker-entrypoint.sh
# ( wget https://github.com/docker-library/mongo/raw/b5c0cd58cb5626fee4d963ce05ba4d9026deb265/5.0/docker-entrypoint.sh )
# 2. Make a copy of it:
# cp docker-entrypoint.sh docker-entrypoint-patched.sh
# 3. Add required modifications to docker-entrypoint-patched.sh
# 4. Create patch:
# diff -u docker-entrypoint.sh docker-entrypoint-patched.sh > scripts/docker-entrypoint.sh.patch
# 5. Clean up:
# rm docker-entrypoint.sh docker-entrypoint-patched.sh
COPY scripts/docker-entrypoint.sh.patch .
RUN patch /usr/local/bin/docker-entrypoint.sh docker-entrypoint.sh.patch
RUN mkdir -p /etc/mongo-key && chown mongodb:mongodb /etc/mongo-key
CMD ["--replSet", "rs", "--keyFile", "/etc/mongo-key/mongodb.key"]
scripts/docker-entrypoint.sh.patch:
--- docker-entrypoint.sh 2022-01-04 15:35:19.594435819 +0300
+++ docker-entrypoint-patched.sh 2022-01-06 10:16:26.285394681 +0300
## -288,6 +288,10 ##
fi
if [ -n "$shouldPerformInitdb" ]; then
+
+ openssl rand -base64 756 > /etc/mongo-key/mongodb.key
+ chmod 400 /etc/mongo-key/mongodb.key
+
mongodHackedArgs=( "$#" )
if _parse_config "$#"; then
_mongod_hack_ensure_arg_val --config "$tempConfigFile" "${mongodHackedArgs[#]}"
## -408,7 +412,14 ##
set -- "$#" --bind_ip_all
fi
- unset "${!MONGO_INITDB_#}"
+ echo 'Initiating replica set'
+ "$#" --logpath "/proc/$$/fd/1" --fork
+ echo 'rs.initiate({"_id":"rs","members":[{"_id":0,"host":"127.0.0.1:27017"}]});' | mongosh -u "$MONGO_INITDB_ROOT_USERNAME" -p "$MONGO_INITDB_ROOT_PASSWORD"
+ "$#" --logpath "/proc/$$/fd/1" --shutdown
+ echo 'Done initiating replica set'
+
+ unset "${!MONGO_INITDB_#}"
+
fi
rm -f "$jsonConfigFile" "$tempConfigFile"
docker-compose.yml:
version: '3.9'
services:
mongo:
image: rs-mongo:current
restart: always
env_file:
- .env
ports:
- 127.0.0.1:27017:27017
volumes:
- mongo-db:/data/db
- mongo-configdb:/data/configdb
- mongo-key:/etc/mongo-key
volumes:
mongo-db:
driver: local
mongo-configdb:
driver: local
mongo-key:
driver: local
UPDATED: 6th of Jan, 2022
The error is because you are using MongoDB sessions and it is not configured on your system.
run this to install run-rs :-
npm install run-rs -g
run:-
run-rs -v 4.0.0 --shell
You should see the below output. Please be patient since MongoDB 4.0.0 is about 70MB.
$ run-rs -v 4.0.0 --shell
Downloading MongoDB 4.0.0
Copied MongoDB 4.0.0 to '/home/node/lib/node_modules/run-rs/4.0.0'
Purging database...
Running '/home/node/lib/node_modules/run-rs/4.0.0/mongod'
Starting replica set...
Started replica set on "mongodb://localhost:27017,localhost:27018,localhost:27019"
Running mongo shell: /home/node/lib/node_modules/run-rs/4.0.0/mongo
rs:PRIMARY>
You now have a replica set running MongoDB 4.0.0 locally. Run rs.status() to verify the replica set is running.
NOTE:- Your nodejs version should be $gte v3.1.0

installing NODEJS on remote AWS instance of Red Hat Enterprise Linux 7.1

I have been trying to install NODEJS on remote AWS instance of Red Hat Enterprise Linux 7.1
I had read some of the posts here and been on the node js website
I have tried t
curl --silent --location https://rpm.nodesource.com/setup | bash -
but then get the error
error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Permission denied)
i even get this error if i run
sudo curl --silent --location https://rpm.nodesource.com/setup | bash -
I have also tried to change the permissions on that file but then it still doesnt install
Can someone suggest a better way / correct way of doing this?
Thanks
You just don't have permissions to install things. It doesn't matter you are running curl with sudo, because what really needs superuser permissions is the bash session inside which you run the script.
So, this would work.
curl --silent --location https://rpm.nodesource.com/setup | sudo bash -
At least on one of our ESXi RedHat virtual machines the easiest way I know to install nodejs is:
yum install epel-release
yum install nodejs
Let yum do all the heavy lifting :)
You may be running as a non root user.
Before running your actual curl command, run
sudo su
Then run (without sudo, since you are now running as root user)
curl --silent --location https://rpm.nodesource.com/setup | bash -

Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED

I working with node.js by expressjs I try to store an account to session. So, i try to test to use session with code in expressjs
var RedisStore = require('connect-redis')(express);
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.session({ secret: "keyboard cat", store: new RedisStore }));
but I got error Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED. Please help me resolve this problem
After you install redis, type from terminal:
redis-server
and you'll have redis running
I solve this problem in next way:
sudo apt-get install redis-server
then run command to confirm that everything ok:
sudo service redis-server status
And the output will be: redis-server is running - that means that the problem is solved.
Install redis on your system first -
brew install redis
then start the redis server -
redis-server
I'm on windows, and had to install Redis from here and then run redis-server.exe.
From the top of this SO question.
For those of you who are using docker with docker-compose and Typescript my solution was
import { RedisClient } from 'redis';
const pubClient = new RedisClient({ url: 'redis://redis:6379' });
to
import { createClient } from 'redis';
const pubClient = createClient({ url: 'redis://redis:6379' });
docker-compose.yml
version: '3.9'
services:
main:
build:
context: .
target: development
ports:
- ${PORT}:${PORT}
volumes:
- ./src:/usr/src/app/src
- /app/node_modules
env_file:
- .env
command: npm run start:dev
depends_on:
- mongo
- redis
mongo:
image: mongo:5.0.2-focal
volumes:
- mongo-data:/data/db
mongo-express:
image: mongo-express:0.54.0
ports:
- 8081:8081
depends_on:
- mongo
redis:
image: redis:6.2.5-alpine
volumes:
mongo-data:
Simple solution:
only hit below commend once and restart your server again
redis-server
Using Windows 10?
Go here: https://learn.microsoft.com/en-us/windows/wsl/wsl2-install
Then run...
$ wget https://github.com/antirez/redis/archive/5.0.5.tar.gz <- change this to whatever Redis version you want (https://github.com/antirez/redis/releases)
$ tar xzf redis-5.0.5.tar.gz
$ cd redis-5.0.5
$ make
for Windows users, you can use chocolatey to install Redis
choco install redis-64
then run server from
C:\ProgramData\chocolatey\lib\redis-64\redis-server.exe
I also have the same problem, first I tried to restart redis-server by sudo service restart but the problem still remained. Then I removed redis-server by sudo apt-get purge redis-server and install it again by sudo apt-get install redis-server and then the redis was working again. It also worth to have a look at redis log which located in here /var/log/redis/redis-server.log
I used ubuntu 12.04
I solved that problem by installing redis-server
redis-server installation for ubuntu 12.04
some configuration will new root permission
Also listed manuals for other OS
Thanks
For me I had this issue on Ubuntu 18.x, but my problem was that my redis-server was running on 127.0.0.1 but I found out I needed to run it on my IP address xxx.xx.xx.xx
I went into my Ubuntu machine and did the following.
cd /etc/redis/
sudo vim redis.conf
Then I edited this part.
################################## NETWORK #####################################
# By default, if no "bind" configuration directive is specified, Redis listens
# for connections from all the network interfaces available on the server.
# It is possible to listen to just one or multiple selected interfaces using
# the "bind" configuration directive, followed by one or more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
#
# ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
# internet, binding to all the interfaces is dangerous and will expose the
# instance to everybody on the internet. So by default we uncomment the
# following bind directive, that will force Redis to listen only into
# the IPv4 loopback interface address (this means Redis will be able to
# accept connections only from clients running into the same computer it
# is running).le to listen to just one or multiple selected interfaces using
#
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# bind 127.0.0.1 ::1 10.0.0.1
bind 127.0.0.1 ::1 # <<-------- change this to what your iP address is something like (bind 192.168.2.2)
Save that, and then restart redis-server.
sudo service redis-server restart or simply run redis-server
For windows platform, You must check if redis-server is running on given ip:port. you can find redis configuration at installation directory /conf/redis.conf. by default client accept 127.0.0.1:6379.
I'm on MBP , and install redis detail my problem was resolved .Fixed the
Download, extract and compile Redis with:
$ wget http://download.redis.io/releases/redis-3.0.2.tar.gz
$ tar xzf redis-3.0.2.tar.gz
$ cd redis-3.0.2
$ make
The binaries that are now compiled are available in the src directory.
Run Redis with:
$ src/redis-server
I think maybe you installed redis by source code.If that you need locate to redis-source-code-path/utils and run sudo install_server.sh command.
After that, make sure redis-server has been running as a service for your system
sudo service redis-server status
PS: based on Debian/Ubuntu
In case of ubuntu, the error is due to redis-server not being set up.
Install the redis-server again and then check for the status.
If there is no error, then a message like this would be displayed :-
● redis-server.service - Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2018-01-17 20:07:27 IST; 16s ago
Docs: http://redis.io/documentation,
man:redis-server(1)
Main PID: 4327 (redis-server)
CGroup: /system.slice/redis-server.service
└─4327 /usr/bin/redis-server 127.0.0.1:6379
You have to install redis server first;
You can install redis server on mac by following step -
$ curl -O http://download.redis.io/redis-stable.tar.gz
$ tar xzvf redis-stable.tar.gz
$ cd redis-stable
$ make
$ make test
$ sudo make install
$ redis-server
Good luck.
Your connection to redis is failing. Try restarting your redis server, then starting up your client again by running these 3 commands:
sudo service redis-server restart
redis-server
redis-cli
For Windows I solved this by...
using...
let redisClient = createClient({
legacyMode: true ,
url: 'redis://redis:6379',
});
Its for redis version > 4.0
You can refer to the image below.
Try upgrading your node to latest version.
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
version 0.4 may not work properly.

Categories

Resources