https://github.com/ctrlaltdev/gry
https://github.com/ctrlaltdev/gry
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ctrlaltdev/gry
- Owner: ctrlaltdev
- License: mpl-2.0
- Created: 2022-07-17T00:52:14.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-15T22:22:15.000Z (10 months ago)
- Last Synced: 2025-05-29T11:22:01.857Z (7 months ago)
- Language: Go
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Redir Yourself
Simple shorturl service
## Environment Variables
GRY can be configured using the following environment variables:
| Variable | Default | Description |
|----------|---------|-------------|
| `GRY_PORT` | `3000` | The port number the service will listen on |
| `GRY_FOLDER` | `.GRY` | The folder path where redirects will be stored |
| `GRY_TOTP_SECRET` | - | TOTP secret key required for admin authentication. If not set, a secret will be generated and displayed in the logs (NOT RECOMMENDED FOR PRODUCTION) |
## Run as a container
```sh
# Pull and run the container
docker run -d \
--name gry \
-p 3000:3000 \
-v gry-data:/.GRY \
ctrlaltdev/gry:latest
# Or using docker compose
version: '3'
services:
gry:
image: ctrlaltdev/gry:latest
container_name: gry
ports:
- "3000:3000"
volumes:
- gry-data:/.GRY
restart: unless-stopped
volumes:
gry-data:
```
## Run as a service
Install the binary
```sh
curl -fSsL ln.0x5f.info/getGRY | sh
```
Create a systemd service file
```
[Unit]
Description=GO REDIR YOURSELF
ConditionPathExists=/usr/local/bin/GRY
After=network.target
[Service]
Type=simple
User=
Group=
LimitNOFILE=1024
Restart=on-failure
RestartSec=10
startLimitIntervalSec=60
WorkingDirectory=/usr/local/bin
ExecStart=/usr/local/bin/GRY
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=GRY
[Install]
WantedBy=multi-user.target
```
## Configuration
GRY can be configured using environment variables:
The folder used to store the redirects will always be in the user's home directory, and the folder needs be already exist with the correct permissions.
```sh
# Change the port (default: 3000)
export GRY_PORT=8080
# Change the storage location (default: .GRY)
export GRY_FOLDER=storage
# Set TOTP secret for admin authentication (required for admin endpoints)
export TOTP_SECRET=your_secret_here
# Using with docker run
docker run -d \
--name gry \
-p 8080:8080 \
-v gry-data:/storage \
-e GRY_PORT=8080 \
-e GRY_FOLDER=storage \
-e GRY_TOTP_SECRET=your_secret_here \
ctrlaltdev/gry:latest
# Using with docker compose
version: '3'
services:
gry:
image: ctrlaltdev/gry:latest
container_name: gry
ports:
- "8080:8080"
volumes:
- gry-data:/storage
environment:
- GRY_PORT=8080
- GRY_FOLDER=storage
- GRY_TOTP_SECRET=your_secret_here
restart: unless-stopped
volumes:
gry-data:
```
When running as a service, you can add these environment variables to the systemd service file:
```
[Service]
// ... existing service configuration ...
Environment=GRY_PORT=8080
Environment=GRY_FOLDER=storage
Environment=GRY_TOTP_SECRET=your_secret_here
// ... rest of service configuration ...
```