How to Install Strider Continuous Integration Server on Ubuntu 18.04 LTS

Strider is a free and open-source Continuous Integration & Deployment Server written in Node.JS, JavaScript and uses MongoDB to store their data. Strider comes with a lot of plugins that can be used to add various features to the application.

In this tutorial, we will explain how to install Strider on Ubuntu 18.04 server.

Requirements

  • A server running Ubuntu 18.04.
  • A root password is configured on your server.

Getting Started

Before started, it is recommended to update your packages to the latest version. You can update all the packages by running the following command:

apt-get update -y
apt-get upgrade -y

Once all the packages are updated, restart your system to apply the changes.

Next, install curl and git package with the following command:

apt-get install curl git -y

Once all the required packages are installed, you can proceed to the next step.

Install Node.js

Next, you will need to install Node.js and other required packages to your server.

By default, Node.js is not available in the Ubuntu 18.04 default repository. So, you will need to add Node.js repository to your system. You can add the repository with the following command:

curl -sL https://deb.nodesource.com/setup_12.x | bash -

Once the repository is added, update the repository and install Node.js with the following command:

apt-get install nodejs node-gyp -y

After installing Node.js check the version of Node.js and NPM with the following command:

node -v

You should see the following output:

v12.6.0
npm -v

You should see the following output:

6.9.0

Install and Configure MongoDB

Strider uses MongoDB as a backing store. So, you will need to install MongoDB to your system.

First, import the GPG public key for MongoDB with the following command:

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4

Next, add the MongoDB repository with the following command:

echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.0.list

You should see the following Output:

Executing: /tmp/apt-key-gpghome.mmTr2ifzC1/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
gpg: key 68818C72E52529D4: public key "MongoDB 4.0 Release Signing Key <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1

Next, update the repository and install MongoDB with the following command:

apt-get update -y
apt-get install mongodb-org -y

Once the installation has been completed, start MongoDB service and enable it to start after system reboot with the following command:

systemctl start mongod
systemctl enable mongod

You can also check the MongoDB status with the following command:

systemctl status mongod

You should see the following output:

? mongod.service - MongoDB Database Server
   Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-07-13 05:24:41 UTC; 5s ago
     Docs: https://docs.mongodb.org/manual
 Main PID: 13619 (mongod)
   CGroup: /system.slice/mongod.service
           ??13619 /usr/bin/mongod --config /etc/mongod.conf

Jul 13 05:24:41 ubuntu1804 systemd[1]: Started MongoDB Database Server.

Next, you will need to setup MongoDB for authentication.

To do so, open the MongoDB shell with the following command:

mongo

You should see the following output:

MongoDB shell version v4.0.10
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("e3edd538-03c4-469a-8c8c-227a16d214d0") }
MongoDB server version: 4.0.10
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
	http://docs.mongodb.org/
Questions? Try the support group
	http://groups.google.com/group/mongodb-user
Server has startup warnings: 
2019-07-13T05:24:46.255+0000 I STORAGE  [initandlisten] 
2019-07-13T05:24:46.255+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-07-13T05:24:46.256+0000 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-07-13T05:24:48.774+0000 I CONTROL  [initandlisten] 
2019-07-13T05:24:48.774+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-07-13T05:24:48.774+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-07-13T05:24:48.775+0000 I CONTROL  [initandlisten] 
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).

The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.

To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---

Next, change the database to admin and create an admin user with the following command:

>use admin
db.createUser( { user: "admin", pwd: "adminpassword", roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ] } )

Next, exit from the MongoDB shell with the following command:

> exit

Next, open the MongoDB configuration file and enable authentication with the following command:

nano /etc/mongod.conf

Make the following changes:

security:
  authorization: enabled

Save and close the file. Then, restart MongoDB service to apply the configuration changes with the following command:

systemctl restart mongod

Install Strider

First, download the latest version of Strider with the following command:

cd /opt
git clone https://github.com/Strider-CD/strider.git

Next, install required dependencies with the following command:

cd strider
npm install

Next, you will need to create a new strider user and assign it to database strider.

To do so, open the MongoDB shell with the following command:

mongo

Next, authenticate your MongoDB session with admin user:

use admin
db.auth("admin", "adminpassword" )

Next, create a database user and assign it to database name strider:

use strider
db.createUser({user: "strider", pwd: "password", roles: [{role: "dbOwner", db: "strider"}]})

Next, exit from the MongoDB shell and create an admin user for Strider with the following command:

cd /opt/strider
DB_URI="mongodb://strider:password@localhost:27017/strider" node bin/strider addUser

Provide all the required information as shown below:

Connecting to MongoDB URL: mongodb://strider:password@localhost:27017/strider

Enter email []: [email protected]
Enter password []: ****
Is admin? (y/n) [n]y

Email:        [email protected]
Password:    admin
isAdmin:    y
OK? (y/n) [y]y
User created successfully! Enjoy.

Install and Configure PM2

Next, you will need to install PM2 to manage Node.js process. First, install PM2 with npm as shown below:

npm install pm2 -g

Next, create a new configuration file for PM2 with the following command:

cd /opt/strider
nano ecosystem.config.js

Add the following lines:

module.exports = {
  apps : [{
    name   : "strider",
    script : "npm",
    args : "start",
    env: {
      "NODE_ENV": "production",
      "DB_URI": "mongodb://strider:password@localhost:27017/strider",
      "SERVER_NAME": "http://your-server-ip:3000",
      "HOST": "0.0.0.0",
      "PORT": "3000"
    }
  }]
}

Save and close the file, when you are finished. Then, start the application with the following command:

pm2 start ecosystem.config.js

You should see the following output:

                        -------------

__/\\\\\\\\\\\\\____/\\\\____________/\\\\____/\\\\\\\\\_____
 _\/\\\/////////\\\_\/\\\\\\________/\\\\\\__/\\\///////\\\___
  _\/\\\_______\/\\\_\/\\\//\\\____/\\\//\\\_\///______\//\\\__
   _\/\\\\\\\\\\\\\/__\/\\\\///\\\/\\\/_\/\\\___________/\\\/___
    _\/\\\/////////____\/\\\__\///\\\/___\/\\\________/\\\//_____
     _\/\\\_____________\/\\\____\///_____\/\\\_____/\\\//________
      _\/\\\_____________\/\\\_____________\/\\\___/\\\/___________
       _\/\\\_____________\/\\\_____________\/\\\__/\\\\\\\\\\\\\\\_
        _\///______________\///______________\///__\///////////////__


                          Runtime Edition

        PM2 is a Production Process Manager for Node.js applications
                     with a built-in Load Balancer.

                Start and Daemonize any application:
                $ pm2 start app.js

                Load Balance 4 instances of api.js:
                $ pm2 start api.js -i 4

                Monitor in production:
                $ pm2 monitor

                Make pm2 auto-boot at server restart:
                $ pm2 startup

                To go further checkout:
                http://pm2.io/


                        -------------

[PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
[PM2] PM2 Successfully daemonized
[PM2][WARN] Applications strider not running, starting...
[PM2] App [strider] launched (1 instances)
??????????????????????????????????????????????????????????????????????????????????????????????????????????
? App name ? id ? version ? mode ? pid   ? status ? restart ? uptime ? cpu ? mem       ? user ? watching ?
??????????????????????????????????????????????????????????????????????????????????????????????????????????
? strider  ? 0  ? N/A     ? fork ? 21502 ? online ? 0       ? 0s     ? 0%  ? 25.6 MB   ? root ? disabled ?
??????????????????????????????????????????????????????????????????????????????????????????????????????????
 Use `pm2 show <id|name>` to get more details about an app

Next, enable PM2 to start automatically after system reboot with the following command:

pm2 startup

Once you have finished, you can proceed to the next step.

Access Strider

Strider is now installed and configured, it's time to access Strider from web browser.

Open your web browser and type the URL http://your-server-ip:3000. You will be redirected to the Strider login page as shown below:

Strider Login

Now, provide your admin username and password which you have created earlier and click on the Login button. Upon successful login, you should see the following page:

Configure Strider Project

Congratulations! you have successfully installed and configured Strider on Ubuntu 18.04 server. Feel free to ask me if you have any questions. For more information, you can visit the official documentation at Strider Doc

Share this page:

1 Comment(s)