Update packages
apt update
apt upgradeInstall required packages
apt install build-essential cmake postgresql git libpq-devInstall rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.bashrcgit clone --recursive https://github.com/w3champions/flo.gitinstall diesel_cli
cd flo
export PQ_LIB_DIR=/usr/lib/x86_64-linux-gnu/
cargo install diesel_cli --no-default-features --features postgresenable password auth instead of peer by editing /etc/postgresql/11/main/pg_hba.conf
should be local all postgres md5
restart postgres
systemctl restart postgresqlset password for pgsql user
su postgres
pgsql
postgres=# \password
Enter new password:
Enter it again:
postgres=# exit
exitcreate .env file in flo code root
RUST_LOG=debug
DATABASE_URL=postgres://postgres:postgres@localhost/flo
JWT_SECRET_BASE64=dGVzdHRlc3R0ZXN0dGVzdHRlc3R0ZXN0dGVzdHRlc3R0ZXN0dGVzdHRlc3Q=as pgsql user create database and fill it using diesel (use your password)
export PGPASSWORD=postgres
psql -U postgres -c "create database flo"
diesel setupadd api_client and node rows to postgres (NOTE: use server ip and not 127.0.0.1)
psql -U postgres -d flo -c "insert into api_client (name, secret_key) VALUES ('mawa', 'mawa')"
psql -U postgres -d flo -c "insert into node (name, location, secret, ip_addr) VALUES ('mawa', 'US 6', 'mawa', '127.0.0.1')"build controller and node services
cargo build -p flo-controller-service --release
cargo build -p flo-node-service --releaseexport secret key
export FLO_NODE_SECRET='mawa'run node first
./target/release/flo-node-service
./target/release/flo-controller-serviceCreate following service files for systemd:
- /usr/lib/systemd/system/flo-node.service
[Unit]
Description=Flo Node Service
After=network.target
After=postgresql.target
[Service]
Type=simple
WorkingDirectory=/root/flo
ExecStart=/bin/bash -l -c "FLO_NODE_SECRET='mawa' ./target/release/flo-node-service"
Restart=on-failure
[Install]
WantedBy=multi-user.target- /usr/lib/systemd/system/flo-controller.service
[Unit]
Description=Flo Controller Service
After=network.target
After=postgresql.target
[Service]
Type=simple
WorkingDirectory=/root/flo
ExecStart=/bin/bash -l -c "FLO_NODE_SECRET='mawa' ./target/release/flo-controller-service"
Restart=on-failure
[Install]
WantedBy=multi-user.targetMake those visible with running:
systemctl daemon-reloadRun with
systemctl start flo-node
systemctl start flo-controllerTrace logs:
journalctl -f -u flo-nodeRun automatically with system start:
systemctl enable postgresql
systemctl enable flo-node
systemctl enable flo-controllerbuild flo-cli
apt install libavahi-compat-libdnssd-dev zlib1g-dev libbz2-dev
cargo build -p flo-cli --releaserun
./target/release/flo-cli server --help
./target/release/flo-cli server list-nodes
./target/release/flo-cli server upsert-player 1copy token from the last command and use it to run flo-worker locally
flo-worker.exe --controller-host="45.33.104.208" --token="eyJ0...."if you get no errors you can create test game
./target/release/flo-cli server run-game 2to update ip addres you may use:
psql -U postgres -d flo -c "update node set ip_addr = '45.33.104.208' WHERE id = 1"
psql -U postgres -d flo -c "select * from node"
systemctl restart flo-node
systemctl restart flo-controller