A Docker image exists for deploying LANraragi installs to your machine easily without disrupting your already-existing web server setup. Docker is the best way to install the software on remote servers. I don't recommand it for Desktop machines and casual users due to it being a bit complex to wield.
Download the Docker setup and install it. Once you're done, execute:
docker run --name=lanraragi -p 3000:3000 \--mount type=bind,source=[YOUR_CONTENT_DIRECTORY],target=/home/koyomi/lanraragi/content \--mount type=bind,source=[YOUR_DATABASE_DIRECTORY],target=/home/koyomi/lanraragi/database \difegue/lanraragi
If your Docker version is below 17.06 and you use the --mount option as listed above, you will get the following error:
unknown flag: --mountSee 'docker run --help'.
You can bypass this issue by using the --volume option for bind-mounting like so:
docker run --name=lanraragi -p 3000:3000 \--volume [YOUR_CONTENT_DIRECTORY]:/home/koyomi/lanraragi/content \--volume [YOUR_CONTENT_DIRECTORY]:/home/koyomi/lanraragi/database \difegue/lanraragi
You can tell Docker to auto-restart the LRR container on boot by adding the --restart always
flag to this command.
If you're running on Windows, please check the syntax for mapping your content directory here.
Windows 7/8 users running the Legacy Docker toolbox will have to explicitly forward port 127.0.0.1:3000 from the host to the container in order to be able to access the app.
The content directory you have to specify in the command above will contain archives you either upload through the software or directly drop in, alongside generated thumbnails. The database directory houses the LANraragi database(As database.rdb), allowing you to hotswap containers without losing any data.
If you don't care too much about being able to backup your database file, you can mount the database directory to a dedicated Docker volume:
docker volume create lrr-databasedocker run --name=lanraragi -p 3000:3000 \--mount type=bind,source=[YOUR_CONTENT_DIRECTORY],target=/home/koyomi/lanraragi/content \--mount source=lrr-database,target=/home/koyomi/lanraragi/database \difegue/lanraragi
The volume can be reused when updating, so your database will still follow along even if the container is destroyed.
Once your LANraragi container is loaded, you can access it at http://localhost:3000 . You can use the following commands to stop/start/remove the container(Removing it won't delete the archive directory you specified) :
docker stop lanraragidocker start lanraragidocker rm lanraragi
​Tags exist for major releases, so you can use those if you want to run another version:
docker run [yadda yadda] difegue/lanraragi:0.4.0
If you're feeling extra dangerous, you can run the last files directly from the dev branch of the Git repo through the nightly tag:
docker run [zoinks] difegue/lanraragi:nightly
Since Docker allows for port mapping, you can most of times map the default port of 3000 to another port on your host quickly.
If you need something a bit more involved (like adding SSL), please check the Network Interfaces section for how to use thhe LRR_NETWORK
environment variable.
The default healthchecks of the Docker container base themselves on port 3000. If you use the LRR_NETWORK variable to change the outgoing port instead of Docker's port mapping, said healthchecks will fail. If you have to use the variable for SSL or the like, I recommend leaving the port in it to 3000 and doing your port mapping on the Docker side.
The container runs the software by default using the uid/gid provided by the LRR_UID/LRR_GID variables. If you don't specify said variables, the container will run under uid/gid 9001/9001.
This is good enough for most scenarios, but in case you need to run it as the current user, you can do the following: docker run [wassup] -e LRR_UID=``id -u $USER`` -e LRR_GID=``id -g $USER`` difegue/lanraragi
This uses id
to automatically fetch your userid/groupid.
As Docker containers are immutable, you need to destroy your existing container and build a new one.
docker pull difegue/lanraragidocker stop lanraragidocker rm lanraragidocker run --name=lanraragi -p 3000:3000 --mount type=bind,source=[YOUR_CONTENT_DIRECTORY],target=/home/koyomi/lanraragi/content difegue/lanraragi
As long as you use the same content directory as the mount source, your data will still be there.
If you update often, you might want to consider using Portainer to redeploy containers without entering the entire configuration every time.
The previous setup gets a working LANraragi container from the Docker Hub, but you can build your own bleeding edge version by executing npm run docker-build
from a cloned Git repo.
This will use your cloned Git repo to build the image, modifications you might have made included.
Of course, this requires a Docker installation. If you're running WSL1, which can't run Docker natively, you can directly use the Docker for Windows executable with a simple symlink:
sudo ln -s '/mnt/c/Program Files/Docker/Docker/resources/bin/docker.exe' \/usr/local/bin/docker