New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding TypeDB #125350
Adding TypeDB #125350
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found the cause of your SO issue and I've added some suggestions that would come up in a review.
pkgs/servers/typedb/default.nix
Outdated
< JAVA_BIN=java | ||
--- | ||
> JAVA_BIN=${openjdk}/bin/java | ||
''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation is a bit odd an there's some trailing whitespace. nixpkgs-fmt
can help you out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done; did not know about nixpkgs-fmt
, that helps a lot
typedb-properties-patch = '' | ||
19c19 | ||
< server.data=server/data/ | ||
--- | ||
> server.data=${server-data} | ||
22c22 | ||
< server.logs=server/logs/ | ||
--- | ||
> server.logs=${server-logs} | ||
24c24 | ||
< server.port=1729 | ||
--- | ||
> server.port=${server-port} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it's already much better, this is still a bit awkward. Ideally changes in configuration would not require a rebuild.
If we're lucky, we might still be able to use an environment variable instead of hardcoding it into the store path, although that's not the default property file behavior.
Somewhat relevant discussion https://stackoverflow.com/questions/2263929/regarding-application-properties-file-and-environment-variable. If it's built on apache commons, we're lucky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to specify properties or property files at runtime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to the typedb team not;
only at startup as a cli option or in the config file;
I decided to add a wrapper script again that makes it possible to change the three configuration options via environment variables.
at least until I am able to change the implementation of the property file reader in the typedb.
I am still debugging it, but at least it builds and the tests run fine now;
there are still some issues though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only at startup as a cli option or in the config file;
The config file is not really a config file if it's packaged immutably with the software, so cli options are probably the easiest option. Do you plan to write a NixOS service as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't think about this before;
but I could actually do that, have to read up on that though ^^
rm -r server_data | ||
rm -r server_log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rm -r server_data | |
rm -r server_log | |
rm -r server_data server_log |
mkdir "server_data" | ||
mkdir "server_log" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mkdir "server_data" | |
mkdir "server_log" | |
mkdir server_data server_log |
''; | ||
homepage = "https://www.grakn.ai/"; | ||
license = licenses.gpl3Plus; | ||
platforms = lib.attrNames systems; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
platforms = lib.attrNames systems; | |
platforms = attrNames systems; |
#patch before install | ||
echo '${javaPatch}' > typedb_java.patch | ||
echo '${typedb-wrapper-patch}' > typedb_wrapper.patch | ||
patch ./typedb typedb_java.patch | ||
|
||
mkdir $out | ||
cp -r ./* $out | ||
mkdir $out/bin | ||
|
||
cat ${typedbWrapper} > $out/bin/typedb | ||
echo "$out/typedb \"\$@\" --data=\$TYPEDB_SERVER_DATA --logs=\$TYPEDB_SERVER_LOGS --port=\$TYPEDB_SERVER_PORT" >> $out/bin/typedb | ||
patch $out/bin/typedb typedb_wrapper.patch | ||
|
||
chmod u+x $out/bin/typedb | ||
rm typedb_java.patch | ||
rm typedb_wrapper.patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#patch before install | |
echo '${javaPatch}' > typedb_java.patch | |
echo '${typedb-wrapper-patch}' > typedb_wrapper.patch | |
patch ./typedb typedb_java.patch | |
mkdir $out | |
cp -r ./* $out | |
mkdir $out/bin | |
cat ${typedbWrapper} > $out/bin/typedb | |
echo "$out/typedb \"\$@\" --data=\$TYPEDB_SERVER_DATA --logs=\$TYPEDB_SERVER_LOGS --port=\$TYPEDB_SERVER_PORT" >> $out/bin/typedb | |
patch $out/bin/typedb typedb_wrapper.patch | |
chmod u+x $out/bin/typedb | |
rm typedb_java.patch | |
rm typedb_wrapper.patch | |
#patch before install | |
echo '${javaPatch}' > typedb_java.patch | |
echo '${typedb-wrapper-patch}' > typedb_wrapper.patch | |
patch ./typedb typedb_java.patch | |
mkdir -p $out/bin | |
cp -r ./* $out | |
cat ${typedbWrapper} > $out/bin/typedb | |
echo "$out/typedb \"\$@\" --data=\$TYPEDB_SERVER_DATA --logs=\$TYPEDB_SERVER_LOGS --port=\$TYPEDB_SERVER_PORT" >> $out/bin/typedb | |
patch $out/bin/typedb typedb_wrapper.patch | |
chmod u+x $out/bin/typedb | |
rm typedb_java.patch typedb_wrapper.patch |
systems = { | ||
x86_64-linux = { | ||
src = fetchurl { | ||
url = "https://github.com/vaticle/typedb/releases/download/2.1.1/typedb-all-linux-2.1.1.tar.gz"; | ||
sha256 = "00wvkiahmrys32ckp6r59bbrzfd7jzsphniyjdj4p9bh7k339gn2"; | ||
}; | ||
dir = "typedb-all-linux-${typedbVersion}"; | ||
}; | ||
x86_64-darwin = { | ||
src = fetchzip { | ||
url = "https://github.com/vaticle/typedb/releases/download/2.1.1/typedb-all-mac-2.1.1.zip"; | ||
sha256 = "1njvssv9h0m13jz0ims96nfl1fjyk7lv8jdb6apcqpbkw7ykz8h8"; | ||
}; | ||
dir = "typedb-all-mac-${typedbVersion}"; | ||
}; | ||
x86_64-windows = { | ||
src = fetchzip { | ||
url = "https://github.com/vaticle/typedb/releases/download/2.1.1/typedb-all-windows-2.1.1.zip"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
systems = { | |
x86_64-linux = { | |
src = fetchurl { | |
url = "https://github.com/vaticle/typedb/releases/download/2.1.1/typedb-all-linux-2.1.1.tar.gz"; | |
sha256 = "00wvkiahmrys32ckp6r59bbrzfd7jzsphniyjdj4p9bh7k339gn2"; | |
}; | |
dir = "typedb-all-linux-${typedbVersion}"; | |
}; | |
x86_64-darwin = { | |
src = fetchzip { | |
url = "https://github.com/vaticle/typedb/releases/download/2.1.1/typedb-all-mac-2.1.1.zip"; | |
sha256 = "1njvssv9h0m13jz0ims96nfl1fjyk7lv8jdb6apcqpbkw7ykz8h8"; | |
}; | |
dir = "typedb-all-mac-${typedbVersion}"; | |
}; | |
x86_64-windows = { | |
src = fetchzip { | |
url = "https://github.com/vaticle/typedb/releases/download/2.1.1/typedb-all-windows-2.1.1.zip"; | |
systems = rec { | |
x86_64-linux = { | |
src = fetchurl { | |
url = "https://github.com/vaticle/typedb/releases/download/${version}/typedb-all-linux-${version}.tar.gz"; | |
sha256 = "00wvkiahmrys32ckp6r59bbrzfd7jzsphniyjdj4p9bh7k339gn2"; | |
}; | |
dir = "typedb-all-linux-${typedbVersion}"; | |
}; | |
x86_64-darwin = { | |
src = fetchzip { | |
url = "https://github.com/vaticle/typedb/releases/download/${version}/typedb-all-mac-${version}.zip"; | |
sha256 = "1njvssv9h0m13jz0ims96nfl1fjyk7lv8jdb6apcqpbkw7ykz8h8"; | |
}; | |
dir = "typedb-all-mac-${typedbVersion}"; | |
}; | |
x86_64-windows = { | |
src = fetchzip { | |
url = "https://github.com/vaticle/typedb/releases/download/${version}/typedb-all-windows-${version}.zip"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SuperSandro2000 No need for rec
. You only introduce version
references, which don't come from this attrset.
I marked this as stale due to inactivity. → More info |
Hi @haskie-lambda, I'm cherry picking old PR in I notice that many feedback in here were never addressed. If you don't, and it's perfectly fine, do you mind closing the PR? Thanks in advance. |
much of it is probably outdated anyway; I'm gonna close it for now; |
Thank you very much. |
Motivation for this change
provide a standard way of installing typedb akin to the installers for other systems.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)