An Interest In:
Web News this Week
- April 2, 2024
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
Pleroma 2.5.0 - : Elixir 1.11 on OpenBSD 7.1
Pleroma Fediverse () Twitter Mastodon Elixir () Erlang () VM / / ()
:
OpenBSD Unix
7.2 7.1 OpenBSD ?
Pleroma OpenBSD 7.1 Ports Elixir
7.2 Ports Elixir mix :
$ env LC_ALL=en_US.UTF-8 MIX_ENV=prod \ mix phx.server
:
xx:xx:xx.xxx [notice] Application runtime_tools exited: :runtime_tools.start(:normal, []) returned an error: shutdown: failed to start child: :ttb_autostart ** (EXIT) an exception was raised: ** (UndefinedFunctionError) function :observer_backend.ttb_resume_trace/0 is undefined (module :observer_backend is not available) (runtime_tools 1.19) :observer_backend.ttb_resume_trace() (runtime_tools 1.19) ttb_autostart.erl:47: :ttb_autostart.init/1 (stdlib 4.0.1) gen_server.erl:848: :gen_server.init_it/2 (stdlib 4.0.1) gen_server.erl:811: :gen_server.init_it/6 (stdlib 4.0.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3{"Kernel pid terminated",application_controller,"{application_start_failure,runtime_tools,{{shutdown,{failed_to_start_child,ttb_autostart,{undef,[{observer_backend,ttb_resume_trace,[],[]},{ttb_autostart,init,1,[{file,\"ttb_autostart.erl\"},{line,47}]},{gen_server,init_it,2,[{file,\"gen_server.erl\"},{line,848}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,811}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,240}]}]}}},{runtime_tools,start,[normal,[]]}}}"}Kernel pid terminated (application_controller) ({application_start_failure,runtime_tools,{{shutdown,{failed_to_start_child,ttb_autostart,{undef,[{observer_backend,ttb_resume_trace,[],[]},{ttb_autostart,init,1,[{file,"ttb_autostart.erl"},{line,47}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,848}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,811}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]}}},{runtime_tools,start,[normal,[]]}}})Crash dump is being written to: erl_crash.dump...done
7.2 Ports Elixir 1.14
- OpenBSD 7.1 ( 2022 4 21 )
- PostgreSQL 14.5 ( 2022 4 11 )
- Erlang/OTP 21.2.5 ( 2019 2 4 )
- Elixir 1.11.4 ( 2021 5 16 )
- Pleroma ( 2022 12 23 )
/ /
/ /
PostgreSQL ()
* postgresql-contrib *
PostgreSQL :
$ doas pkg_add postgresql-server \ postgresql-contrib
:
quirks-5.5 signed on 2022-10-18T12:24:43Zpostgresql-server-14.5:libxml-2.9.13p2: okpostgresql-server-14.5:postgresql-client-14.5: okuseradd: Warning: home directory `/var/postgresql' doesn't exist, and -m was not specifiedpostgresql-server-14.5: okpostgresql-contrib-14.5: okRunning tags: okThe following new rcscripts were installed: /etc/rc.d/postgresqlSee rcctl(8) for details.New and changed readme(s): /usr/local/share/doc/pkg-readmes/postgresql-server
_postgresql
:
$ doas su _postgresql -
:
$ initdb -D /var/postgresql/data -U postgres
:
The files belonging to this database system will be owned by user "_postgresql".This user must also own the server process.The database cluster will be initialized with locale "C".The default database encoding has accordingly been set to "SQL_ASCII".The default text search configuration will be set to "english".Data page checksums are disabled.creating directory /var/postgresql/data ... okcreating subdirectories ... okselecting dynamic shared memory implementation ... posixselecting default max_connections ... 20selecting default shared_buffers ... 128MBselecting default time zone ... Asia/Tokyocreating configuration files ... okrunning bootstrap script ... okperforming post-bootstrap initialization ... oksyncing data to disk ... okinitdb: warning: enabling "trust" authentication for local connectionsYou can change this by editing pg_hba.conf or using the option -A, or--auth-local and --auth-host, the next time you run initdb.Success. You can now start the database server using: pg_ctl -D /var/postgresql/data -l logfile start
$ exit
:
$ doas rcctl enable postgresql$ doas rcctl start postgresql
Elixir
Ports Elixir :
$ doas pkg_add elixir
:
quirks-5.5 signed on 2022-10-18T12:24:43Zelixir-1.11.4p0:erlang-21.2p5v0: okelixir-1.11.4p0: ok--- +erlang-21.2p5v0 -------------------You may wish to add /usr/local/lib/erlang21/man to /etc/man.conf
Pleroma
Ports
:
$ doas pkg_add gmake \ git cmake libmagic
:
$ doas pkg_add ImageMagick \ ffmpeg p5-Image-ExifTool
:
quirks-5.5 signed on 2022-10-18T12:24:43Zgmake-4.3: okgit-2.35.1p0:cvsps-2.1p2: ok(...)git-2.35.1p0: okcmake-3.20.3p6v0:libuv-1.44.1: ok(...)cmake-3.20.3p6v0: oklibmagic-5.43: okThe following new rcscripts were installed: /etc/rc.d/gitdaemonSee rcctl(8) for details.New and changed readme(s): /usr/local/share/doc/pkg-readmes/git
:
quirks-5.5 signed on 2022-10-18T12:24:43ZImageMagick-6.9.12.38:x265-3.5p0: ok(...)ImageMagick-6.9.12.38: okffmpeg-4.4.1p3v1:fribidi-1.0.11: ok(...)ffmpeg-4.4.1p3v1: okp5-Image-ExifTool-12.40: okRunning tags: okNew and changed readme(s): /usr/local/share/doc/pkg-readmes/ffmpeg /usr/local/share/doc/pkg-readmes/sdl2
rc.d
:
$ doas useradd \ -d /var/www/_pleroma -m _pleroma
/var/www/_pleroma
:
$ doas mkdir /var/www/pleroma$ doas chown -R \ _pleroma:_pleroma /var/www/pleroma
Elixir Phoenix :
$ doas nvim /etc/login.conf
:
+ _pleroma:\+ :datasize-max=1536M:\+ :datasize-cur=1536M:\+ :openfiles-max=4096
:
$ doas cap_mkdb /etc/login.conf
:
$ ls -l /etc/login*-rw-r--r-- 1 root wheel 2785 Dec 26 21:02 /etc/login.conf-rw-r--r-- 1 root wheel 73728 Dec 26 21:02 /etc/login.conf.db(...)
Pleroma
:
$ doas su _pleroma -
:
$ cd /var/www/pleroma
:
$ git clone -b stable \ https://git.pleroma.social/pleroma/pleroma.git \ .
:
Cloning into '.'...remote: Enumerating objects: 155563, done.remote: Counting objects: 100% (1606/1606), done.remote: Compressing objects: 100% (562/562), done.remote: Total 155563 (delta 1131), reused 1458 (delta 1040), pack-reused 153957Receiving objects: 100% (155563/155563), 198.25 MiB | 6.12 MiB/s, done.Resolving deltas: 100% (118994/118994), done.
Mix : deps.get
:
$ mix deps.get
Hex "y" :
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)!!! RUNNING IN LOCALHOST DEV MODE! !!!FEDERATION WON'T WORK UNTIL YOU CONFIGURE A dev.secret.exsCould not find Hex, which is needed to build dependency :phoenixShall I install Hex? (if running non-interactively, use "mix local.hex --force") [Yn] y
:
* creating /var/www/_pleroma/.mix/archives/hex-2.0.0* Getting gettext (https://github.com/tusooa/gettext.git - 72fb2496b6c5280ed911bdc3756890e7f38a4808)remote: Enumerating objects: 4046, done. remote: Counting objects: 100% (254/254), done. remote: Compressing objects: 100% (130/130), done. remote: Total 4046 (delta 121), reused 213 (delta 100), pack-reused 3792 (...)Resolving Hex dependencies...Resolution completed in 1.875sUnchanged: accept 0.3.5(...) websockex 0.4.3* Getting phoenix (Hex package)(...)* Getting phoenix_pubsub (Hex package)You have added/upgraded packages you could sponsor, run `mix hex.sponsor` to learn more
elixir-captcha OpenBSD ()
elixir-captcha
0.1.0 OpenBSD make
Pleroma gmake
:
$ nvim deps/captcha/mix.exs
:
defmodule Mix.Tasks.Compile.Make do def run(_) do- {result, _error_code} = System.cmd("make", [], stderr_to_stdout: true)+ {result, _error_code} = System.cmd("gmake", [], stderr_to_stdout: true) Mix.shell().info(result) (...) defmodule Mix.Tasks.Clean.Make do def run(_) do- {result, _error_code} = System.cmd("make", ['clean'], stderr_to_stdout: true)+ {result, _error_code} = System.cmd("gmake", ['clean'], stderr_to_stdout: true) Mix.shell().info(result)
mix pleroma.instance gen
:
==> captcharm -f priv/captcha src/captcha.o cc -g -c src/captcha.cmkdir -p privcc -I src -o priv/captcha src/captcha.o cc: error: no such file or directory: 'src/captcha.o'cc: error: no input files*** Error 1 in /var/www/pleroma/deps/captcha (Makefile:10 'priv/captcha')
Mix : pleroma.instance gen
Pleroma :
$ env MIX_ENV=prod \ mix pleroma.instance gen
rebar3 "y" :
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)warning: `config/prod.secret.exs` not found. You may want to create one by running `mix pleroma.instance gen`Could not find "rebar3", which is needed to build dependency :parse_transI can install a local copy which is just used by MixShall I install rebar3? (if running non-interactively, use "mix local.rebar --force") [Yn] y
:
* creating /var/www/_pleroma/.mix/rebar* creating /var/www/_pleroma/.mix/rebar3===> Analyzing applications...===> Compiling parse_trans(...)==> pleromaCompiling 592 files (.ex)(...)Generated pleroma app
What domain will your instance use? (e.g pleroma.soykaf.com) [] pleroma-on-openbsd.comWhat is the name of your instance? (e.g. The Corndog Emporium) [pleroma-on-openbsd.com] What is your admin email address? [] [email protected] email address do you want to use for sending email notifications? [[email protected]] Do you want search engines to index your site? (y/n) [n] Do you want to store the configuration in the database (allows controlling it from admin-fe)? (y/n) [n] What is the hostname of your database? [localhost] 127.0.0.1What is the name of your database? [pleroma] What is the user used to connect to your database? [pleroma] What is the password used to connect to your database? [autogenerated] Would you like to use RUM indices? [n] What port will the app listen to (leave it if you are using the default setup with nginx)? [4000] What ip will the app listen to (leave it if you are using the default setup with nginx)? [127.0.0.1] What directory should media uploads go in (when using the local uploader)? [uploads] What directory should custom public files be read from (custom emojis, frontend bundle overrides, robots.txt, etc.)? [instance/static/] Do you want to strip location (GPS) data from uploaded images? This requires exiftool, it was detected as installed. (y/n) [y] Do you want to read data from uploaded files so clients can use it to prefill fields like image description? This requires exiftool, it was detected as installed. (y/n) [y] Do you want to anonymize the filenames of uploads? (y/n) [n] yDo you want to deduplicate uploaded files? (y/n) [n] Writing config to config/generated_config.exs.Writing the postgres script to config/setup_db.psql.Writing /var/www/pleroma/instance/static/robots.txt. All files successfully written! Refer to the installation instructions for your platform for next steps.
!! :
$ cp config/generated_config.exs \ config/prod.secret.exs
()
:
$ nvim config/prod.secret.exs
PostgreSQL TLS/SSL :
config :pleroma, Pleroma.Repo, (...)- hostname: "(your-hostname)"+ hostname: "(your-hostname)",+ port: xxx,+ ssl: true (...)+ config :pleroma, Pleroma.Captcha,+ enabled: true
+ config :pleroma, Pleroma.Captcha,+ enabled: true,+ method: Pleroma.Captcha.Kocaptcha
Pleroma
:
$ psql -U postgres -f config/setup_db.psql
:
CREATE ROLECREATE DATABASEYou are now connected to database "pleroma" as user "postgres".CREATE EXTENSIONCREATE EXTENSIONCREATE EXTENSION
:
$ env MIX_ENV=prod \ mix ecto.migrate
:
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)Compiling 592 files (.ex)(...)xx:xx:xx.xxx [info] == Migrated 20221103014728 in 0.0sxx:xx:xx.xxx [info] == Running 20221111164213 Pleroma.Repo.Migrations.DeprecateQuack.up/0 forwardxx:xx:xx.xxx [info] == Migrated 20221111164213 in 0.0s
Mix : Phoenix
Phoenix :
$ env LC_ALL=en_US.UTF-8 MIX_ENV=prod \ mix phx.server
:
xx:xx:xx.xxx [warning] Description: 'Authenticity is not established by certificate path validation' Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'xx:xx:xx.xxx [info] tzdata release in place is from a file last modified Wed, 21 Oct 2020 18:40:20 GMT. Release file on server was last modified Sat, 29 Oct 2022 01:50:44 GMT.xx:xx:xx.xxx [warning] The on_load function for module crypt returned:{:error, {:load, 'Library load-call unsuccessful (1).'}}xx:xx:xx.xxx [info] Tzdata has updated the release from 2020d to 2022fxx:xx:xx.xxx [warning] The on_load function for module crypt returned:{:error, {:load, 'Library load-call unsuccessful (1).'}}xx:xx:xx.xxx [info] Running Pleroma.Web.Endpoint with cowboy 2.9.0 at 127.0.0.1:4000 (http)xx:xx:xx.xxx [info] Access Pleroma.Web.Endpoint at https://(your-domain)xx:xx:xx.xxx [info] Gopher server disabledxx:xx:xx.xxx [info] Transferring embedded hashtags to `hashtags` (from oid: 0)...xx:xx:xx.xxx [warn] The on_load function for module crypt returned:{:error, {:load, 'Library load-call unsuccessful (1).'}}(...)xx:xx:xx.xxx [info] Running Pleroma.Web.Endpoint with cowboy 2.9.0 at 127.0.0.1:4000 (http)xx:xx:xx.xxx [info] Access Pleroma.Web.Endpoint at https://pleroma-on-openbsd.comxx:xx:xx.xxx [info] Gopher server disabledxx:xx:xx.xxx [info] Transferring embedded hashtags to `hashtags` (from oid: 0)...xx:xx:xx.xxx [info] Deleting context objects from `objects` (from oid: 0)...
Phoenix ( Pleroma )
:
$ curl -I http://127.0.0.1:4000/
:
HTTP/1.1 200 OKaccess-control-allow-credentials: trueaccess-control-allow-origin: *access-control-expose-headers: Link,X-RateLimit-Reset,X-RateLimit-Limit,X-RateLimit-Remaining,X-Request-Id,Idempotency-Keycache-control: max-age=0, private, must-revalidatecontent-length: 7880content-security-policy: upgrade-insecure-requests;script-src 'self' 'wasm-unsafe-eval';connect-src 'self' blob: https://pleroma-on-openbsd.com wss://pleroma-on-openbsd.com;media-src 'self' https:;img-src 'self' data: blob: https:;default-src 'none';base-uri 'self';frame-ancestors 'none';style-src 'self' 'unsafe-inline';font-src 'self';manifest-src 'self';content-type: text/html; charset=utf-8date: Mon, 26 Dec 2022 12:35:06 GMTpermissions-policy: interest-cohort=()referrer-policy: same-originserver: Cowboyx-content-type-options: nosniffx-download-options: noopenx-frame-options: DENYx-permitted-cross-domain-policies: nonex-request-id: FzRX_VnDh-YizPQAABaRx-xss-protection: 1; mode=block
:)
"HTTP/... 200 OK" Pleroma
Pleroma admin
/var/www/pleroma
_pleroma
:
$ env LC_ALL=en_US.UTF-8 MIX_ENV=prod \ mix pleroma.user new \ (admin-name) ([email protected]) --admin
:
A user will be created with the following information: - nickname: pleroma_admin - email: [email protected] - password: [generated; a reset link will be created] - name: (admin-name) - bio: - moderator: false - admin: trueContinue? [n] y
:
User (admin-name) createdAdmin status of (admin-name): trueGenerated password reset token for (admin-name)URL: https://(your-domain))/api/v1/pleroma/password_reset/xxx...
relayd
Pleroma 127.0.0.1 localhost
Web Pleroma nginx Apache Caddy
OpenBSD relayd OpenBSD
relayd Pleroma / :
$ doas nvim /etc/relayd.conf
:
table <pleroma_server> { 127.0.0.1 }relay pleroma { listen on egress port 4000 forward to <pleroma_server> port 4000 check http "/" code 200}
:
$ doas rcctl enable relayd$ doas rcctl start relayd
rc.d
Pleroma
rc.d :
$ doas nvim /etc/rc.d/pleroma
:
#!/bin/kshdaemon="cd /var/www/pleroma; env LC_ALL=en_US.UTF-8 MIX_ENV=prod mix"daemon_user="_pleroma"daemon_flags="phx.server --no-compile". /etc/rc.d/rc.subrrc_cmd $1
cd ...;
daemon_execdir="/var/www/pleroma"
:
$ doas chmod a+x /etc/rc.d/pleroma
:
$ doas rcctl enable pleroma$ doas rcctl start pleroma
-f
: doas rcctl -f start pleroma
http://127.0.0.1:4000/
!!
Fediverse :)
Original Link: https://dev.to/nabbisen/pleroma-250-nogou-zhu-huan-jing-elixir-111-on-openbsd-71-bng
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To