There are three ways to deploy Triox:
- Docker
- Docker compose
- Bare metal
NOTE: We'll publish pre-built images once we reach alpha
.
- Build image:
cd Triox && docker build -t triox/triox:latest .
-
Set configuration in configuration file
-
Run image:
If you have already have a Postgres instance running, then:
docker run -p <host-machine-port>:<port-in-configuration-file> \
--add-host=database:<database-ip-addrss> \
-e RUST_LOG=debug \
-e DATABASE_URL="postgres://<db-user>:<db-password>@database:<db-port>/<db-name>" \
triox/triox:latest
If you don't have a Postgres instance running, you can either install one using a package manager or launch one with docker. A docker-compose configuration is available that will launch both a database instance Triox instance.
-
Set database password docker-compose configuration.
-
Launch network:
docker-compose up -d --build
The process is tedious, most of this will be automated with a script in the future.
For Debian based systems:
sudo apt install postgresql
sudo useradd -b /srv -m -s /usr/bin/bash triox
sudo -iu postgres # switch to `postgres` user
psql
Postgres shell:
postgres=# CREATE USER triox WITH PASSWORD 'my super long password and yes you need single quotes';
postgres=# exit;
createdb -O triox triox # create db 'triox' with 'triox' as owner
To build Triox
, you need the following dependencies:
- rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo build --release
- Generating TLS key and certificate
cd ssl
openssl req -x509 -nodes -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365
cd ..
- Then update
config/local.toml
:
[ssl] enabled = true
sudo mkdir /srv/triox/triox/
sudo cp ./target/release/triox /srv/triox/triox # Copy binary
sudo cp -r ./config /srv/triox/triox # copy configurations
sudo cp -r ./static /srv/triox/triox # copy static files
sudo cp -r ./tls /srv/triox/triox # copy custom TLS certs
sudo chown -R triox:triox /srv/triox/triox # change ownership of all copied files to user triox
- Copy the following to
/etc/systemd/system/triox.service
:
[Unit]
Description=Triox: Next Generation cloud storage server that is secure, fast, and reliable.
[Service]
Type=simple
User=triox
ExecStart=/srv/triox/triox
Restart=on-failure
RestartSec=1
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
NoNewPrivileges=true
Environment="RUST_LOG=info"
# set a long, random value for TRIOX_SERVER_SECRET
Environment="TRIOX_SERVER_SECRET="
[Unit]
After=sound.target
Wants=network-online.target
Wants=network-online.target
Requires=postgresql.service
After=syslog.target
[Install]
WantedBy=multi-user.target
- Enable service:
sudo systemctl daemon-reload && \
sudo systemctl enable triox && \ # Auto startup during boot
sudo systemctl start triox