update docs

This commit is contained in:
Wavering Ana 2025-01-31 19:17:07 -05:00
parent abd01492db
commit 9b9834e163
3 changed files with 15 additions and 11 deletions

View file

@ -1,4 +1,5 @@
# SimpleLink # SimpleLink
A very performant and light (6mb in memory) link shortener and tracker. Written in Rust and React and uses Postgres. A very performant and light (6mb in memory) link shortener and tracker. Written in Rust and React and uses Postgres.
![MainView](readme_img/mainview.jpg) ![MainView](readme_img/mainview.jpg)
@ -8,6 +9,7 @@ A very performant and light (6mb in memory) link shortener and tracker. Written
## Build ## Build
### From Source ### From Source
First configure .env.example and save it to .env First configure .env.example and save it to .env
If DATABASE_URL is set, it will connect to a Postgres DB. If blank, it will use an sqlite db in /data If DATABASE_URL is set, it will connect to a Postgres DB. If blank, it will use an sqlite db in /data
@ -15,21 +17,24 @@ If DATABASE_URL is set, it will connect to a Postgres DB. If blank, it will use
```bash ```bash
#set api-domain to where you will be deploying the link shortener, eg: link.example.com, default is localhost:8080 #set api-domain to where you will be deploying the link shortener, eg: link.example.com, default is localhost:8080
git clone https://github.com/waveringana/simplelink && cd simplelink git clone https://github.com/waveringana/simplelink && cd simplelink
./build.sh api-domain=localhost:8080 ./build.sh
cargo run cargo run
``` ```
On an empty database, an admin-setup-token.txt is created as well as pasted into the terminal output. This is needed to make the admin account. On an empty database, an admin-setup-token.txt is created as well as pasted into the terminal output. This is needed to make the admin account.
Alternatively if you want a binary form Alternatively if you want a binary form
```bash ```bash
./build.sh --binary ./build.sh --binary
``` ```
then check /target/release for the binary named `SimpleGit` then check /target/release for the binary named `SimpleGit`
### From Docker ### From Docker
```bash ```bash
docker build --build-arg API_URL=http://localhost:8080 -t simplelink . docker build --build-arg -t simplelink .
docker run -p 8080:8080 \ docker run -p 8080:8080 \
-e JWT_SECRET=change-me-in-production \ -e JWT_SECRET=change-me-in-production \
-v simplelink_data:/data \ -v simplelink_data:/data \
@ -37,4 +42,5 @@ docker run -p 8080:8080 \
``` ```
### From Docker Compose ### From Docker Compose
Adjust the included docker-compose.yml to your liking; it includes a postgres config as well. Adjust the included docker-compose.yml to your liking; it includes a postgres config as well.

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Default values # Default values
API_URL="http://localhost:8080" #API_URL="http://localhost:8080"
RELEASE_MODE=false RELEASE_MODE=false
BINARY_MODE=false BINARY_MODE=false
@ -9,10 +9,10 @@ BINARY_MODE=false
for arg in "$@" for arg in "$@"
do do
case $arg in case $arg in
api-domain=*) #api-domain=*)
API_URL="${arg#*=}" #API_URL="${arg#*=}"
shift #shift
;; #;;
--release) --release)
RELEASE_MODE=true RELEASE_MODE=true
shift shift
@ -24,7 +24,7 @@ do
esac esac
done done
echo "Building project with API_URL: $API_URL" #echo "Building project with API_URL: $API_URL"
echo "Release mode: $RELEASE_MODE" echo "Release mode: $RELEASE_MODE"
# Check if cargo is installed # Check if cargo is installed
@ -42,7 +42,7 @@ fi
# Build frontend # Build frontend
echo "Building frontend..." echo "Building frontend..."
# Create .env file for Vite # Create .env file for Vite
echo "VITE_API_URL=$API_URL" > frontend/.env #echo "VITE_API_URL=$API_URL" > frontend/.env
# Install frontend dependencies and build # Install frontend dependencies and build
cd frontend cd frontend

View file

@ -22,8 +22,6 @@ services:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
args:
- API_URL=${API_URL:-http://localhost:3000}
container_name: shortener-app container_name: shortener-app
ports: ports:
- "8080:8080" - "8080:8080"