[ANN] Erlang rocksdb 0.21.0 released

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[ANN] Erlang rocksdb 0.21.0 released

Benoit Chesneau-2
erlang rocksdb 0.21.0 a binding of #rocksdb for #erlang and #elixirlang applications has been released with support of latest rocksdb 5.15.10 and the addition of erlang and bitset merge operators [1] , prefix extractors and some other enhancement and fixes. 

Full changelog:

erlang-rocksdb 0.21.0, released on 2018/09/16
================================================

- bump to rocksdb 5.15.10
- add: erlang merge operator
- add: erlang bitset merge operator
- add: rocksdb:batch_data_size/1
- add: prefix_transform option


Project Gitlab: https://gitlab.com/barrel-db/erlang-rocksdb
The project is available on hex.pm: https://hex.pm/packages/rocksdb

To get started: https://gitlab.com/barrel-db/erlang-rocksdb/wikis/Getting-started

If you have any issue or question, please ask me directlty or via a ticket at https://gitlab.com/barrel-db/erlang-rocksdb/issues  

Enjoy!

Benoît



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

integrate rebar3 release and systemd

dieter
Hi all,

I spent the last two days for finding a way to integrate systemd and an erlang release,
created with rebar3.
Here are my findings, maybe they are useful for some of you as well.

My goal was to have the release to be started automatically at boot time,
and to be restarted if it totally crashes. I use Ubuntu 18.
Internal application/process restarts are handled inside erlang.

I started with a release

    $ rebar3 as prod tar

and installed that into /opt/patchbox.

Then I took systemd.erl from Max Lapshin (many thanks for this!)
from his gist

Here I added a function for writing a PID file,
and integrated this with ready() and watchdog(),
so by calling systemd:start_link(PidFile) from my top supervisor
after a successful startup, the PID file is created and READY
is sent to systemd. (And the WATCHDOG is started).

write_pid(PidFile) ->
    {ok, F} = file:open(PidFile, [write, raw]),
    ok = file:write(F, os:getpid()),
    ok = file:close(F).

init(PidFile) ->
    write_pid(PidFile),
    erlang:send_after(  100, self(), ready),
    erlang:send_after(60000, self(), watchdog),
    {ok, state}.

handle_info(ready, State) ->
    ready(),
    {noreply, State};


Finally, the configuration file for systemd is this one,
I saved it in /etc/systemd/system/patchbox.service

[Unit]
Description=Patchbox
After=network-online.target
Wants=network-online.target

[Service]
# The start script forks the erlang VM, the means that the systemd's PID 
# will soon be gone, and the READY message will come from an orphan
Type=forking
User=patchbox
Group=patchbox
# Allow root permission for Pre commands (mkdir, chown, etc..)
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /run/patchbox
ExecStartPre=/bin/chown patchbox:patchbox /run/patchbox
# Call rebar3's start script
ExecStart=/opt/patchbox/bin/patchbox start
Restart=on-failure
TimeoutStartSec=300s
# Expect WATCHDOG at least every 2 minutes
WatchdogSec=120s
# Allow READY and WATCHDOG from other PIDs than the original
NotifyAccess=all
# systemd expects the services' PID here
PIDFile=/run/patchbox/patchbox.pid

[Install]
WantedBy=multi-user.target


Kind regards,
Dieter

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: integrate rebar3 release and systemd

Tobias Schlager-2
Hi Dieter,

we've been using Erlang releases with Systemd on CentOS for quite some time now. No critics here, I just want to seize the opportunity and point out the solution we use:

We compile Erlang/OTP ourselves using the '--enable-systemd' option. We package epmd as a separate RPM with a proper service file. In our own service files we do not rely on the rebar start scripts. Instead, we are using erlexec directly, e.g.

$ systemctl cat epmd.service
[Unit]
Description=Erlang Port Mapper Daemon
After=network-online.target
Wants=network-online.target

[Service]
ExecStart=/usr/bin/epmd
Restart=always
RestartSec=2
Type=simple
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

$ systemctl cat xxx.service
[Unit]
Description=xxx
After=epmd.service network-online.target
Wants=epmd.service

[Service]
Environment=BINDIR=/usr/lib64/xxx/erts-9.1/bin
Environment=COOKIE=xxx
Environment=VERSION=???
Environment=EMU=beam
Environment=ERL_MAX_PORTS=32768
Environment=PROGNAME=xxx
Environment=ROOTDIR=/usr/lib64/xxx
ExecStart=/usr/lib64/xxx/erts-9.1/bin/erlexec -boot ${ROOTDIR}/releases/${VERSION}/xxx -mode embedded -config ${ROOTDIR}/releases/${VERSION}/sys.config -name xxx -setcookie ${COOKIE} -noinput +K true
ExecStop=/usr/lib64/xxx/erts-9.1/bin/escript ${BINDIR}/nodetool -name xxx -setcookie ${COOKIE} stop
ExecStop=/bin/sh -c 'while $(kill -0 $MAINPID 2>/dev/null); do sleep 1; done'
WorkingDirectory=/usr/lib64/xxx
Restart=on-failure
RestartSec=2

[Install]
WantedBy=multi-user.target

Regards
Tobias
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: integrate rebar3 release and systemd

dieter
Hi Tobias,

thanks a lot for your example, I appreciate it very much!
In fact, I wanted to ask in my first email for other solutions and feedback, but then hit the send button too early..

My release is a standalone application, so a separate epmd-systemd unit is not important for me.
But you probably have a distributed solution with several releases/nodes per machine where this approach
clearly is superior.

Kind regards,
Dieter



Am Mi., Sept. 19, 2018 11:16 schrieb Tobias Schlager <[hidden email]>:
Hi Dieter,

we've been using Erlang releases with Systemd on CentOS for quite some time now. No critics here, I just want to seize the opportunity and point out the solution we use:

We compile Erlang/OTP ourselves using the '--enable-systemd' option. We package epmd as a separate RPM with a proper service file. In our own service files we do not rely on the rebar start scripts. Instead, we are using erlexec directly, e.g.

$ systemctl cat epmd.service
[Unit]
Description=Erlang Port Mapper Daemon
After=network-online.target
Wants=network-online.target

[Service]
ExecStart=/usr/bin/epmd
Restart=always
RestartSec=2
Type=simple
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

$ systemctl cat xxx.service
[Unit]
Description=xxx
After=epmd.service network-online.target
Wants=epmd.service

[Service]
Environment=BINDIR=/usr/lib64/xxx/erts-9.1/bin
Environment=COOKIE=xxx
Environment=VERSION=???
Environment=EMU=beam
Environment=ERL_MAX_PORTS=32768
Environment=PROGNAME=xxx
Environment=ROOTDIR=/usr/lib64/xxx
ExecStart=/usr/lib64/xxx/erts-9.1/bin/erlexec -boot ${ROOTDIR}/releases/${VERSION}/xxx -mode embedded -config ${ROOTDIR}/releases/${VERSION}/sys.config -name xxx -setcookie ${COOKIE} -noinput +K true
ExecStop=/usr/lib64/xxx/erts-9.1/bin/escript ${BINDIR}/nodetool -name xxx -setcookie ${COOKIE} stop
ExecStop=/bin/sh -c 'while $(kill -0 $MAINPID 2>/dev/null); do sleep 1; done'
WorkingDirectory=/usr/lib64/xxx
Restart=on-failure
RestartSec=2

[Install]
WantedBy=multi-user.target

Regards
Tobias

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions