Strider CD Installation Guide on Ubuntu 18.04
Strider CD is a free and open-source platform for continuous deployment. Developed with Node.js, it leverages MongoDB as its primary data storage. Strider supports an extensive plugin system that enhances its core functionality.
Prerequisites
- A brand new Ubuntu 18.04 instance with a minimum of 1 GB RAM
- A non-root user configured with sudo permissions
- All system packages should be updated to the latest version
Update and upgrade the system packages by running the following command:
sudo apt-get update && sudo apt-get upgrade -y
Step 1: Setting Up Node.js and NPM
Nodesource offers ready-to-use binaries for Node.js, which can be installed through the system’s package manager. First, add the Nodesource repository:
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
Then proceed to install Node.js:
sudo apt-get install -y nodejs
NPM is automatically included with the Node.js installation. To verify that both Node.js and NPM were installed properly, check their versions:
strider@centron:~$ node -v
v10.15.3
strider@centron:~$ npm -v
6.4.1
Step 2: Installing Git and node-gyp
Although Git is usually pre-installed systems, you can verify and ensure it’s properly installed and up to date using the following command:
sudo apt-get install -y git
Next, install node-gyp
, a tool for compiling native add-ons for Node.js:
sudo npm install -g node-gyp
Step 3: Setting Up MongoDB
Begin by importing MongoDB’s public GPG key to ensure the authenticity of the downloaded packages:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
Then add the MongoDB repository to your system’s package sources:
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
Update the package index and install MongoDB:
sudo apt-get update
sudo apt-get install -y mongodb-org
Finally, start the MongoDB service and configure it to launch automatically at system startup:
sudo systemctl start mongod
sudo systemctl enable mongod
Step 4: Configuring MongoDB Authentication
To begin configuring authentication for MongoDB, launch the MongoDB shell:
strider@centron:~/strider$ mongo
MongoDB shell version v4.0.8
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("a06b2797-6f58-43e1-8a41-c6401edb5083") }
MongoDB server version: 4.0.8
Welcome to the MongoDB shell.
...
Switch to the admin
database with the following command:
use admin
Create a new administrator account. You should change the username and password to your own secure credentials:
db.createUser(
{
user: "admin",
pwd: "StrongPassword",
roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ]
}
)
To exit the MongoDB shell, press Ctrl+C.
Next, open the MongoDB configuration file using a text editor:
sudo nano /etc/mongod.conf
Locate the line that says #security:
and replace it with the following configuration to enable authorization:
security:
authorization: "enabled"
Save your changes and exit the editor. To apply the changes, restart the MongoDB service:
sudo systemctl restart mongod
Step 5: Installing Strider
To begin installing Strider, start by cloning the project repository from GitHub:
cd ~
git clone https://github.com/Strider-CD/strider.git
Move into the newly created directory and install all required Node.js dependencies:
cd ~/strider
npm install
Reopen the Mongo shell to set up a dedicated database for Strider:
mongo
Authenticate your session with the previously created administrator credentials:
use admin
db.auth("admin", "StrongPassword" )
Create a new MongoDB user for Strider and assign it to the strider
database. Be sure to replace the password striderpw
with a secure one:
use strider
db.createUser({user: "strider", pwd: "striderpw", roles: [{role: "dbOwner", db: "strider"}]})
Press Ctrl+C to exit the Mongo shell.
Now, add an administrator user to Strider by running this command. Replace the credentials and details as needed:
DB_URI="mongodb://strider:striderpw@localhost:27017/strider" node bin/strider addUser
When prompted by the script, provide your email and a new password for the admin user:
strider@centron:~/strider$ DB_URI="mongodb://strider:striderpw@localhost:27017/strider" node bin/strider addUser
Connecting to MongoDB URL: mongodb://strider:striderpw@localhost:27017/strider
Enter email []: centron@example.com
Enter password []: ****
Is admin? (y/n) [n]y
Email: centron@example.com
Password: ****
isAdmin: y
OK? (y/n) [y]y
User created successfully! Enjoy.
Step 6: Managing the Strider Process with PM2
To handle your Node.js application efficiently, install PM2 globally using NPM:
sudo npm install pm2 -g
Next, navigate to the Strider directory and create a PM2 configuration file:
cd ~/strider && nano ecosystem.config.js
Insert the following configuration into the file. Be sure to replace the placeholder IP address 203.0.113.1
with the real IP address of your centron server:
module.exports = {
apps : [{
name : "strider",
script : "npm",
args : "start",
env: {
"NODE_ENV": "production",
"DB_URI": "mongodb://strider:striderpw@localhost:27017/strider",
"SERVER_NAME": "http://203.0.113.1:3000",
"HOST": "0.0.0.0",
"PORT": "3000"
}
}]
}
Now, launch the Strider application using the PM2 configuration:
pm2 start ecosystem.config.js
To ensure that Strider automatically starts on system reboot, execute the following:
pm2 startup
Finally, open your web browser and visit http://203.0.113.1:3000
—replacing the IP with your server’s actual address. Log in using the administrator credentials you previously set up for Strider.
Conclusion
By following the steps in this guide, you have successfully set up Strider CD on a Ubuntu 18.04 server. The environment includes Node.js, MongoDB with authentication, and PM2 for process management, ensuring that your continuous deployment pipeline is reliable and persistent across reboots. You can now start deploying your projects with confidence using Strider’s powerful and extensible platform.