-
Notifications
You must be signed in to change notification settings - Fork 0
Set up benchmark_app on Linux server
piotr-iohk edited this page Feb 10, 2023
·
6 revisions
This guide describes how to set up benchmark up on Linux server from scratch.
- Install
rbenv
: https:/rbenv/rbenv#basic-git-checkout - Install ruby 2.7.1:
rbenv install 2.7.1
sudo apt update
sudo apt install postgresql postgresql-contrib libpq-dev
sudo systemctl start postgresql.service
- Create user
$ sudo -i -u postgres
postgres@ip-xxx-xx-xx-xxx:~$ createuser --interactive
Enter name of role to add: benchmark
Shall the new role be a superuser? (y/n) y
postgres@ip-xxx-xx-xx-xxx:~$ exit
$ sudo adduser benchmark
- Set DB user password
$ sudo -i -u postgres
$ psql
postgres=# ALTER USER benchmark PASSWORD 'yourverysecurepassword';
ALTER ROLE
postgres=# \q
- Create database
ℹ️ User
benchmark
will automatically connect to the database namedbenchmark
.
sudo -u postgres createdb benchmark
You can put this in your ~/.bashrc
.
export BUILDKITE_API_TOKEN=<get it from buildkite>
export APP_ENV=production
export BENCH_DB_PATH=postgres://benchmark:yourverysecurepassword@localhost/benchmark
- Checkout
mkdir apps
cd apps
git clone https:/piotr-iohk/benchmark_app.git
- Configure ruby version and dependencies
cd benchmark_app
rbenv local 2.7.1
bundle install
- Migrate database (a.k.a. create tables)
rake db:migrate
- Get latest Buildkite results
rake bk:latest
- Start benchmark app in a
screen
session
$ screen -dmS benchmark_app ./start
$ screen -ls
There is a screen on:
49267.benchmark_app (02/09/23 15:48:34) (Detached)
ℹ️ To attach to the session:
$ screen -r benchmark_app
To detach:
Ctrl + a
and thend
.
⚠️ Note! The application by default will start on port5555
. Therefore it is required to open this port on the server such that one can access it ashttp://<host>:5555
. Alternatively it can be probably configured with some webserver asnginx
.
Et voilà! http://ec2-18-156-193-207.eu-central-1.compute.amazonaws.com:5555/
We want Buildkite results to be migrated repeatedly. For that we will set up a cron job.
- Edit
crontab
crontab -e
- Add job
SHELL=/bin/bash
BASH_ENV=~/.bashrc
BENCH_DB_PATH=postgres://benchmark:yourverysecurepassword@localhost/benchmark
BUILDKITE_API_TOKEN=<get it from buildkite>
*/10 * * * * cd ~/apps/benchmark_app && ~/.rbenv/versions/2.7.1/bin/rake bk:latest