Configure and Launch MyCRT
The next step in the deployment process is to configure MyCRT to run.
1: Environment Variables
Add the following lines to /etc/environment
MYCRT_ENV="demo"
MYCRT_PORT=80
MYCRT_HOST="localhost"
Quit the SSH session and reopen it to apply the environment variables.
1.5: Run Automated Tests (Optional)
Now, the automated tests can finally be run. This is a good way to make sure everything has gone well so far.
cd mycrt/scripts
npm run test
If all tests pass, you're in good shape!
2: Configure the Service
Modify mycrt/service/mycrt.config.json
to match the following:
{
"name": "MyCRT Server1",
"ssl": false,
"captures": {
"mock": false,
"interval": 360000,
"intervalOverlap": 60000,
"metricsDelay": 120000,
"filePrepDelay": 120000
},
"replays": {
"mock": false,
"interval": 360000,
"intervalOverlap": 60000,
"metricsDelay": 120000,
"filePrepDelay": 120000
}
}
For a detailed explanation of all of the configuration options, check here.
Create /etc/systemd/system/mycrt.service
[Service]
WorkingDirectory=/PATH_TO_MYCRT_REPO/service
ExecStart=/usr/bin/npm run mycrt
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=mycrt-demo
User=root
Group=root
Environment=NODE_ENV=production MYCRT_ENV=demo MYCRT_PORT=80 MYCRT_HOST=localhost
Now, run systemctl status mycrt
You should see the following output:
● mycrt.service
Loaded: loaded (/etc/systemd/system/mycrt.service; static; vendor preset: enabled)
Active: inactive (dead)
3: Launch MyCRT
Run sudo systemctl start mycrt
to start the service. Run curl localhost:80/api/ping
to make sure the service has started.
Now, you should be able to access your EC2 instance in the browser with its hostname.
Congratulations! MyCRT is now up and running.
Next (optional) Step
Configure HTTPS/SSLLast updated