Skip to content

Commit

Permalink
add environment variable based customization section
Browse files Browse the repository at this point in the history
Signed-off-by: Dweb Fan <dwebfan@gmail.com>
  • Loading branch information
dwebfan committed Oct 25, 2021
1 parent 6b8d965 commit 5863b72
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 22 deletions.
Expand Up @@ -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服务程序:
Expand All @@ -164,4 +178,4 @@ sudo systemctl restart lomow

# 重启lomo-frame
sudo service supervisor restart
```
```
Expand Up @@ -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. 运行

Expand All @@ -86,4 +100,4 @@ sudo systemctl restart lomow

# 重启lomo-frame
sudo service supervisor restart
```
```
Expand Up @@ -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

Expand Down
28 changes: 22 additions & 6 deletions content/docs/Installation/lomorage-service/installation-ubuntu.md
Expand Up @@ -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

Expand All @@ -86,4 +102,4 @@ sudo systemctl restart lomow

# restart lomo-frame
sudo service supervisor restart
```
```

0 comments on commit 5863b72

Please sign in to comment.