summaryrefslogtreecommitdiff
path: root/Justfile
blob: 188dcacd170d03a730c0eb22db00b60f86f7a8c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
image := 'cr.d464.sh/fct-drive:latest'
remote := 'prod'

_default:
    just --list

build:
    cargo build --release --target-dir target/

dev:
    demon run tinyauth ./tinyauth.sh
    cd frontend && demon run dev -- npm run dev

stop:
    demon stop tinyauth
    demon stop dev

logs:
    demon cat tinyauth | tail -n 100
    demon cat dev | tail -n 100

tail:
    demon tail -f dev

deploy-tinyauth:
    #!/usr/bin/env bash 
    ssh {{remote}} <<EOF
        podman stop fctdrive_tinyauth
        podman rm fctdrive_tinyauth
        podman run -d --network host \
            --name fctdrive_tinyauth \
            -e PORT=3001 \
            -e APP_URL="https://auth.fctdrive.xyz" \
            -e SECRET=$(openssl rand -hex 16) \
            -e OAUTH_AUTO_REDIRECT="google" \
            -e GOOGLE_CLIENT_ID=$(pass google.com/fct-drive/oauth-client-id) \
            -e GOOGLE_CLIENT_SECRET=$(pass google.com/fct-drive/oauth-client-secret) \
            ghcr.io/steveiliop56/tinyauth:v3
    EOF

deploy-frontend: push-container
    #!/usr/bin/env bash
    # sudo mount.cifs -o uid=1000,gid=1000,username=u484453 //u484453.your-storagebox.de/backup fct-drive
    ssh {{remote}} <<EOF
        podman stop fctdrive_frontend
        podman rm fctdrive_frontend
        podman run -td --network host \
            --name fctdrive_frontend \
            -e PORT=3000 \
            -e FCTDRIVE_PATH=/data \
            -e TINYAUTH_ENDPOINT="http://127.0.0.1:3001" \
            -e TINYAUTH_PUBLIC_ENDPOINT="https://auth.fctdrive.xyz" \
            -v /home/diogo464/fct-drive:/data \
            --pull=always \
            {{image}}
    EOF

build-container: build
    cd frontend && npm run build
    podman build -t {{image}} .

push-container: build-container
    podman push {{image}}