From 5863b72009c490ba23eb9cd2b03f2d78f54bb77f Mon Sep 17 00:00:00 2001 From: Dweb Fan Date: Sun, 24 Oct 2021 22:14:12 -0700 Subject: [PATCH] add environment variable based customization section Signed-off-by: Dweb Fan --- .../lomorage-service/installation-raspbian.md | 24 ++++++++++++---- .../lomorage-service/installation-ubuntu.md | 26 +++++++++++++---- .../lomorage-service/installation-raspbian.md | 26 +++++++++++++---- .../lomorage-service/installation-ubuntu.md | 28 +++++++++++++++---- 4 files changed, 82 insertions(+), 22 deletions(-) diff --git a/content.zh/docs/Installation/lomorage-service/installation-raspbian.md b/content.zh/docs/Installation/lomorage-service/installation-raspbian.md index c1b5863..ad7d65d 100644 --- a/content.zh/docs/Installation/lomorage-service/installation-raspbian.md +++ b/content.zh/docs/Installation/lomorage-service/installation-raspbian.md @@ -139,18 +139,32 @@ sudo apt install lomo-base lomo-vips lomo-backend lomo-web lomo-frame -y echo "$USER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/$USER ``` -### 3. 按需修改加载目录 +### 3. 按需修改运行参数 + +用户可以使用环境变量来修改某些运行参数。下面的例子使用`/etc/profile`作为系统缺省加载环境变量的文件,用户可以根据自己实际情况加以调整。 + +请确保设置环境变量之后,启动lomod之前,这些环境变量已经在env里面定义了 + +#### 3.1 修改磁盘mount目录 如果您不是使用步骤4的usbmount来自动加载磁盘(没有加载到"/media"路径下的子目录),您需要添加Lomorage服务程序运行参数来指定加载目录。 -比如如果您使用PCManFM,那么加载的路径会是"/media/pi"。 要指定加载目录"/media/pi", 修改"/lib/systemd/system/lomod.service"的`ExecStart`字段,加上 "--mount-dir"参数: +比如如果您使用PCManFM,那么加载的路径会是"/media/pi"。 要指定加载目录"/media/pi", 请添加环境变量`LOMOD_MOUNT_DIR=/media/pi`在`/etc/profile`,比如 -```bash -ExecStart=/opt/lomorage/bin/lomod -b /opt/lomorage/var --mount-dir /media/pi --max-upload 1 --max-fetch-preview 3 +``` +echo "export LOMOD_MOUNT_DIR=/media/pi" >> /etc/profile ``` **请确保您的用户有上面设置的"mount-dir"的读写权限, 另外改参数必须是mount的父目录,比如mount到"/media/pi/disk0"下面,就必须指定为"/media/pi"** +#### 3.2 HTTP 监听端口 + +Lomod缺省监听端口是8000,如果需要自定义,清使用环境变量`LOMOD_PORT_HTTP`,比如 + +``` +echo "export LOMOD_PORT_HTTP=8888" >> /etc/profile +``` + ### 4. 运行 重启Lomorage服务程序: @@ -164,4 +178,4 @@ sudo systemctl restart lomow # 重启lomo-frame sudo service supervisor restart -``` \ No newline at end of file +``` diff --git a/content.zh/docs/Installation/lomorage-service/installation-ubuntu.md b/content.zh/docs/Installation/lomorage-service/installation-ubuntu.md index 24e15b7..235911b 100644 --- a/content.zh/docs/Installation/lomorage-service/installation-ubuntu.md +++ b/content.zh/docs/Installation/lomorage-service/installation-ubuntu.md @@ -61,17 +61,31 @@ sudo apt install lomo-base-lite lomo-vips lomo-backend lomo-web -y echo "$USER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/$USER ``` -## 3. 更加需要修改mount目录 +### 3. 按需修改运行参数 + +用户可以使用环境变量来修改某些运行参数。下面的例子使用`/etc/profile`作为系统缺省加载环境变量的文件,用户可以根据自己实际情况加以调整。 + +请确保设置环境变量之后,启动lomod之前,这些环境变量已经在env里面定义了 + +#### 3.1 修改磁盘mount目录 如果您不是使用步骤4的usbmount来自动加载磁盘(没有加载到"/media"路径下的子目录),您需要添加Lomorage服务程序运行参数来指定加载目录。 -比如如果加载的路径是"/media/hdd/disk0"。 要指定加载目录"/media/hdd", 修改"/lib/systemd/system/lomod.service"的`ExecStart`字段,加上 "--mount-dir"参数: +比如如果您使用PCManFM,那么加载的路径会是"/media/pi"。 要指定加载目录"/media/pi", 请添加环境变量`LOMOD_MOUNT_DIR=/media/pi`在`/etc/profile`,比如 -```bash -ExecStart=/opt/lomorage/bin/lomod -b /opt/lomorage/var --mount-dir /media/hdd --max-upload 1 --max-fetch-preview 3 ``` +echo "export LOMOD_MOUNT_DIR=/media/pi" >> /etc/profile +``` + +**请确保您的用户有上面设置的"mount-dir"的读写权限, 另外改参数必须是mount的父目录,比如mount到"/media/pi/disk0"下面,就必须指定为"/media/pi"** -**请确保您的用户有上面设置的"mount-dir"的读写权限, 另外改参数必须是mount的父目录,比如mount到"/media/hdd/disk0"下面,就必须指定为"/media/hdd"** +#### 3.2 HTTP 监听端口 + +Lomod缺省监听端口是8000,如果需要自定义,清使用环境变量`LOMOD_PORT_HTTP`,比如 + +``` +echo "export LOMOD_PORT_HTTP=8888" >> /etc/profile +``` ## 4. 运行 @@ -86,4 +100,4 @@ sudo systemctl restart lomow # 重启lomo-frame sudo service supervisor restart -``` \ No newline at end of file +``` diff --git a/content/docs/Installation/lomorage-service/installation-raspbian.md b/content/docs/Installation/lomorage-service/installation-raspbian.md index 2bb4e17..2685e8b 100644 --- a/content/docs/Installation/lomorage-service/installation-raspbian.md +++ b/content/docs/Installation/lomorage-service/installation-raspbian.md @@ -139,17 +139,33 @@ Make sure the user can sudo without password, if not, execute the following comm echo "$USER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/$USER ``` -### 3. Change mount directory and username if needed +### 3. Configuration parameter customization + +User can use environment variable to control configuration parameter as below. Above example is using `/etc/profile` file as default. You can change based on your own setup. + +Note after you set environment variable, please make sure it takes effect when you start or restart lomod + +#### 3.1 Change mount directory You may need to specify the mount directory if the USB drive is not mounted in "/media" directory. -For example if you are using PCManFM, then the mount directory will be "/media/pi". To specify the mount directory to be "/media/pi", modify `ExecStart` in "/lib/systemd/system/lomod.service", and add parameter "--mount-dir" as below, **this parameter should be the directory mount, not the sub-directory** +For example if you are using PCManFM, then the mount directory will be "/media/pi". To specify the mount directory to be "/media/pi", add environment variable `LOMOD_MOUNT_DIR=/media/pi` in `/etc/profile`, such as -```bash -ExecStart=/opt/lomorage/bin/lomod -b /opt/lomorage/var --mount-dir /media/pi --max-upload 1 --max-fetch-preview 3 ``` +echo "export LOMOD_MOUNT_DIR=/media/pi" >> /etc/profile +``` + +**this parameter should be the directory mount, not the sub-directory** -**Make sure the user has the r/w permission for the "mount-dir" set above, this parameter should be the parent directory mounted, for example if it's mounted as "/media/pi/disk0", then you should use "/media/pi/".** +**Make sure the user has the r/w permission for above mount directory, this parameter should be the parent directory mounted, for example if it's mounted as "/media/pi/disk0", then you should use "/media/pi/".** + +#### 3.2 HTTP Listen Port + +Lomod listens on port 8000 by default. If it is conflict and you want to specify own listen port, you can add environment variable `LOMOD_PORT_HTTP` in `/etc/profile`. For example, + +``` +echo "export LOMOD_PORT_HTTP=8888" >> /etc/profile +``` ### 4. Run diff --git a/content/docs/Installation/lomorage-service/installation-ubuntu.md b/content/docs/Installation/lomorage-service/installation-ubuntu.md index 84544cc..cbd9c75 100644 --- a/content/docs/Installation/lomorage-service/installation-ubuntu.md +++ b/content/docs/Installation/lomorage-service/installation-ubuntu.md @@ -61,17 +61,33 @@ Make sure the user can sudo without password, if not, execute the following comm echo "$USER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/$USER ``` -## 3. Change mount directory +### 3. Configuration parameter customization + +User can use environment variable to control configuration parameter as below. Above example is using `/etc/profile` file as default. You can change based on your own setup. + +Note after you set environment variable, please make sure it takes effect when you start or restart lomod + +#### 3.1 Change mount directory You may need to specify the mount directory if the USB drive is not mounted in "/media" directory. -For example if the mount directory is "/media/hdd/disk0", you need to specify the mount directory to be "/media/hdd", modify `ExecStart` in "/lib/systemd/system/lomod.service", and add parameter "--mount-dir" as below, **this parameter should be the directory mount, not the sub-directory** +For example if you are using PCManFM, then the mount directory will be "/media/pi". To specify the mount directory to be "/media/pi", add environment variable `LOMOD_MOUNT_DIR=/media/pi` in `/etc/profile`, such as -```bash -ExecStart=/opt/lomorage/bin/lomod -b /opt/lomorage/var --mount-dir /media/hdd --max-upload 1 --max-fetch-preview 3 ``` +echo "export LOMOD_MOUNT_DIR=/media/pi" >> /etc/profile +``` + +**this parameter should be the directory mount, not the sub-directory** -**Make sure the user has the r/w permission for the "mount-dir" set above, this parameter should be the parent directory mounted, for example if it's mounted as "/media/hdd/disk0", then you should use "/media/hdd/".** +**Make sure the user has the r/w permission for above mount directory, this parameter should be the parent directory mounted, for example if it's mounted as "/media/pi/disk0", then you should use "/media/pi/".** + +#### 3.2 HTTP Listen Port + +Lomod listens on port 8000 by default. If it is conflict and you want to specify own listen port, you can add environment variable `LOMOD_PORT_HTTP` in `/etc/profile`. For example, + +``` +echo "export LOMOD_PORT_HTTP=8888" >> /etc/profile +``` ## 4. Run @@ -86,4 +102,4 @@ sudo systemctl restart lomow # restart lomo-frame sudo service supervisor restart -``` \ No newline at end of file +```