Summary
This post is a part of Lemmy 0.16.7 on OpenBSD 7.2 about Lemmy.
Premise
The server is OpenBSD and Rust (rustlang) is installed. Also, there is _lemmy
user whose home directory is /var/lemmy
.
Environment
Tutorial
Lemmy-UI server
Prepare Node.js
Switch back to your own user if you are acting as _lemmy
:
$ exit
Then run:
$ doas pkg_add yarn
The output was:
quirks-6.42 signed on 2023-01-13T18:22:41Z
yarn-1.22.18:brotli-1.0.9p0: ok
yarn-1.22.18:gmake-4.3: ok
yarn-1.22.18:flock-20110525p1: ok
yarn-1.22.18:icu4c-71.1v0: ok
yarn-1.22.18:openssl-1.1.1q: ok
yarn-1.22.18:libcares-1.18.1: ok
yarn-1.22.18:node-16.17.1v0: ok
yarn-1.22.18: ok
--- +node-16.17.1v0 -------------------
You may wish to add /usr/local/lib/node_modules/npm/man to /etc/man.conf
--- +openssl-1.1.1q -------------------
You may wish to add /usr/local/lib/eopenssl11/man to /etc/man.conf
Build Lemmy-UI server
Switch to _lemmy
:
$ doas su - _lemmy
Then get the source:
$ git clone https://github.com/LemmyNet/lemmy-ui.git --recursive --branch 0.16.7 --single-branch
The output was:
Cloning into 'lemmy-ui'...
remote: Enumerating objects: 4489, done.
remote: Total 4489 (delta 0), reused 0 (delta 0), pack-reused 4489
Receiving objects: 100% (4489/4489), 2.39 MiB | 5.86 MiB/s, done.
Resolving deltas: 100% (3371/3371), done.
Note: switching to '44f22ad3b7f7afb17cd0ac6ee293b11bbbdf6087'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
(...)
Submodule 'lemmy-translations' (https://github.com/lemmynet/lemmy-translations) registered for path 'lemmy-translations'
Cloning into '/var/lemmy/lemmy-ui/lemmy-translations'...
remote: Enumerating objects: 2208, done.
remote: Counting objects: 100% (546/546), done.
remote: Compressing objects: 100% (151/151), done.
Receiving objects: 100% (2208/2208), 678.71 KiB | 2.71 MiB/s, done.
remote: Total 2208 (delta 439), reused 464 (delta 395), pack-reused 1662
Resolving deltas: 100% (1820/1820), done.
Submodule path 'lemmy-translations': checked out 'a099f9f02d9c8a7e24349154880b5515e3c45362'
Go inside:
$ cd lemmy-ui
Run to get the dependencies:
$ yarn install --pure-lockfile
The output was:
yarn install v1.22.18
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
(...)
[5/5] Building fresh packages...
warning Your current version of Yarn is out of date. The latest version is "1.22.19", while you're on "1.22.18".
$ husky install
husky - Git hooks installed
Done in 59.79s.
Then run to build:
$ yarn build:prod
The output was:
yarn run v1.22.18
$ yarn clean && node generate_translations.js
$ yarn run rimraf dist
$ /var/lemmy/lemmy-ui/node_modules/.bin/rimraf dist
$ webpack --mode=production
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
(...)
Entrypoint main [big] 927 KiB = styles/styles.css 16.7 KiB js/server.js 910 KiB
(...)
Entrypoint main [big] 1.78 MiB = styles/styles.css 16.7 KiB js/client.js 1.77 MiB
(...)
webpack 5.72.0 compiled successfully in 35738 ms
Done in 37.47s.
To follow the guide printed above, run in addition:
$ npx browserslist@latest --update-db
You will be asked:
Need to install the following packages:
browserslist@4.21.4
Ok to proceed? (y) y
The output was:
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
Latest version: 1.0.30001444
Installed version: 1.0.30001298
Removing old caniuse-lite from lock file
Installing new caniuse-lite version
$ yarn add -W caniuse-lite
(...)
caniuse-lite has been successfully updated
Target browser changes:
- and_chr 96
+ and_chr 108
(...)
- ios_saf 12.2-12.5
+ ios_saf 16.2
(...)
- safari 13.1
+ safari 16.2
(...)
npm notice New major version of npm available! 8.15.0 -> 9.3.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.3.0
npm notice Run npm install -g npm@9.3.0 to update!
npm notice
Now you are ready to start Lemmy UI server:
$ yarn start
The output was:
arn run v1.22.18
$ yarn build:dev --watch
$ yarn clean && node generate_translations.js
$ yarn run rimraf dist
$ /var/lemmy/lemmy-ui/node_modules/.bin/rimraf dist
$ webpack --mode=development --watch
[RunNodeWebpackPlugin] Starting node script: js/server.js
Inferno is in development mode.
httpbase: http://0.0.0.0:8536
wsUri: ws://0.0.0.0:8536/api/v3/ws
isHttps: false
No JWT cookie found.
http://0.0.0.0:1234
assets by status 4.37 MiB [cached] 36 assets
Entrypoint main [big] 1.68 MiB = styles/styles.css 19.4 KiB js/server.js 1.66 MiB
cached modules 1.19 MiB (javascript) 17.6 KiB (css/mini-extract) 937 bytes (runtime) [cached] 149 modules
webpack 5.72.0 compiled successfully in 405 ms
(...)
Entrypoint main [big] 4.06 MiB = styles/styles.css 19.4 KiB js/client.js 4.04 MiB
cached modules 3.35 MiB (javascript) 17.6 KiB (css/mini-extract) 1.25 KiB (runtime) [cached] 735 modules
webpack 5.72.0 compiled successfully in 398 ms
Optionally, you may pass environment variables to customize the server:
$ env LEMMY_UI_HOST=0.0.0.0:1234 \
LEMMY_INTERNAL_HOST=127.0.0.1:8536 \
LEMMY_EXTERNAL_HOST=<your-fqdn>:8536 \
LEMMY_WS_HOST=<your-fqdn>:443 \
LEMMY_UI_DEBUG=false \
node dist/js/server.js
Conclusion
Well done :) Go on to the next step.
Top comments (0)