Skip to content
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

etesync-web: init at 0.6.1, nixos/etesync-web: init module and test #130680

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions nixos/doc/manual/from_md/release-notes/rl-2111.section.xml
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,14 @@
<link xlink:href="options.html#opt-services.prometheus.exporters.smartctl.enable">services.prometheus.exporters.smartctl</link>.
</para>
</listitem>
<listitem>
<para>
<link xlink:href="https://github/etesync/etesync-web">etesync-web</link>,
the official web interface for etesync and the etebase server.
Available as
<link linkend="opt-services.etesync-web.enable">services.etesync-web</link>.
</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="sec-release-21.11-incompatibilities">
Expand Down
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2111.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ In addition to numerous new and upgraded packages, this release has the followin

- [smartctl_exporter](https://github.com/prometheus-community/smartctl_exporter), a Prometheus exporter for [S.M.A.R.T.](https://en.wikipedia.org/wiki/S.M.A.R.T.) data. Available as [services.prometheus.exporters.smartctl](options.html#opt-services.prometheus.exporters.smartctl.enable).

- [etesync-web](https://github/etesync/etesync-web), the official web interface for etesync and the etebase server. Available as [services.etesync-web](#opt-services.etesync-web.enable).

## Backward Incompatibilities {#sec-release-21.11-incompatibilities}

- The NixOS VM test framework, `pkgs.nixosTest`/`make-test-python.nix`, now requires detaching commands such as `succeed("foo &")` and `succeed("foo | xclip -i")` to close stdout.
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,7 @@
./services/web-apps/engelsystem.nix
./services/web-apps/ethercalc.nix
./services/web-apps/fluidd.nix
./services/web-apps/etesync-web.nix
./services/web-apps/galene.nix
./services/web-apps/gerrit.nix
./services/web-apps/gotify-server.nix
Expand Down
50 changes: 50 additions & 0 deletions nixos/modules/services/web-apps/etesync-web.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.services.etesync-web;
etebaseHost = config.services.etebase-server.settings.allowed_hosts.allowed_host1;
pkg = pkgs.etesync-web.override { inherit (cfg) defaultServer; };
webRoot = "${pkg}/libexec/${pkg.pname}/deps/${pkg.pname}/build/";
in
{
meta.maintainers = with maintainers; [ pacman99 ];
options = {
services.etesync-web = {
enable = mkEnableOption "host etesync web interface with nginx";
hostName = mkOption {
type = types.str;
description = ''
The hostName to serve etesync-web from
'';
};
defaultServer = mkOption {
type = with types; nullOr str;
default = if etebaseHost != "0.0.0.0" then etebaseHost else null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain this line? Why is 0.0.0.0 not a valid value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll clarify with a comment. But the idea is that etebase-server's default allowed_host1 is 0.0.0.0, so I'm only setting the etebase host if its not the default.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is actually useful, since it won't cause etesync-web to be rebuilt for the default setup.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest default = "0.0.0.0". The resulting package will be cached anyway due to the test.

Copy link
Contributor Author

@Pacman99 Pacman99 Jul 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest default = "0.0.0.0". The resulting package will be cached anyway due to the test.

Thats not a working or sane default. If you enable etesync-web without an etebase server then the best default is the official etebase server instance(etesync.com). That way etesync-web will actually work without setting a server. 0.0.0.0 doesn't really mean anything.

defaultText = ''
if set ''${config.services.etebase-server.settings.allowed_hosts.allowed_host1}, otherwise https://etebase.com"
'';
description = ''
The default etebase server to login to
'';
};
};
};
config = lib.mkIf cfg.enable {
services.nginx = {
enable = true;
virtualHosts.${cfg.hostName} = {
locations."/" = {
root = webRoot;
tryFiles = "\$uri \$uri/ /index.html =404";
extraConfig = ''
autoindex on;
'';
};
locations."= /50x.html".root = webRoot;
extraConfig = ''
error_page 500 502 503 504 /50x.html;
'';
};
};
};
}
17 changes: 17 additions & 0 deletions nixos/tests/etesync-web.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import ./make-test-python.nix ({ pkgs, ... }: {
name = "etesync-web";
meta = with pkgs.lib; {
maintainers = with maintainers; [ pacman99 ];
};
machine = { ... }: {
services.etesync-web = {
enable = true;
hostName = "localhost";
};
};
testScript = ''
machine.wait_for_unit("nginx.service")
machine.wait_for_unit("multi-user.target")
assert "EteSync - Secure Data Sync" in machine.succeed("curl http://localhost")
'';
})
36 changes: 36 additions & 0 deletions pkgs/servers/web-apps/etesync-web/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{ lib
, mkYarnPackage
, fetchFromGitHub
, defaultServer ? null
}:

mkYarnPackage rec {
pname = "etesync-web";
version = "0.6.1";

src = fetchFromGitHub {
owner = "etesync";
repo = "etesync-web";
rev = "v${version}";
sha256 = "iUNJbY0ImgGPSzcUnUv0yJccBeuaNaBwDwenEqjXyYs=";
};

packageJSON = ./package.json;
yarnLock = ./yarn.lock;
yarnNix = ./yarn.nix;

dontStrip = true;

buildPhase = lib.optionalString (defaultServer != null) ''
REACT_APP_DEFAULT_API_PATH="${defaultServer}" \
'' + ''
yarn build
'';

meta = with lib; {
homepage = "https://www.etesync.com/";
description = "The EteSync Web App - Use EteSync from the browser!";
maintainers = with maintainers; [ pacman99 ];
license = licenses.agpl3Only;
};
}
71 changes: 71 additions & 0 deletions pkgs/servers/web-apps/etesync-web/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"name": "etesync-web",
"version": "0.6.0",
"private": true,
"dependencies": {
"@date-io/moment": "^1.x",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.56",
"@material-ui/pickers": "^3.2.10",
"@material-ui/styles": "^4.10.0",
"etebase": "^0.41.0",
"fuse.js": "^5.0.9-beta",
"ical.js": "^1.4.0",
"immutable": "^4.0.0-rc.12",
"localforage": "^1.9.0",
"memoizee": "^0.4.14",
"moment": "^2.27.0",
"react": "^16.13.1",
"react-big-calendar": "^0.26.0",
"react-dom": "^16.13.1",
"react-dropzone": "^10.0.4",
"react-redux": "^7.2.1",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "^3.4.1",
"react-transition-group": "^4.3.0",
"react-virtualized": "^9.21.2",
"redux": "^4.0.5",
"redux-actions": "^2.6.5",
"redux-logger": "^3.0.6",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"uuid": "^3.1.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"lint": "eslint --ext .js,.jsx,.ts,.tsx src",
"eject": "react-scripts eject"
},
"devDependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"@types/color": "^3.0.1",
"@types/jest": "^24.0.4",
"@types/memoizee": "^0.4.4",
"@types/node": "^11.9.3",
"@types/react": "^16.9.0",
"@types/react-big-calendar": "^0.22.3",
"@types/react-dom": "^16.9.0",
"@types/react-redux": "^7.1.9",
"@types/react-router": "^5.1.8",
"@types/react-router-dom": "^5.1.5",
"@types/react-virtualized": "^9.21.8",
"@types/redux-actions": "^2.6.1",
"@types/redux-logger": "^3.0.8",
"@types/urijs": "^1.15.38",
"@types/uuid": "^3.4.3",
"typescript": "~3.9.7"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
Loading