summaryrefslogtreecommitdiff
path: root/INSTALL.md
blob: 2ff46a45cb6740068c272e7ebff889a3b6060555 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126

# INSTALL DEPENDENCIES

Vampire requires the following software to operate properly.

- youtube-dl
- ffmpeg  (used by youtube-dl)

Install youtube-dl:

    pip3 install youtube-dl

Install ffmpeg

    sudo apt-get install ffmpeg



# BUILDING 

I have only tested vampire using SBCL on Linux.

First install the dependencies that are not in quicklisp:

    git clone https://cicadas.surf/cgit/colin/derrida.git ~/quicklisp/local-projects/
    git clone https://cicadas.surf/cgit/colin/vampire.git ~/quicklisp/local-projects/

Then cd into the vampire repo's directory and run the build script.

   cd ~/quicklisp/local-projects/vampire
   sbcl --load build.lisp

If it worked, you should be able to find the file bin/vampire.

# SETUP AND CONFIGURATION

## Choose an installation directory

Choose a directory into which vampire files will be placed.  For
example, if you make a user called `vampire`, you can use
`/home/vampire` for the vampire directory.

For the rest of this document, I will refer to whatever directory you
have chosen as $VAMPIRE_HOME.

## CREATE A CONFIGURATION FILE

The configuration file is called config.lisp. Here is an example.

    (:datastore-directory "$VAMPIRE_HOME/store/"
     :static-directory "$VAMPIRE_HOME/static/"
     :swank-port 5011
     :port 8081
     :downloader-threads 8)

Put the above into a file called "$VAMPIRE_HOME/config.lisp".

The :datastore-directory and :static-directory fields are REQUIRED and
must be writable by the vampire process. In particular, a subdirectory
of the static-directory, called media, is where media files will be
stored.

The :port optionis the where the http server will listen for incoming
connections on localhost.  Vampire assumes you are using a reverse
proxy.

The :swank-port field is optional. It is the localhost port where you
can connect via SLIME to debug the live application.

## COPY CSS & CLOG FILES

The application css and necessary clog files are stored in the git
repository within the subdirectory called `static`.  Copy this whole
directory to the location you specified for the `:static-directory`
option in your `config.lisp`:

    cp -r /path/to/vampire.git/static $VAMPIRE_HOME/static


## SET UP A REVERSE PROXY

I am using apache to set up a reverse proxy. If I'm running vampire on
host at 10.0.0.6, and serving over HTTPS using the domain name
vampire.yourhost.moo, then here's how I'd configure the proxy:

    <VirtualHost *:80>
      ServerName vampire.yourhost.moo
      Redirect / "https://vampire.yourhost.moo/"
    </VirtualHost>
    
    <VirtualHost _default_:443>
      ServerName vampire.yourhost.moo
      SSLEngine on
      SSLCertificateFile "/etc/letsencrypt/live/vampire.yourhost.moo/fullchain.pem"
      SSLCertificateKeyFile "/etc/letsencrypt/live/vampire.yourhost.moo/privkey.pem"
    
      ProxyPass /clog  ws://10.0.0.6:8081/clog
      ProxyPass / http://10.0.0.6:8081/	
      ProxyPassReverse / http://10.0.0.6:8081/
    
    </VirtualHost>
    

## SYSTEMD SYSTEM SERVICE 

Use a systemd service to run vampire, ensuring that it restarts on
reboot.


    [Unit]
    Description=Vampire Service
    
    [Service]
    Type=simple
    ExecStart=/home/vampire/vampire/config --config /home/vampire/config.lisp
    Restart=always
    User=vampire
    Group=vampire
    
    
    [Install]
    WantedBy=multi-user.target

Put that  into /etc/systemd/system/

and start it like any other systemd service.