cmc/cleberg.net

My personal web garden & blog.

clone: git clone https://gitbay.org/cmc/cleberg.net.git

main: content/blog/2023-06-30-self-hosting-voyager.org · raw

  1#+date:        [2023-06-30 Fri 00:00:00]
  2#+title:       Self-Hosting Guide: Voyager for Lemmy
  3#+description: How to self-host Voyager, a web client for Lemmy.
  4#+slug:        self-hosting-voyager
  5#+filetags:    :linux:self-hosting:
  6
  7* Installation Guide
  8
  9[[https://github.com/aeharding/voyager][Voyager]] is a mobile-first
 10Lemmy web client, based on iOS design standards. It follows very closely
 11to Apollo's design.
 12
 13This post is a guide showing how I was able to build and launch my own
 14instance of Voyager via Docker Compose.
 15
 16** Clone the Repository
 17
 18Start by cloning the repository and entering it:
 19
 20#+begin_src sh
 21git clone https://github.com/aeharding/voyager
 22cd voyager
 23#+end_src
 24
 25** Build the Image
 26
 27With this repository, you can build the image yourself without any
 28further configuration. When complete, it'll give you the image ID for
 29you to run.
 30
 31#+begin_src sh
 32sudo docker build .
 33# Successfully built 5f00723cb5be
 34#+end_src
 35
 36With the image ID above, you can run the container and pass the
 37requested port =5314= through or use a custom port, if you wish.
 38
 39You can also set the =CUSTOM_LEMMY_SERVERS= environment variable if you
 40want to add to the default suggested login servers. This must be set
 41with a comma separated list of suggested servers. The first instance in
 42the list will be the default view for logged-out users.
 43
 44I will be using a =docker-compose.yml= file to run this container,
 45instead of a =docker run= command.
 46
 47#+begin_src sh
 48nano docker-compose.yml
 49#+end_src
 50
 51#+begin_src conf
 52version: "2"
 53services:
 54  voyager:
 55    image: 5f00723cb5be
 56    restart: always
 57    ports:
 58      - "<custom_port>:5314"
 59    environment:
 60      - CUSTOM_LEMMY_SERVERS=lemmy.dbzer0.com,lemmy.world,lemmy.ml,beehaw.org
 61#+end_src
 62
 63#+begin_src sh
 64sudo docker-compose up -d
 65#+end_src
 66
 67The web app will now be available at the following address:
 68=<machine_ip>:<custom_port>=. If you are running it on your local
 69device, try =localhost:<custom_port>=.
 70
 71** Reverse Proxy
 72
 73If you want to visit this app via an external URL or domain name, you'll
 74need to set up a reverse proxy. The example below uses Nginx as a
 75reverse proxy.
 76
 77Simply create the configuration file, paste the contents below, save the
 78file, symlink the file, and restart Nginx.
 79
 80#+begin_src sh
 81sudo nano /etc/nginx/sites-available/voyager
 82#+end_src
 83
 84#+begin_src conf
 85server {
 86    if ($host ~ ^[^.]+\.example\.com$) {
 87        return 301 https://$host$request_uri;
 88    }
 89
 90    listen [::]:80;
 91    listen 80;
 92    server_name voyager.example.com;
 93    return 404;
 94}
 95
 96server {
 97    listen [::]:443 ssl http2;
 98    listen 443 ssl http2;
 99    server_name voyager.example.com;
100    access_log  /var/log/nginx/voyager.access.log;
101    error_log   /var/log/nginx/voyager.error.log;
102
103    location / {
104        proxy_http_version 1.1;
105        proxy_pass http://localhost:5314;
106        proxy_set_header Host $host;
107    }
108
109    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
110    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
111    include /etc/letsencrypt/options-ssl-nginx.conf;
112    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
113}
114#+end_src
115
116#+begin_src sh
117sudo ln sudo ln -s /etc/nginx/sites-available/voyager /etc/nginx/sites-enabled/voyager
118sudo systemctl restart nginx.service
119#+end_src
120
121The site will now be available at the =server_name= you specified above!
122
123I ran an instance at =voyager.cleberg.net=, which is no longer online.