更新到0.8.7

This commit is contained in:
unknown 2022-12-03 17:50:16 +08:00
parent 882df1f01c
commit 6fa92f9266
62 changed files with 493 additions and 353 deletions

View File

@ -7,8 +7,8 @@ on:
branches: [ main ]
env:
APP_NAME: lanraragi_cn
DOCKERHUB_REPO: dezhao/lanraragi_cn
APP_NAME: lanraragi_test
DOCKERHUB_REPO: dezhao/lanraragi_test
jobs:
main:
@ -46,9 +46,6 @@ jobs:
# 生成多平台镜像, see https://github.com/docker-library/bashbrew/blob/v0.1.1/architecture/oci-platform.go
platforms: |
linux/amd64
linux/arm/v6
linux/arm/v7
linux/arm64/v8
# docker build arg, 注入 APP_NAME/APP_VERSION
build-args: |
APP_NAME=${{ env.APP_NAME }}
@ -56,4 +53,4 @@ jobs:
# 生成两个 docker tag: ${APP_VERSION} 和 latest
tags: |
${{ env.DOCKERHUB_REPO }}:latest
${{ env.DOCKERHUB_REPO }}:0.8.6
${{ env.DOCKERHUB_REPO }}:0.8.7

View File

@ -1,8 +1,7 @@
# DOCKER-VERSION 0.3.4
FROM alpine:3.12
FROM alpine:3.16
LABEL git="https://github.com/uparrows/LANraragi_cn"
ENV S6_OVERLAY_RELEASE v2.0.0.1
ENV S6_KEEP_ENV 1
# warn if we can't run stage2 (fix-attrs/cont-init)
@ -10,9 +9,11 @@ ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 1
# wait 10s before KILLing
ENV S6_KILL_GRACETIME 10000
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME 0
# s6
ENTRYPOINT ["/init"]
# s6: The init is provided by alpine's s6-overlay package, hence the double slash.
# See https://pkgs.alpinelinux.org/contents?branch=v3.14&name=s6-overlay&arch=x86&repo=community
ENTRYPOINT ["//init"]
# Check application health
HEALTHCHECK --interval=1m --timeout=10s --retries=3 \
@ -22,22 +23,18 @@ HEALTHCHECK --interval=1m --timeout=10s --retries=3 \
#Default mojo server port
EXPOSE 3000
#Enable UTF-8 (might not do anything extra on alpine tho)
# Enable UTF-8 (might not do anything extra on alpine tho)
ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 \
#rootless user id
# root user id
LRR_UID=0 LRR_GID=0 \
#Environment variables overridable by the user on container deployment
# Environment variables overridable by the user on container deployment
LRR_NETWORK=http://*:3000 \
# extra variables
EV_EXTRA_DEFS=-DEV_NO_ATFORK
# we use s6-overlay-nobin to just pull in the s6-overlay arch agnostic (shell)
# components, since we apk install the binaries of s6 later which are arch specific
# /!\ While the s6 version here is fixed by an envvar, the apk install is not pinned and takes whatever's in alpine:latest! This certainly needs a fix.
ADD https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_RELEASE}/s6-overlay-nobin.tar.gz /tmp/s6-overlay-nobin.tar.gz
RUN tar -C / -xzf /tmp/s6-overlay-nobin.tar.gz && rm -f /tmp/s6-overlay-nobin.tar.gz
EV_EXTRA_DEFS=-DEV_NO_ATFORK \
# Enable automatic http proxy detection for mojo
MOJO_PROXY=1 \
# Allow Mojo to automatically pick up the X-Forwarded-For and X-Forwarded-Proto headers
MOJO_REVERSE_PROXY=1
WORKDIR /root/lanraragi
@ -60,8 +57,11 @@ COPY --chown=root:root /tests tests
COPY --chown=root:root /lrr.conf lrr.conf
COPY --chown=root:root /tools/build/docker/redis.conf tools/build/docker/
COPY /tools/build/docker/wsl.conf /etc/wsl.conf
COPY /tools/build/docker/s6/cont-init.d/ /etc/cont-init.d/
COPY /tools/build/docker/s6/services.d/ /etc/services.d/
#Copy s6-overlay 3.x services
#Uses a system-d like definition that can't be use in 2.x
COPY /tools/build/docker/s6/s6-rc.d/ /etc/s6-overlay/s6-rc.d/
#Copy setup script as-is since no changes are needed between 2.x and 3.x
COPY /tools/build/docker/s6/cont-init.d/01-lrr-setup /etc/s6-overlay/s6-rc.d/init/
COPY --chown=root:root /jquery.dataTables.min.js /root/lanraragi/public/js/vendor/jquery.dataTables.min.js
#COPY /tools/build/docker/s6/fix-attrs.d/ /etc/fix-attrs.d/

View File

@ -18,14 +18,18 @@ sub index {
#Build plugin listing
my @pluginlist = get_plugins("metadata");
# Get static category list
my @categories = LANraragi::Model::Category->get_static_category_list;
$self->render(
template => "batch",
plugins => \@pluginlist,
title => $self->LRR_CONF->get_htmltitle,
descstr => $self->LRR_DESC,
csshead => generate_themes_header($self),
tagrules => restore_CRLF( $self->LRR_CONF->get_tagrules ),
version => $self->LRR_VERSION
template => "batch",
plugins => \@pluginlist,
title => $self->LRR_CONF->get_htmltitle,
descstr => $self->LRR_DESC,
csshead => generate_themes_header($self),
tagrules => restore_CRLF( $self->LRR_CONF->get_tagrules ),
categories => \@categories,
version => $self->LRR_VERSION
);
}
@ -96,6 +100,22 @@ sub socket {
return;
}
if ( $operation eq "addcat" ) {
my $catid = $command->{"category"};
my ( $catsucc, $caterr ) = LANraragi::Model::Category::add_to_category( $catid, $id );
$client->send(
{ json => {
id => $id,
category => $catid,
success => $catsucc,
message => $caterr
}
}
);
return;
}
if ( $operation eq "tagrules" ) {
$logger->debug("应用标签规则到 $id...");

View File

@ -54,8 +54,7 @@ sub index {
my $userlogged = $self->LRR_CONF->enable_pass == 0 || $self->session('is_logged');
# Get static category list to populate the right-click menu
my @categories = LANraragi::Model::Category->get_category_list;
@categories = grep { %$_{"search"} eq "" } @categories;
my @categories = LANraragi::Model::Category->get_static_category_list;
$self->render(
template => "index",

View File

@ -14,11 +14,8 @@ sub index {
if ( $self->req->param('id') ) {
# Allow adding to category
my @categories = LANraragi::Model::Category->get_category_list;
# But only to static categories
@categories = grep { %$_{"search"} eq "" } @categories;
# Allow adding to static categories
my @categories = LANraragi::Model::Category->get_static_category_list;
# Get query string from referrer URL, if there's one
my $referrer = $self->req->headers->referrer;

View File

@ -84,10 +84,7 @@ sub index {
my $self = shift;
# Allow adding to category on direct uploads
my @categories = LANraragi::Model::Category->get_category_list;
# But only to static categories
@categories = grep { %$_{"search"} eq "" } @categories;
my @categories = LANraragi::Model::Category->get_static_category_list;
$self->render(
template => "upload",

View File

@ -29,6 +29,17 @@ sub get_category_list {
return @result;
}
# get_static_category_list()
# Returns a list of all the static category objects.
sub get_static_category_list() {
my @categories = get_category_list;
# Filter out dynamic categories
@categories = grep { %$_{"search"} eq "" } @categories;
return @categories;
}
# get_categories_containing_archive(id)
# Returns a list of all the categories that contain the given archive.
sub get_categories_containing_archive {
@ -178,7 +189,7 @@ sub add_to_category {
if ( $redis->exists($cat_id) ) {
unless ( $redis->hget( $cat_id, "search" ) eq "" ) {
$err = "$cat_id 是收藏搜索,无法向其添加档案.";
$err = "$cat_id 是喜爱的搜索/动态类别,无法向其添加档案.";
$logger->error($err);
$redis->quit;
return ( 0, $err );
@ -203,7 +214,8 @@ sub add_to_category {
}
if ( "@cat_archives" =~ m/$arc_id/ ) {
$logger->warn("$arc_id 已经存在于类别 $cat_id 中, 什么也不做.");
$err = "$arc_id 已经存在于类别 $cat_id 中, 什么也不做.";
$logger->warn($err);
$redis->quit;
return ( 1, $err );
}

View File

@ -153,10 +153,12 @@ sub download_url {
die "Not a proper URL" unless $url;
$logger->info("下载 URL $url...这将需要一些时间。");
my $tempdir = tempdir();
my $tx = $ua->max_redirects(5)->get($url);
my $tempdir = tempdir();
# Download the URL, with 5 maximum redirects and unlimited response size.
my $tx = $ua->max_response_size(0)->max_redirects(5)->get($url);
my $content_disp = $tx->result->headers->content_disposition;
my $filename = "Not_an_archive"; #placeholder;
my $filename = "Not_an_archive"; #placeholder;
$logger->debug("Content-Disposition Header: $content_disp");
if ( $content_disp =~ /.*filename=\"(.*)\".*/gim ) {

View File

@ -122,6 +122,12 @@ sub get_search_result_dom {
# * Added a space ahead of the - (hyphen) filter, to only remove hyphens directly prepended to something else (those are the only ones that break searches, probably because the search engine treats them as exclusions as most engines would).
$title =~ s/ -|'\w*|~|!|@//g;
# Removes everything inside [ ] as well as the brackets themselves
$title =~ s/\[([^\[\]]|(?0))*]//g;
# Removes everything inside () as well as the parentheses themselves
$title =~ s/\(.*$//g;
# Visit the base host once to set cloudflare cookies and jank
$ua->max_redirects(5)->get($fakku_host);

View File

@ -45,13 +45,11 @@ sub run_script {
if ($delete_old_cats) {
$logger->info("Deleting all Static Categories before folder walking as instructed.");
my @categories = LANraragi::Model::Category->get_category_list;
my @categories = LANraragi::Model::Category->get_static_category_list;
for my $category (@categories) {
if ( %{$category}{"search"} eq "" ) {
my $cat_id = %{$category}{"id"};
$logger->debug("Deleting '$cat_id'");
LANraragi::Model::Category::delete_category($cat_id);
}
my $cat_id = %{$category}{"id"};
$logger->debug("Deleting '$cat_id'");
LANraragi::Model::Category::delete_category($cat_id);
}
}

View File

@ -295,6 +295,7 @@ sub clean_database {
$redis->hset( $id, "file", "" );
} else {
change_archive_id( $id, $newid, $redis );
$redis->hset( "LRR_FILEMAP", $file, $newid );
}
} else {

View File

@ -56,7 +56,7 @@ sub trim_url {
# Checks if the provided file is an image.
# Uses non-capturing groups (?:) to avoid modifying the incoming argument.
sub is_image {
return $_[0] =~ /^.+\.(?:png|jpg|gif|bmp|jpeg|jfif|webp|avif|heif|heic)$/i;
return $_[0] =~ /^.+\.(?:png|jpg|gif|bmp|jpeg|jfif|webp|avif|heif|heic|jxl|)$/i;
}
# Checks if the provided file is an archive.
@ -142,6 +142,9 @@ sub start_minion {
# Freeze the process object in the PID file
store \$proc, get_temp . "/minion.pid";
open( my $fh, ">", get_temp . "/minion.pid-s6" );
print $fh $proc->pid;
close($fh);
return $proc;
}
@ -164,6 +167,9 @@ sub start_shinobu {
# Freeze the process object in the PID file
store \$proc, get_temp . "/shinobu.pid";
open( my $fh, ">", get_temp . "/shinobu.pid-s6" );
print $fh $proc->pid;
close($fh);
return $proc;
}

View File

@ -227,6 +227,8 @@ sub add_to_filemap {
LANraragi::Utils::Database::change_archive_id( $filemap_id, $id, $redis );
# Don't forget to update the filemap, later operations will behave incorrectly otherwise
$redis->hset( "LRR_FILEMAP", $file, $id );
} else {
$logger->debug(
"$file has the same ID as the one in the filemap. Duplicate inotify events? Cleaning cache just to make sure");

View File

@ -1,17 +1,18 @@
{
"name": "lanraragi",
"version": "0.8.6",
"version_name": "郊区佛爷",
"version": "0.8.7",
"version_name": "外边",
"description": "我一世英名恐怕要毁在日本文化的影响下了!",
"scripts": {
"test": "prove -r -l -v tests/",
"lanraragi-installer": "perl ./tools/install.pl",
"lint": "eslint --ext .js public/",
"start": "perl ./script/launcher.pl -f ./script/lanraragi",
"dev-server": "perl ./script/launcher.pl -m -v ./script/lanraragi ",
"dev-server": "perl ./script/launcher.pl -m -v ./script/lanraragi",
"docker-build": "docker build -t difegue/lanraragi -f ./tools/build/docker/Dockerfile .",
"critic": "perlcritic ./lib/* ./script/* ./tools/install.pl",
"backup-db": "perl ./script/backup"
"backup-db": "perl ./script/backup",
"get-version": "perl -Mojo -E \"my \\$conf = j(f(qw(package.json))->slurp); say %\\$conf{version} .q/ - '/. %\\$conf{version_name} .q/'/ \""
},
"repository": {
"type": "git",

View File

@ -157,6 +157,7 @@ Batch.startBatch = function () {
const commandBase = {
operation: Batch.currentOperation,
plugin: Batch.currentPlugin,
category: $("#category").val(),
args,
};
@ -223,6 +224,11 @@ Batch.updateBatchStatus = function (event) {
case "tagrules":
$("#log-container").append(`修改 ID ${msg.id} (新标签: ${msg.tags})\n\n`);
break;
case "addcat":
// Append the message at the end of this log,
// as it can contain the warning about the ID already being in the category
$("#log-container").append(`已添加 ID ${msg.id} 到分类 ${msg.category}! ${msg.message} \n\n`);
break;
case "clearnew": {
$("#log-container").append(`清除了NEW标志 ID ${msg.id}\n\n`);
// Remove last character from matching row

View File

@ -19,7 +19,7 @@
<script src="/js/vendor/preact.umd.js" type="text/JAVASCRIPT"></script>
<script src="/js/vendor/hooks.umd.js" type="text/JAVASCRIPT"></script>
<script src="/js/vendor/compat.umd.js" type="text/JAVASCRIPT"></script>
<script>window.React=window.preactCompat;window.react=window.preactCompat;</script>
<script>window.React = window.preactCompat; window.react = window.preactCompat;</script>
<script src="/js/vendor/clsx.min.js" type="text/JAVASCRIPT"></script>
<script src="/js/vendor/react-toastify.umd.js" type="text/JAVASCRIPT"></script>
<script src="/js/vendor/sweetalert2.min.js" type="text/JAVASCRIPT"></script>
@ -54,6 +54,7 @@
<option value="plugin">🧩 调用插件</option>
<option value="clearnew">🆕 移除NEW标签</option>
<option value="tagrules">📏 应用标签规则</option>
<option value="addcat">📚 添加到分类</option>
<option value="delete">🗑️ 删除档案</option>
</select>
</td>
@ -123,6 +124,17 @@
</td>
</tr>
<tr class="operation addcat-operation">
<td>添加到分类 :</td>
<td>
<select id="category" class="favtag-btn">
[% FOREACH categories %]
<option value="[% id %]">[% name %]</option>
[% END %]
</select>
</td>
</tr>
<tr class="operation delete-operation">
<td></td>
<td style="font-size:36px; text-align: center;">

View File

@ -44,6 +44,7 @@
<h1 style="margin-bottom: 2px">LANraragi</h1>
版本 [% version %], "[% vername %]"
<br>
汉化:<a href="http://yuanfangblog.xyz"> 昭君 </a>
<h2>选择一个分类以显示相关设置。</h2>
<br />
<input id='save' class='stdbtn' type='button' value='保存配置' /><br />

View File

@ -85,8 +85,7 @@
<td class="config-td">
<input id="tagruleson" name="tagruleson" class="fa" type="checkbox" [% IF tagruleson %]checked[% END %]>
<br>
<textarea class="stdinput" size="20" style='width:100%; height:196px' name="tagrules"
maxlength='5000'>[% tagrules %]</textarea>
<textarea class="stdinput" size="20" style='width:100%; height:196px' name="tagrules">[% tagrules %]</textarea>
<br>使用插件标记档案时,此处指定的规则将在保存之前应用于标记档案
到数据库.
<br>使用换行符拆分规则.

View File

@ -11,7 +11,6 @@
* [🛠 Source Code (Linux/macOS)](installing-lanraragi/source.md)
* [🐧 Community (Linux)](installing-lanraragi/community.md)
* [👿 Jail (FreeBSD)](installing-lanraragi/jail.md)
* [🕸 Vagrant (Deprecated)](installing-lanraragi/vagrant.md)
## Basic Operations
@ -30,6 +29,7 @@
* [💾 Backup and Restore](advanced-usage/backup-and-restore.md)
* [📱 Using External Readers](advanced-usage/external-readers.md)
* [🌐 Network Interface Setup](advanced-usage/network-interfaces.md)
* [🕵️ Proxy Setup](advanced-usage/proxy-setup.md)
* [📏 Tag Rules](advanced-usage/tag-rules.md)
## Developer Guide <a href="extending-lanraragi" id="extending-lanraragi"></a>
@ -45,6 +45,7 @@
* [Database API](api-documentation/database-api.md)
* [Category API](api-documentation/category-api.md)
* [Shinobu API](api-documentation/shinobu-api.md)
* [Minion API](api-documentation/minion-api.md)
* [Miscellaneous other API](api-documentation/miscellaneous-other-api.md)
## Writing Plugins <a href="plugin-docs" id="plugin-docs"></a>

View File

@ -12,6 +12,11 @@ This allows you to seamlessly add archives from the Internet to your LRR instanc
By default, we will try to download any URL you chuck at us! This will mostly work for simple URLs that point directly to a file we support.
(For example, something like this very nice Quake booklet: `https://archive.org/download/quake-essays-sep-15-fin-4-graco-l-cl/QUAKE_essays_SEP15_FIN4_GRACoL_CL.pdf` will download without a fuss.)
{% hint style="info" %}
Downloaded archives will automatically get a `source:` tag with the URL they were downloaded from.
Said source tags can often be used with compatible Metadata plugins to fetch metadata precisely. (Supported by E-H and nH)
{% endhint %}
For non-direct links, you will need to have a matching **Downloader Plugin** configured.
LANraragi currently ships with Downloaders handling E-H and Chaika links.

View File

@ -40,7 +40,7 @@ Server available at http://127.0.0.1:8000
```bash
docker run --name=lanraragi -p 8000:8000 \
--mount type=bind,source=[YOUR_CONTENT_DIRECTORY],\
target=/home/koyomi/lanraragi/content \
target=/root/lanraragi/content \
-e LRR_NETWORK=http://*:8000 difegue/lanraragi
```
@ -49,7 +49,7 @@ target=/home/koyomi/lanraragi/content \
```bash
docker run --name=lanraragi-ssl -p 3333:3333 \
--mount type=bind,source=[YOUR_CONTENT_DIRECTORY],\
target=/home/koyomi/lanraragi/content \
target=/root/lanraragi/content \
--mount type=bind,source=[DIRECTORY_CONTAINING_SSL_CERT],target=/ssl \
-e LRR_NETWORK="https://*:3333?cert=/ssl/crt.crt&key=/ssl/crt.key" difegue/lanraragi
```

View File

@ -0,0 +1,67 @@
# 🕵️ Proxy Setup
## Setting up LANraragi behind a proxy (reverse proxy setup)
A common post-install setup is to make requests to the app transit through a gateway server such as Apache or nginx.
If you do so, please note that archive uploads through LRR will likely **not work out of the box** due to maximum sizes on uploads those servers can enforce. The example below is for nginx:
```
http {
client_max_body_size 0; <----------------------- This line here
}
server {
listen 80;
server_name lanraragi.[REDACTED].net;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
index index.php index.html index.htm;
server_name lanraragi.[REDACTED].net;
client_max_body_size 0; <----------------------- And this line here
# Cert Stuff Omitted
location / {
proxy_pass http://0.0.0.0:3000;
proxy_http_version 1.1;
<----- The two following lines are needed for batch tagger support with SSL ----->
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
```
## Setting up LANraragi to use a proxy for outbound network requests
This is a less common scenario, but you might want to have downloads or metadata requests to external services go through a proxy, in case said external services are blocked by your friendly local totalitarian regime.
LANraragi runs on top of the Mojolicious web server, which has [built-in](https://docs.mojolicious.org/Mojo/UserAgent/Proxy#detect) support for proxifying external requests.
To enable automatic proxy detection, the `MOJO_PROXY` environment variable must be set to 1 on your machine: This is enabled by default on Docker builds.
Once said detection enabled, environment variables `HTTP_PROXY, http_proxy, HTTPS_PROXY, https_proxy, NO_PROXY` and `no_proxy` will be checked for proxy information.
Here's an example for a Docker-compose setup:
```
---
version: "2.1"
services:
lanraragi:
image: difegue/lanraragi:latest
container_name: lanraragi
environment:
- http_proxy=http://192.168.10.186:1082
- https_proxy=http://192.168.10.186:1082
volumes:
- [database]:/root/lanraragi/database
- [content]:/root/lanraragi/content
ports:
- 7070:3000
restart: unless-stopped
```

View File

@ -10,11 +10,7 @@ Get tags from the database, with a value symbolizing their prevalence.
{% endswagger-description %}
{% swagger-parameter name="minweight" type="int" required="false" in="query" %}
Add this parameter if you want to only get tags whose weight is at least the given minimum.
\
Add this parameter if you want to only get tags whose weight is at least the given minimum.
Default is 1 if not specified, to get all tags.
{% endswagger-parameter %}
@ -51,11 +47,7 @@ Cleans the Database, removing entries for files that are no longer on the filesy
{% swagger baseUrl="http://lrr.tvc-16.science" path="/api/database/drop" method="post" summary="🔑Drop the Database" %}
{% swagger-description %}
Delete the entire database, including user preferences.
\
Delete the entire database, including user preferences.
This is a rather dangerous endpoint, invoking it might lock you out of the server as a client!
{% endswagger-description %}
@ -71,11 +63,7 @@ This is a rather dangerous endpoint, invoking it might lock you out of the serve
{% swagger baseUrl="http://lrr.tvc-16.science" path="/api/database/backup" method="get" summary="🔑Get a backup JSON" %}
{% swagger-description %}
Scans the entire database and returns a backup in JSON form.
\
Scans the entire database and returns a backup in JSON form.
This backup can be reimported manually through the Backup and Restore feature.
{% endswagger-description %}

View File

@ -0,0 +1,77 @@
---
description: Control the built-in Minion Job Queue.
---
# Minion API
{% swagger baseUrl="http://lrr.tvc-16.science" path="/api/minion/:jobid" method="get" summary="Get the basic status of a Minion Job" %}
{% swagger-description %}
For a given Minion job ID, check whether it succeeded or failed.
Minion jobs are ran for various occasions like thumbnails, cache warmup and handling incoming files.
{% endswagger-description %}
{% swagger-parameter name="id" type="string" required="true" in="path" %}
ID of the Job.
{% endswagger-parameter %}
{% swagger-response status="200" description="You get job data." %}
```javascript
{
"state": "finished",
"task": "handle_upload",
"error": null
}
{
"state": "failed",
"task": "thumbnail_task",
"error": "oh no"
}
```
{% endswagger-response %}
{% endswagger %}
{% swagger baseUrl="http://lrr.tvc-16.science" path="/api/minion/:jobid/detail" method="get" summary="🔑Get the full status of a Minion Job" %}
{% swagger-description %}
Get the status of a Minion Job.
This API is there for internal usage mostly, but you can use it to get detailed status for jobs like plugin runs or URL downloads.
{% endswagger-description %}
{% swagger-parameter name="id" type="string" required="true" in="path" %}
ID of the Job.
{% endswagger-parameter %}
{% swagger-response status="200" description="You get detailed job data." %}
```javascript
{
"args": ["\/tmp\/QF3UCnKdMr\/myfile.zip"],
"attempts": 1,
"children": [],
"created": "1601145004",
"delayed": "1601145004",
"expires": null,
"finished": "1601145004",
"id": 7,
"lax": 0,
"notes": {},
"parents": [],
"priority": 0,
"queue": "default",
"result": {
"id": "75d18ce470dc99f83dc355bdad66319d1f33c82b",
"message": "This file already exists in the Library.",
"success": 0
},
"retried": null,
"retries": 0,
"started": "1601145004",
"state": "finished",
"task": "handle_upload",
"time": "1601145005",
"worker": 1
}
```
{% endswagger-response %}
{% endswagger %}

View File

@ -283,10 +283,18 @@ You can either use `login`, `metadata`, `script`, or `all` to get all previous t
{
"desc": "Save archive title",
"type": "bool"
},
{
"desc": "Save the original title when available instead of the English or romanised title",
"type": "bool"
},
{
"desc": "Fetch additional timestamp (time posted) and uploader metadata",
"type": "bool"
}
],
"type": "metadata",
"version": "2.2"
"version": "2.3"
},
{
"author": "Pao",
@ -456,47 +464,4 @@ Whether to generate all thumbnails, or only the missing ones.
}
```
{% endswagger-response %}
{% endswagger %}
{% swagger baseUrl="http://lrr.tvc-16.science" path="/api/minion/:jobid" method="get" summary="🔑Get the status of a Minion Job" %}
{% swagger-description %}
Get the status of a Minion Job. Minions jobs are ran for various occasions like thumbnails, cache warmup and handling incoming files.
Usually stuff you don't need to care about as a client, but the API is there for internal usage mostly.
{% endswagger-description %}
{% swagger-parameter name="id" type="string" required="true" in="path" %}
ID of the Job.
{% endswagger-parameter %}
{% swagger-response status="200" description="" %}
```javascript
{
"args": ["\/tmp\/QF3UCnKdMr\/myfile.zip"],
"attempts": 1,
"children": [],
"created": "1601145004",
"delayed": "1601145004",
"expires": null,
"finished": "1601145004",
"id": 7,
"lax": 0,
"notes": {},
"parents": [],
"priority": 0,
"queue": "default",
"result": {
"id": "75d18ce470dc99f83dc355bdad66319d1f33c82b",
"message": "This file already exists in the Library.",
"success": 0
},
"retried": null,
"retries": 0,
"started": "1601145004",
"state": "finished",
"task": "handle_upload",
"time": "1601145005",
"worker": 1
}
```
{% endswagger-response %}
{% endswagger %}
{% endswagger %}

View File

@ -40,3 +40,9 @@ Plugins have as much control over your system as the main LANraragi application
When installing Plugins from unknown sources, do a little research first.
{% endhint %}
## About source: tags
If your archive has a `source:` tag (likely from the use of the [built-in downloading feature](../advanced-usage/downloading.md)), many plugins will use said tag to directly fetch metadata from it without having to use heuristics of any kind to guess what your archive is.
If you have the URL on hand directly, you can either add it as a `source:` tag to your archive, or use it as a one-shot parameter on most downloader plugins.

View File

@ -10,5 +10,5 @@ You can write your own themes by modifying the existing ones - Dropping them in
{% hint style="warning" %}
For users who don't have access to the app folder and want to make custom themes, your only option currently is to use a custom CSS browser extension.
Docker users can try binding a folder on their machine to the _/home/koyomi/lanraragi/public/themes_ folder.
Docker users can try binding a folder on their machine to the _/root/lanraragi/public/themes_ folder.
{% endhint %}

View File

@ -24,7 +24,7 @@ Those variables were introduced for the Homebrew package, but they can be declar
While Perl's mantra is "There's more than one way to do it", I try to make LRR follow the PBP, aka Perl Best Practices.
This is done by the use of the [Perl::Critic](https://metacpan.org/pod/Perl::Critic) module, which reports PBP violations.
If installed, you can run the critic on the entire LRR source tree through the `npm run critic` shortcut command.
Critic is automatically run on every commit made to LRR at the level 5 thanks to [Github Actions](../../../.github/main.workflow).
Critic is automatically run on every commit made to LRR at the level 5 thanks to [GitHub Actions](../../../.github/main.workflow).
I also run [perltidy](https://en.wikipedia.org/wiki/PerlTidy) on the source tree every now and then for consistency.
The rules used in perltidy passes are stored in the .perltidyrc file at the source root.
@ -47,14 +47,14 @@ I recommend trying to only use exported functions in your code, and consider the
```
root/
|- .devcontainer <- VSCode setup files for Codespaces
|- .github <- Github-specific files
|- .github <- GitHub-specific files
| |- action-run-tests <- Run the LRR Test Suite
| |- ISSUE_TEMPLATE <- Template for bug reports
| |- workflows <- Github Actions workflows
| |- workflows <- GitHub Actions workflows
| |- CD <- Continuous Delivery, Nightly builds
| |- CI <- Tests
| +- Release <- Build latest and upload .zip to release post on GH
| +- FUNDING.yml <- Github Sponsors file
| +- FUNDING.yml <- GitHub Sponsors file
|
|- content <- Default content folder
|
@ -117,7 +117,6 @@ root/
| |- windows <- Windows build script and submodule link to the Karen WPF Bootstrapper
| |- docker <- Dockerfile and configuration files for LRR Docker Container
| |- homebrew <- Script and configuration files for the LRR Homebrew cask
| |- vagrant <- Vagrantfile for LRR Vagrant Machine
| |- cpanfile <- Perl dependencies description
| |- install.pl <- LANraragi Installer
| +- lanraragi-systemd.service <- Example SystemD service

View File

@ -12,43 +12,24 @@ Docker is the best way to install the software on remote servers. I don't recomm
## Cloning the base LRR image
Download [the Docker setup](https://www.docker.com/products/docker) and install it. Once you're done, execute:
```bash
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
```
Download [the Docker setup](https://www.docker.com/products/docker) and install it.
{% hint style="warning" %}
If your Docker version is [_below 17.06_](https://docs.docker.com/storage/bind-mounts/) and you use the --mount option as listed above, you will get the following error:
```bash
unknown flag: --mount
See 'docker run --help'.
```
You can bypass this issue by using the --volume option for bind-mounting like so:
```bash
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
```
The LRR Docker container uses a fairly recent ([3.14](https://alpinelinux.org/posts/Alpine-3.14.0-released.html)) version of Alpine Linux as its base. I recommend you use at least Docker version **20.10.0** to avoid issues with the `faccessat2` syscall.
You can check your Docker version by executing `docker version`.
{% endhint %}
Once you're done, execute:
```bash
docker run --name=lanraragi -p 3000:3000 \
--mount type=bind,source=[YOUR_CONTENT_DIRECTORY],target=/root/lanraragi/content \
--mount type=bind,source=[YOUR_DATABASE_DIRECTORY],target=/root/lanraragi/database \
difegue/lanraragi
```
{% hint style="info" %}
You can tell Docker to auto-restart the LRR container on boot by adding the `--restart always` flag to this command.
{% endhint %}
{% hint style="warning" %}
If you're running on Windows, please check the syntax for mapping your content directory [here](https://docs.docker.com/docker-for-windows/#shared-drives).
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.
{% endhint %}
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.
@ -58,8 +39,8 @@ You can also mount the database directory to a dedicated Docker volume:
```bash
docker volume create lrr-database
docker 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 \
--mount type=bind,source=[YOUR_CONTENT_DIRECTORY],target=/root/lanraragi/content \
--mount source=lrr-database,target=/root/lanraragi/database \
difegue/lanraragi
```
@ -84,10 +65,28 @@ If you're feeling **extra dangerous**, you can run the last files directly from
`docker run [zoinks] difegue/lanraragi:nightly`
{% endhint %}
## Platform-specific caveats
### Windows
If you're running on Windows, please check the syntax for mapping your content directory [here](https://docs.docker.com/docker-for-windows/#shared-drives).
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.
### Raspbian
If you're using **Raspbian**, it's likely you'll encounter installation issues like `s6-svscan: warning: unable to iopause: Operation not permitted` due to their outdated version of `libseccomp`.
You can fix this by either adding `--security-opt seccomp=unconfined` to your Docker arguments(discouraged, allows LRR wider access to underlying OS), or by installing an up-to-date version of `libseccomp`:
```bash
wget http://ftp.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_2.5.1-1~bpo10+1_armhf.deb
sudo dpkg -i libseccomp2_2.5.1-1~bpo10+1_armhf.deb
```
Regular versions of Debian shouldn't have this issue.
## Changing the port
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.
If you need something a bit more involved (like adding SSL), please check the Network Interfaces section for how to use the `LRR_NETWORK` environment variable.
{% content-ref url="../advanced-usage/network-interfaces.md" %}
[network-interfaces.md](../advanced-usage/network-interfaces.md)
@ -116,10 +115,13 @@ As Docker containers are immutable, you need to destroy your existing container
docker pull difegue/lanraragi
docker stop lanraragi
docker rm lanraragi
docker run --name=lanraragi -p 3000:3000 --mount type=bind,source=[YOUR_CONTENT_DIRECTORY],target=/home/koyomi/lanraragi/content difegue/lanraragi
docker run --name=lanraragi -p 3000:3000 \
--mount type=bind,source=[YOUR_CONTENT_DIRECTORY],target=/root/lanraragi/content \
--mount type=bind,source=[YOUR_DATABASE_DIRECTORY],target=/root/lanraragi/database \
difegue/lanraragi
```
As long as you use the same content directory as the mount source, your data will still be there.
As long as you use the same content/database directories as before, your data will still be there.
{% hint style="info" %}
If you update often, you might want to consider using docker-compose or [Portainer](https://portainer.io) to redeploy containers without entering the entire configuration every time.

View File

@ -1,4 +1,4 @@
# 🍎 Homebrew (macOS)
# 🍎 Homebrew (macOS/Linux)
## Migration
@ -34,8 +34,9 @@ brew install lanraragi
## Configuration
Your content folder is stored by default in `${HOME}/Library/Application Support/LANraragi`.
The Redis database is stored in `${HOME}/Library/Application Support/LANraragi/database`. The content folder can be moved to any folder you want through the in-app settings page.
Your content folder is stored by default in `${HOME}/Library/Application Support/LANraragi`. (`${HOME}/LANraragi/content` on Linux.)
The Redis database is stored in `${HOME}/Library/Application Support/LANraragi/database`. (`${HOME}/LANraragi/database` on Linux.)
While the in-app settings page won't allow you to change the location of the content folder, you can do so by overriding the `LRR_DATA_DIRECTORY` environment variable before launching.
## Usage
@ -64,4 +65,4 @@ The same warning as in the Installation step applies.
## Uninstallation
Run `brew remove lanraragi` to uninstall the app.
Data in the `${HOME}/Library/Application Support/LANraragi` folder is not deleted.
Data in the `${HOME}/Library/Application Support/LANraragi`/`${HOME}/LANraragi/` folder is not deleted.

View File

@ -9,9 +9,9 @@ However, a lot of work as been done behind the scenes to make it easy!
Look at the methods below for something that fits your OS and usage.
## macOS: _Homebrew_
## Linux/macOS: _Homebrew_
[Homebrew](https://brew.sh) allows you to quickly setup LRR on macOS without relying on containers or modifying your preinstalled system libaries.
[Homebrew](https://brew.sh) allows you to quickly setup LRR on macOS and Linux without relying on containers or modifying your preinstalled system libaries.
![brew](<../.screenshots/brew.jpg>)
@ -23,9 +23,6 @@ Look at the methods below for something that fits your OS and usage.
{% hint style="warning" %}
This method works on **64-bit** editions of Windows 10 only.
Since LRR 0.8.0, you need Windows 10 version _1903_ at least. 0.7.9 will work with version _1809_ if you're on an LTSC channel.
If you still want to use further server versions on 1809, a step-by-step workaround is available on the Windows documentation page below.
{% endhint %}
![win10](../.screenshots/karen.jpg)
@ -69,51 +66,8 @@ Similar to installing from source with an altered process for FreeBSD compatabil
[jail.md](jail.md)
{% endcontent-ref %}
## Older Windows: _Legacy Docker Toolbox or Vagrant_
## Windows 7 or 8: don't
![I really hope you guys don't do this](../.screenshots/shiggy.png)
At this point the only solutions I have to give you are basically glorified VMs.
You can either download the [Legacy Docker Toolbox](https://docs.docker.com/toolbox/toolbox\_install\_windows/) and follow the Docker tutorial linked above, or try Vagrant. I provide **no support** for either of these methods.
{% content-ref url="vagrant.md" %}
[vagrant.md](vagrant.md)
{% endcontent-ref %}
## WARNING: Reverse Proxies
A common post-install setup is to make requests to the app transit through a gateway server such as Apache or nginx.
If you do so, please note that archive uploads through LRR will likely **not work out of the box** due to maximum sizes on uploads those servers can enforce. The example below is for nginx:
```
http {
client_max_body_size 0; <----------------------- This line here
}
server {
listen 80;
server_name lanraragi.[REDACTED].net;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
index index.php index.html index.htm;
server_name lanraragi.[REDACTED].net;
client_max_body_size 0; <----------------------- And this line here
# Cert Stuff Omitted
location / {
proxy_pass http://0.0.0.0:3000;
proxy_http_version 1.1;
<----- The two following lines are needed for batch tagger support with SSL ----->
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
```
Switch to 10 or Linux.

View File

@ -20,14 +20,14 @@ For information, my personal tests are done using Debian's vendor Perl.
apt-get update
apt-get upgrade -y
apt-get install build-essential make gnupg pkg-config \
cpanminus redis-server libarchive-dev imagemagick webp libssl-dev zlib1g-dev \
cpanminus redis-server libarchive-dev imagemagick webp libssl-dev zlib1g-dev libjxl-dev \
perlmagick ghostscript npm
```
_Base software dependencies._
{% hint style="info" %}
If your package manager requires you to specify which ImageMagick version to install you need to choose version 7.
If your package manager requires you to specify which ImageMagick version to install, choose version 7.
{% endhint %}
{% hint style="info" %}
@ -37,14 +37,17 @@ For macOS, you should be able to install the dependencies using Homebrew.
## Installing LRR
All you need to do is clone the git repo somewhere (or download one of [the releases](https://github.com/Difegue/LANraragi/releases)) and run the installer.
I recommend doing this with a brand new Linux user account. (I'm using "koyomi" here):
I recommend doing this with a brand new Linux user account. (I'm using "root" here):
```
git clone -b master http://github.com/Difegue/LANraragi /home/koyomi/lanraragi
cd /home/koyomi/lanraragi && sudo npm run lanraragi-installer install-full
git clone -b master http://github.com/Difegue/LANraragi /root/lanraragi
cd /root/lanraragi && sudo npm run lanraragi-installer install-full
```
Note: Do not use `sudo` in the above command if you are using `perlbrew`.
{% hint style="info"}
Do not use `sudo` in the above command if you are using `perlbrew`.
Arch users might need to install `perl-config-autoconf` and use env variable `export PERL5LIB=~/perl5/lib/perl5` before running the installer.
{% endhint %}
Once this is done, you can get started by running `npm start` and opening [http://localhost:3000](http://localhost:3000).

View File

@ -2,12 +2,22 @@
## Download a Release
You can directly install LANraragi from the [Microsoft Store](https://cutt.ly/9TJIMC6). This will install the latest release.
[<img src="https://getbadgecdn.azureedge.net/images/English_L.png">](https://cutt.ly/9TJIMC6)
You can directly install LANraragi from the Microsoft Store, using either this link: (paste in a browser window)
ms-windows-store://pdp/?productid=XP9K4NMNPDMH6L
Or through winget:
```
winget install lanraragi
```
{% hint style="warning" %}
The installer will tell you about this anyways, but LRR for Windows **requires** the Windows Subsystem for Linux to function properly.
Read the tutorial [here](https://docs.microsoft.com/en-us/windows/wsl/install) to see how to enable WSL on your Windows 10 machine.
WSL defaults to WSL2, so if the installer doesn't work properly make sure you have virtualization enabled as well, or switch to WSL1. (`wsl --set-default-version 1`)
You don't need to install a distribution through the Windows Store, as that is handled by the LRR installer package.
{% endhint %}
As an alternative, you can always download the latest Windows MSI Installer on the [Release Page](https://github.com/Difegue/LANraragi/releases).
@ -23,44 +33,13 @@ You might get a SmartScreen prompt from Windows (doesn't seem to happen with the
(If you're wondering why I don't sign installers, [this](https://gaby.dev/posts/code-signing) article is a good read.)
{% hint style="info" %}
MS Store installs will be installed to the default location. If you don't want the app to install in _%AppData%_, consider downloading the installer and running it manually.
{% endhint %}
{% hint style="warning" %}
The installer will tell you about this anyways, but LRR for Windows **requires** the Windows Subsystem for Linux to function properly.
Read the tutorial [here](https://docs.microsoft.com/en-us/windows/wsl/install) to see how to enable WSL on your Windows 10 machine.
You don't need to install a distribution through the Windows Store, as that is handled by the LRR installer package.
MS Store/winget installs will be installed to the default location. If you don't want the app to install in _%AppData%_, consider downloading the installer and running it manually.
{% endhint %}
Once the install completes properly, you'll be able to launch the GUI from the shortcut in your Start Menu:
![](../.screenshots/karen-startmenu.png)
## Installation on Windows 10 1809 (LTSC)
Recent MSI packages don't install on 1809 anymore due to underlying changes to make the installer lighter, but you can still sideload the latest server version on top of an old 0.7.9 install.
{% hint style="warning" %}
This method shouldn't break in the foreseeable future, but as the Win32 bootstrapper will still be the 0.7.9 version, you might lose out on future functionalities later on.
You might want to consider switching to a [source install](./source.md) on top of a Debian WSL distro you'd maintain yourself.
{% endhint %}
1. Install 0.7.9 like normal, this is mostly done to get the Win32 UI application installed on to your taskbar, we'll install the updated Linux image next.
2. If you started the service and the Windows application, make sure to close BOTH.
3. Download the [MSI installer for the latest version](https://github.com/Difegue/LANraragi/releases/latest)
4. Open the MSI file in 7zip, and extract the "package.tar" file, which is the underlying Linux image
5. Download [LxRunOffline](https://github.com/DDoSolitary/LxRunOffline/releases) and put it in the same directory as the "package.tar" file you just extracted
6. Uninstall the old Linux image from 0.7.9 with the following command, make sure to have your command window opened as administrator:
`lxrunoffline ui -n lanraragi`
7. install the new image:
`lxrunoffline i -n lanraragi -d "C:\Users\*your user name*\AppData\Roaming\LANraragi\Distro\rootfs" -f LANraragi.tar`
Note: the name of the install HAS to be "lanraragi", do not change this on the -n argument
8. Start the application again, and you should see that it now shows the newest version of the server
## Configuration
Starting the GUI for the first time will prompt you to setup your content folder and the port you want the server to listen on. The main GUI is always available from your Taskbar.

View File

@ -24,7 +24,7 @@ Basically, _as long as it can run, it will run_.
{% hint style="danger" %}
As you might've guessed, Plugins run with the same permissions as the main application.
This means they can modify the application database at will, delete files, and execute system commands.
None of this is obviously an issue if the application is installed in a proper fashion.(Docker/Vagrant, or non-root user on Linux _I seriously hope you guys don't run this as root_)
None of this is obviously an issue if the application is installed in a proper fashion.(Docker/VM, or non-root user on Linux _I seriously hope you guys don't run this as root_)
Still, as said in the User Documentation, be careful of what you do with Plugins.
{% endhint %}
@ -69,7 +69,7 @@ The `type` field can be either:
* `login` for [Login Plugins](login.md)
* `metadata` for [Metadata Plugins](metadata.md)
* `download` for [Downloader Plugins](downloaders.md)
* `download` for [Downloader Plugins](download.md)
* `script` for [Script Plugins](scripts.md)
The `parameters` array can contain as many arguments as you need. They can be set by the user in Plugin Configuration, and are transmitted every time.

View File

@ -24,6 +24,7 @@ The variables match the parameters you've entered in the `plugin_info` subroutin
The `$lrr_info` hash contains various variables you can use in your plugin:
* _$lrr\_info->{archive\_id}_: The internal ID of the archive.
* _$lrr\_info->{archive\_title}_: The title of the archive, as entered by the User.
* _$lrr\_info->{existing\_tags}_: The tags that are already in LRR for this archive, if there are any.
* _$lrr\_info->{thumbnail\_hash}_: A SHA-1 hash of the first image of the archive.

View File

@ -1,8 +1,7 @@
# DOCKER-VERSION 0.3.4
FROM alpine:3.12
LABEL git="https://github.com/Difegue/LANraragi"
FROM alpine:3.16
LABEL git="https://github.com/uparrows/LANraragi_cn"
ENV S6_OVERLAY_RELEASE v2.0.0.1
ENV S6_KEEP_ENV 1
# warn if we can't run stage2 (fix-attrs/cont-init)
@ -10,9 +9,11 @@ ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 1
# wait 10s before KILLing
ENV S6_KILL_GRACETIME 10000
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME 0
# s6
ENTRYPOINT ["/init"]
# s6: The init is provided by alpine's s6-overlay package, hence the double slash.
# See https://pkgs.alpinelinux.org/contents?branch=v3.14&name=s6-overlay&arch=x86&repo=community
ENTRYPOINT ["//init"]
# Check application health
HEALTHCHECK --interval=1m --timeout=10s --retries=3 \
@ -22,56 +23,46 @@ HEALTHCHECK --interval=1m --timeout=10s --retries=3 \
#Default mojo server port
EXPOSE 3000
#Enable UTF-8 (might not do anything extra on alpine tho)
# Enable UTF-8 (might not do anything extra on alpine tho)
ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 \
#rootless user id
LRR_UID=9001 LRR_GID=9001 \
#Environment variables overridable by the user on container deployment
# root user id
LRR_UID=0 LRR_GID=0 \
# Environment variables overridable by the user on container deployment
LRR_NETWORK=http://*:3000 \
# extra variables
EV_EXTRA_DEFS=-DEV_NO_ATFORK
EV_EXTRA_DEFS=-DEV_NO_ATFORK \
# Enable automatic http proxy detection for mojo
MOJO_PROXY=1 \
# Allow Mojo to automatically pick up the X-Forwarded-For and X-Forwarded-Proto headers
MOJO_REVERSE_PROXY=1
RUN \
if [ $(getent group ${LRR_GID}) ]; then \
adduser -D -u ${LRR_UID} koyomi; \
else \
addgroup -g ${LRR_GID} koyomi && \
adduser -D -u ${LRR_UID} -G koyomi koyomi; \
fi
# we use s6-overlay-nobin to just pull in the s6-overlay arch agnostic (shell)
# components, since we apk install the binaries of s6 later which are arch specific
# /!\ While the s6 version here is fixed by an envvar, the apk install is not pinned and takes whatever's in alpine:latest! This certainly needs a fix.
ADD https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_RELEASE}/s6-overlay-nobin.tar.gz /tmp/s6-overlay-nobin.tar.gz
RUN tar -C / -xzf /tmp/s6-overlay-nobin.tar.gz && rm -f /tmp/s6-overlay-nobin.tar.gz
WORKDIR /root/lanraragi
#Copy cpanfile and install script before copying the entire context
#This allows for Docker cache to preserve cpan dependencies
COPY --chown=koyomi:koyomi /tools/cpanfile /tools/install.pl /tools/build/docker/install-everything.sh tools/
COPY --chown=koyomi:koyomi /package.json package.json
COPY --chown=root:root /tools/cpanfile /tools/install.pl /tools/build/docker/install-everything.sh tools/
COPY --chown=root:root /package.json package.json
# Run the install script as root
RUN sh ./tools/install-everything.sh
RUN rm -f /root/lanraragi/public/js/vendor/jquery.dataTables.min.js
#Copy remaining LRR files from context
COPY --chown=koyomi:koyomi /lib lib
COPY --chown=koyomi:koyomi /public public
COPY --chown=koyomi:koyomi /script script
COPY --chown=koyomi:koyomi /templates templates
COPY --chown=koyomi:koyomi /tests tests
COPY --chown=koyomi:koyomi /lrr.conf lrr.conf
COPY --chown=koyomi:koyomi /tools/build/docker/redis.conf tools/build/docker/
# consider chowning in s6 setup scripts instead
COPY --chown=root:root /lib lib
COPY --chown=root:root /public public
COPY --chown=root:root /script script
COPY --chown=root:root /templates templates
COPY --chown=root:root /tests tests
COPY --chown=root:root /lrr.conf lrr.conf
COPY --chown=root:root /tools/build/docker/redis.conf tools/build/docker/
COPY /tools/build/docker/wsl.conf /etc/wsl.conf
COPY /tools/build/docker/s6/cont-init.d/ /etc/cont-init.d/
COPY /tools/build/docker/s6/services.d/ /etc/services.d/
#Copy s6-overlay 3.x services
#Uses a system-d like definition that can't be use in 2.x
COPY /tools/build/docker/s6/s6-rc.d/ /etc/s6-overlay/s6-rc.d/
#Copy setup script as-is since no changes are needed between 2.x and 3.x
COPY /tools/build/docker/s6/cont-init.d/01-lrr-setup /etc/s6-overlay/s6-rc.d/init/
COPY --chown=root:root /jquery.dataTables.min.js /root/lanraragi/public/js/vendor/jquery.dataTables.min.js
#COPY /tools/build/docker/s6/fix-attrs.d/ /etc/fix-attrs.d/
# Persistent volumes

View File

@ -0,0 +1,73 @@
# DOCKER-VERSION 0.3.4
FROM alpine:3.12
LABEL git="https://github.com/uparrows/LANraragi_cn"
ENV S6_OVERLAY_RELEASE v2.0.0.1
ENV S6_KEEP_ENV 1
# warn if we can't run stage2 (fix-attrs/cont-init)
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 1
# wait 10s before KILLing
ENV S6_KILL_GRACETIME 10000
# s6
ENTRYPOINT ["/init"]
# Check application health
HEALTHCHECK --interval=1m --timeout=10s --retries=3 \
CMD wget --quiet --tries=1 --no-check-certificate --spider \
http://localhost:3000 || exit 1
#Default mojo server port
EXPOSE 3000
#Enable UTF-8 (might not do anything extra on alpine tho)
ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 \
#rootless user id
LRR_UID=0 LRR_GID=0 \
#Environment variables overridable by the user on container deployment
LRR_NETWORK=http://*:3000 \
# extra variables
EV_EXTRA_DEFS=-DEV_NO_ATFORK \
# Enable automatic http proxy detection for mojo
MOJO_PROXY=1 \
# Allow Mojo to automatically pick up the X-Forwarded-For and X-Forwarded-Proto headers
MOJO_REVERSE_PROXY=1
# we use s6-overlay-nobin to just pull in the s6-overlay arch agnostic (shell)
# components, since we apk install the binaries of s6 later which are arch specific
# /!\ While the s6 version here is fixed by an envvar, the apk install is not pinned and takes whatever's in alpine:latest! This certainly needs a fix.
ADD https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_RELEASE}/s6-overlay-nobin.tar.gz /tmp/s6-overlay-nobin.tar.gz
RUN tar -C / -xzf /tmp/s6-overlay-nobin.tar.gz && rm -f /tmp/s6-overlay-nobin.tar.gz
WORKDIR /root/lanraragi
#Copy cpanfile and install script before copying the entire context
#This allows for Docker cache to preserve cpan dependencies
COPY --chown=root:root /tools/cpanfile /tools/install.pl /tools/build/docker/install-everything.sh tools/
COPY --chown=root:root /package.json package.json
# Run the install script as root
RUN sh ./tools/install-everything.sh
RUN rm -f /root/lanraragi/public/js/vendor/jquery.dataTables.min.js
#Copy remaining LRR files from context
# consider chowning in s6 setup scripts instead
COPY --chown=root:root /lib lib
COPY --chown=root:root /public public
COPY --chown=root:root /script script
COPY --chown=root:root /templates templates
COPY --chown=root:root /tests tests
COPY --chown=root:root /lrr.conf lrr.conf
COPY --chown=root:root /tools/build/docker/redis.conf tools/build/docker/
COPY /tools/build/docker/wsl.conf /etc/wsl.conf
COPY /tools/build/docker/s6/cont-init.d/ /etc/cont-init.d/
COPY /tools/build/docker/s6/services.d/ /etc/services.d/
COPY --chown=root:root /jquery.dataTables.min.js /root/lanraragi/public/js/vendor/jquery.dataTables.min.js
#COPY /tools/build/docker/s6/fix-attrs.d/ /etc/fix-attrs.d/
# Persistent volumes
VOLUME [ "/root/lanraragi/content" ]
VOLUME [ "/root/lanraragi/database"]

View File

@ -3,7 +3,7 @@
#Just do everything
apk update
apk add tzdata
apk add perl perl-io-socket-ssl perl-dev redis libarchive-dev libbz2 openssl-dev zlib-dev
apk add perl perl-io-socket-ssl perl-dev redis libarchive-dev libbz2 openssl-dev zlib-dev linux-headers
apk add imagemagick imagemagick-perlmagick libwebp-tools libheif
apk add g++ make pkgconf gnupg wget curl file
apk add shadow s6 s6-portable-utils
@ -14,7 +14,7 @@ if [ -f /etc/alpine-release ]; then
if [ "$alpine_version" = "3.12.12" ]; then
apk add nodejs-npm
else # Those packages don't exist on 3.12
apk add nodejs npm s6-overlay s6-overlay-preinit
apk add nodejs npm s6-overlay libjxl
fi
fi
@ -24,12 +24,14 @@ curl -L https://cpanmin.us | perl - App::cpanminus
#Alpine's libffi build comes with AVX instructions enabled
#Rebuild our own libffi with those disabled
if [ $(uname -m) == 'x86_64' ]; then
#Install deps only
cpanm --notest --installdeps Alien::FFI
curl -L -s https://cpan.metacpan.org/authors/id/P/PL/PLICEASE/Alien-FFI-0.25.tar.gz | tar -xz
cd Alien-FFI-0.25
#Patch build script to disable AVX
sed -i 's/--disable-builddir/--disable-builddir --with-gcc-arch=x86-64-v2/' alienfile
# Patch build script to disable AVX - and SSE4 for real old CPUs
# See https://developers.redhat.com/blog/2021/01/05/building-red-hat-enterprise-linux-9-for-the-x86-64-v2-microarchitecture-level
sed -i 's/--disable-builddir/--disable-builddir --with-gcc-arch=x86-64/' alienfile
perl Makefile.PL && make install
cd ../ && rm -rf Alien-FFI-0.25
fi

View File

@ -34,7 +34,9 @@ chmod u+rwx /root/lanraragi/public/temp
#Remove mojo, minion and shinobu pid files
rm /root/lanraragi/public/temp/server.pid
rm /root/lanraragi/public/temp/shinobu.pid
rm /root/lanraragi/public/temp/shinobu.pid-s6
rm /root/lanraragi/public/temp/minion.pid
rm /root/lanraragi/public/temp/minion.pid-s6
# https://redis.io/topics/faq#background-saving-fails-with-a-fork-error-under-linux-even-if-i-have-a-lot-of-free-ram
OVERCOMMIT=$(cat /proc/sys/vm/overcommit_memory)

View File

@ -0,0 +1 @@
oneshot

View File

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init/01-lrr-setup

View File

@ -0,0 +1,4 @@
#!/bin/sh
kill -15 `cat /root/lanraragi/public/temp/shinobu.pid-s6`
kill -15 `cat /root/lanraragi/public/temp/minion.pid-s6`
sleep 5

View File

@ -0,0 +1,4 @@
#!/bin/sh
cd /root/lanraragi/
export HOME=/root
exec perl /root/lanraragi/script/launcher.pl -f /root/lanraragi/script/lanraragi

View File

@ -0,0 +1 @@
longrun

View File

@ -0,0 +1,2 @@
#!/bin/sh
exec /usr/bin/redis-server /root/lanraragi/tools/build/docker/redis.conf

View File

@ -0,0 +1 @@
longrun

View File

@ -1,2 +0,0 @@
.vagrant
database.rdb

View File

@ -1,22 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
config.vm.box = "debian/jessie64"
config.vm.network :forwarded_port, guest: 3000, host: 3000
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
config.vm.provision "shell",
inline: "docker stop lanraragi || true && docker rm lanraragi || true"
config.vm.provision "docker" do |d|
d.pull_images "difegue/lanraragi:latest"
d.run "difegue/lanraragi:latest",
args: "--name=lanraragi -e LRR_UID=1000 -p 3000:3000 --restart=always --mount type=bind,source=/vagrant,target=/root/lanraragi/content "
end
config.vm.post_up_message = "LANraragi Vagrant Machine Started, App should be available at http://localhost:3000."
end

View File

@ -1,22 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
config.vm.box = "debian/jessie64"
config.vm.network :forwarded_port, guest: 3000, host: 3000
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
config.vm.provision "shell",
inline: "docker stop lanraragi || true && docker rm lanraragi || true"
config.vm.provision "docker" do |d|
d.pull_images "difegue/lanraragi"
d.run "difegue/lanraragi:nightly",
args: "--name=lanraragi -e LRR_UID=1000 -p 3000:3000 --restart=always --mount type=bind,source=/vagrant,target=/root/lanraragi/content "
end
config.vm.post_up_message = "LANraragi Vagrant Machine Started, App should be available at http://localhost:3000."
end

View File

@ -19,4 +19,4 @@ nuget restore
# Build Karen and Setup
msbuild /p:Configuration=Release
Get-FileHash .\Setup\bin\LANraragi.msi | Format-List
Get-FileHash .\Setup\bin\LANraragi.msi | Format-List

View File

@ -6,7 +6,7 @@ requires 'local::lib', 2.000024;
requires 'Redis', 1.995;
requires 'Encode', 3.01;
requires 'Archive::Libarchive::Extract', 0.03;
requires 'Archive::Libarchive::Peek', 0.03;
requires 'Archive::Libarchive::Peek', 0.04;
requires 'Digest::SHA', 6.02;
# Not required by LRR itself but needs this version for Alpine support
@ -36,7 +36,7 @@ requires 'Test::Trap', 0.3.4;
requires 'Test::Deep', 1.130;
# Mojo stuff
requires 'Mojolicious', 9.19;
requires 'Mojolicious', 9.27;
requires 'Mojolicious::Plugin::TemplateToolkit', 0.005;
requires 'Mojolicious::Plugin::RenderFile', 0.12;
requires 'Mojolicious::Plugin::Status', 1.15;
@ -44,7 +44,7 @@ requires 'IO::Socket::SSL', 2.067;
requires 'Cpanel::JSON::XS', 4.06;
# Job Queue (Minion)
requires 'Minion', 10.20;
requires 'Minion', 10.25;
requires 'Minion::Backend::Redis', 0.002;
# Background Worker (Shinobu)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB