- Sqlx setup
sqlx database create
sqlx migrate run
- Start the backend server
bacon
- Generate types (bindings) for the frontend
cargo test
cd client
bun run dev
Open http://localhost:13124 in your browser.
cd client
bun run build
cd ..
cargo build --release
By default, Rust will build for the host architecture. To build for another architecture, use the
--target
flag.
⚠️ Rust leak your username and your current directory in the binary. To avoid this, look at the Arm/Raspberry Pi section, or the Dockerfile.
- Install cross
CROSS_CONTAINER_OPTS="--platform linux/amd64 -e RUSTFLAGS='-Zlocation-detail=none -Zfmt-debug=shallow'" cross +nightly build \
-Z build-std=std,panic_abort \
-Z build-std-features=panic_immediate_abort \
--target armv7-unknown-linux-musleabihf \
--release
[Unit]
Description=Partage Service
After=network.target
[Service]
ExecStart=/path/to/dir/partage
Restart=always
WorkingDirectory=/path/to/dir
RestartSec=5
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable partage.service
sudo systemctl start partage.service
sudo systemctl status partage.service
docker build -t test-partage .
docker run --rm --name test-partage -p 20000:3001 test-partage sh
For docker-compose.yml
:
services:
partage:
image: ghcr.io/kernoeb/partage:main
ports:
- 20000:3001
certbot -d x.example.com --manual --preferred-challenges dns certonly
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name x.example.com;
ssl_certificate /etc/letsencrypt/live/x.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/x.example.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
gzip on;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
location / {
proxy_pass http://localhost:21000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 80;
server_name x.example.com;
# Redirect HTTP to HTTPS
return 301 https://$host$request_uri;
}
- Axum Websockets example
- Rust-Embed example
- Chatr by 0xLaurens for the backend inspiration
- Tests
- Documentation
- Persistence for new channels
- Feature : no database