Sinds Data Crow 4.0 is het mogelijk om Data Crow als server te draaien. Hierdoor kunnen klanten verbinding maken met een enkele instantie van Data Crow.
De servereditie is een geavanceerde server, een gecombineerde web- en applicatieserver. Dit betekent dat gebruikers verbinding kunnen maken met Data Crow via de thick-client (de Data Crow applicatie) en/of de webclient (de browser). De server maakt het mogelijk dat meerdere gebruikers, die een van deze clients (thick / web) gebruiken, tegelijkertijd verbinding maken met de server. Met de gebruikersbeheerfunctie kun je per gebruiker granulaire gebruikersrechten instellen, tot op veldniveau.
The server edition is headless, meaning it can run in environments where there is no graphical interface. It requires very little resources; a typical Data Crow server instance can cope with just having 1024MB of memory available.
De server heeft verschillende rollen, het is:
- een applicatieserver, waarmee een dikke client veilig kan verbinden.
- een webserver, waardoor browsers verbinding kunnen maken.
- een API-server waarmee andere diensten buiten Data Crow verbinding kunnen maken en informatie kunnen ophalen (alleen met uw toestemming). Zowel de webversie als de Data Crow Reader-app maken gebruik van de API.
De server installeren
#
De server installeren:
- Unzip de gezipte Data Crow Server distributie naar de installatielocatie.
That’s it – it does not require any further installation. It does require Java 25 or higher.
De server instellen #
Net zoals de normale client een gebruikersmap nodig heeft om de gegevens en instellingen in op te slaan, heeft de server dat ook. Je kunt ervoor kiezen om de servereditie een nieuwe lege gebruikersmap te laten maken, of je kunt ervoor kiezen om een bestaande gebruikersmap te gebruiken.
Tip: gebruik de thick client om de initiële gebruikersmap in te stellen - gebruik de client om gebruikers aan te maken, de systeeminstellingen te wijzigen en in principe om Data Crow naar wens te configureren. Dit in tegenstelling tot de webclient, die niet alle mogelijkheden van de thick client heeft.
De server uitvoeren
#
De server heeft geen grafische gebruikersinterface (GUI) en vertrouwt dus volledig op de opdrachtregel. Open de terminal (Linux- en Mac-gebruikers) / opdrachtprompt (Windows-gebruikers) en navigeer naar de installatiemap van Data Crow Server.
In the below example an example is shown for the Data Crow start command;
- Java -Xmx1024m -jar datacrow-server.jar
The -Xmx1024m parameter specifies the amount of memory available to Data Crow. You can change this to another number if necessary.
Nu zijn we klaar om de server te starten.
<command> -userdir:<user folder> -hostname:<server address> -port:<portnumber> -imageserverport:<portnumber> -webserverport:<portnumber> -credentials:<username>/<password>
Uitleg:
- De <command> Ik heb het hierboven uitgelegd, zorg ervoor dat je de juiste syntaxis gebruikt voor het platform dat je gebruikt.
- userdir: specificeert de locatie van de gebruikersmap.
Voorbeeld (Windows): -userdir:c:/server-data - haven: specificeert het hoofdpoortnummer voor de applicatieserver. De standaardpoort is 9000. Als je de poortparameter niet opgeeft, wordt poort 9000 gebruikt.
Voorbeeldpoort:9000
Wanneer de server is gestart, maken clients verbinding door de Data Crow Client in clientmodus te starten (-client parameter). - imageserverport: specifies the port to use for the HTTP image server. The default is port 8081. If you do not supply the port parameter, port 8081 will be used.
Voorbeeld: -imageserverport:8081 - apiserverport: specifies the port of the API server, which the web client and the Data Crow Reader app use. The default is port 8082.
Voorbeeld: -apiserverport:8082 - webserverport: specificeert de poort die gebruikt moet worden voor de webserver. Indien niet opgegeven, wordt de webservermodule niet gestart.
Voorbeeld: -webserverport:8080
Na het starten maken clients als volgt verbinding met de server:
http://<server address>:<webserverport>
Example: http://192.168.178.12:8080. - credentials: username and password of the first administrator. They are only used to create this user when the database has no users yet. After that they are ignored, so you can remove them from the start command. The server itself does not log in as a user. The default user for Data Crow is SA with a blank password. It is recommended to set a password for each user when using the client-server setup.
Example: (user rwaals, pw 123456): -referenties:rwaals/123456
Een tip over de referenties; je kunt deze ook invoeren in het bestand datacrow.credentials. Wanneer dit bestand aanwezig is in de installatiemap van de Data Crow server zal Data Crow de credentials uit dit bestand lezen en hoeven ze niet meer als parameter te worden opgegeven. Het bestand bestaat standaard niet; maak het bestand aan (een tekstbestand) en voer de referenties in dit bestand in: /.
Bijvoorbeeld: rwaals/123456
Andere, optionele parameters:
- bindto overrules the default way Data Crow server binds itself to your IP address. This is only necessary in unforeseen circumstances where Data Crow is not picking up the correct IP address to bind itself to. It also applies to the API server and the image server. Without it the web, API and image server listen on all addresses. With -bindto:127.0.0.1 they can only be reached through a reverse proxy on the same machine.
- hostnaam: the name of the server (or its IP address). This parameter is required. Useful if you don’t want to use the IP address as the go to address.
- api_adres_negeren: Dit wordt gebruikt om de automatische instelling van het adres voor de API-server door Data Crow te overschrijven. Met deze optie kun je het API-adres toewijzen aan een andere lokale poort die bijvoorbeeld door Caddyfile wordt gebruikt (omgekeerde proxy).
- imageserver_adres_overslaan: Dit wordt gebruikt om de automatische instelling van het adres voor de afbeeldingsserver door Data Crow te overschrijven. Met deze optie kun je het adres van de afbeeldingsserver toewijzen aan een andere lokale poort die bijvoorbeeld door Caddyfile wordt gebruikt (omgekeerde proxy).
- map geef de installatiemap van de Data Crow-server op (voor het geval er problemen optreden).
- probleemoplossing: zorg ervoor dat de Data Crow-server uitgebreide logbestanden kan bijhouden.
- tls: encrypts the connection of the full client with the server. The server creates a certificate for itself (in the security folder of the user directory), or you use your own with -tls_keystore:<file> and -tls_keystore_password_file:<file>. The server then only accepts encrypted connections from the full client. The image server accepts both encrypted (full client) and plain (a web client behind a proxy) connections.
- appserver_bindto: the address the application server (used by the full client) listens on. With -appserver_bindto:127.0.0.1 the full client can only connect from the server itself, for example through an SSH tunnel, so the application server cannot be reached from the internet.
- trusted_proxies: the IP address(es) of a reverse proxy in front of the web and API server, separated by commas (for example -trusted_proxies:127.0.0.1). Behind a proxy every request seems to come from the proxy. For requests from the addresses you give here, Data Crow takes the real address of the user from the X-Forwarded-For header. This is needed for the protection against failed logins, for HSTS (see below) and for users without a password: a request which comes through a proxy which is not trusted is never seen as coming from your local network.
- reset_2fa: -reset_2fa:<username> switches off two-factor authentication for this user when the server starts. Use it for an administrator who lost the phone and the recovery codes, and remove the parameter afterwards.
De server controleren #
Als alles goed is, zal de server iets rapporteren dat lijkt op het onderstaande:
INFO [main] (DcServer.java:140) – Server is gestart, klaar voor clientverbindingen.
INFO [main] (DcServer.java\:141) – Client can connect to IP address 192.168.0.121 on port 9000 and on image port 8081
INFO [main] (DcServer.java\:144) – Wachten op CTRL-C voor server afsluiten.
Het specificeert het eigenlijke IP-adres en de toegewezen poortnummers.
Fouten worden direct in de console weergegeven. Daarnaast is er het standaard logbestand in de gebruikersmap (data_crow.log).
If you want to debug the server (or see more messages) you can supply -debug parameter on startup.
De server stoppen #
Druk op CTRL-C in terminal / opdrachtpromptvenster.
Updating the server #
From version 5.3.1 an administrator can update the server from the full client or the web client. The server has to be started with start-server.sh of start-server.bat for this, see Een server updaten.
Verbinding maken met Data Crow: (Thin) Web Client #
Verbinding maken met de webserver is de eenvoudigste optie. Navigeer met een webbrowser naar het adres van de server:
http://:/
For example: http://192.168.178.120:8080/
The web client is described in De webclient. A language which was added on the server can be chosen on the login screen.
Verbinding maken met Data Crow: (Thick) Client #
Any installation above 4.0 can connect to a server. It’s a simple matter of supplying the -client command to your Data Crow startup:
In het onderstaande voorbeeld laat ik de <commando> voor het Data Crow client startcommando;
- Windows-gebruikers kunnen dit vervangen door:
datacrow.exe - Gebruik voor andere platforms:
Java -Xmx8096m -jar datacrow.jar
De –Xmx8096m Deze parameter geeft aan hoeveel geheugen er beschikbaar is voor Data Crow. U kunt dit indien nodig aanpassen naar een ander getal.
Maak verbinding met de server door Data Crow als volgt te starten (wijzig de snelkoppeling):
-client
Wanneer de client start, wordt het volgende inlogvenster weergegeven:
- Login name: uw gebruikersnaam (de standaardgebruiker is SA)
- Password: je wachtwoord (het wachtwoord voor gebruiker SA is leeg)
- Server Address:Het IP-adres van de server (raadpleeg de serverconsole voor het IP-adres, binnen een intern netwerk kan het IP-adres bijvoorbeeld 192.168.0.10 zijn).
- Application Server Port:De poort zoals geconfigureerd op de server (standaard 9000). Deze instelling wordt onthouden.
- Afbeelding Server Adres: het adres van de afbeeldingsserver, doorgaans hetzelfde adres als de server zelf.
- Image Server Port:: the port as configured on the server (the default of the server is 8081; the login window suggests 9001 the first time). This setting is remembered.
- Encrypted connection (TLS): tick this when the server was started with -tls.
Encrypted connection (TLS). The first time you are asked to trust the fingerprint of the certificate of the server. If it is a different certificate later on, you get a warning. A full client which does not use TLS gets a message after a few seconds that the server needs an encrypted connection. The full client also warns when you connect to a server on another computer without an encrypted connection; you can choose not to be warned again for that server. More about TLS: documentation/data_crow_howto_tls.md.
Same version. The full client and the server must have the same version. If not, logging in is refused with a message which tells which version to install.
Security of the server #
- Addresses which fail to connect repeatedly (failed logins, or programs which are not a Data Crow client, such as port scanners) are blocked for 60 minutes after 5 failed attempts within 10 minutes. This also applies to the login of the web client and the Data Crow Reader app. Addresses in your local network are never blocked.
- Users without a password can only log in from the local network. The automatic login of the web client, when only the SA user without a password exists, also only works from the local network. Set a password for users who connect from outside the local network.
- A login of the web client and the Data Crow Reader app ends after a time without activity. The times are set in the security settings of the server.
- The maximum size of attachments is checked by the server, also for the full client. Pictures larger than 50 MB or 50 megapixels are refused.
- The internal administrator account of the server cannot be used to log in.
- When the web client is used over HTTPS, browsers are told to always use HTTPS for it (HSTS, for one year). Behind a reverse proxy this only works when you start the server with -trusted_proxies and the proxy sends the X-Forwarded-Proto header, which Caddy does by default.
Webserver met SSL-beveiliging #
Als je onderweg toegang wilt tot je Data Crow-collectie, is het hosten van de Data Crow-server op een VPS (Virtual Private Server) een praktische en betaalbare optie. Een kleine VPS met Ubuntu, 2 GB RAM en 100 GB opslagruimte is ruim voldoende, en dergelijke instances zijn overal verkrijgbaar tegen lage maandelijkse kosten.
De server instellen
Start with a headless Ubuntu VPS — no GUI is needed. Install Java (OpenJDK 25 or higher is needed), then upload the Data Crow server files and your data directory to the VPS using SCP. Connect via SSH, unpack the archives, and arrange them as follows:
~/datacrow_server
~/datacrow_server/data
Begin Data Crow met:
java -jar datacrow-server.jar -userdir:./data -hostname: -webserverport:8080 -port:9000 -imageserverport:8082 -apiserverport:8081
Om de server draaiende te houden nadat u zich afmeldt, gebruikt u tmuxeen tmux-sessie starten, het opstartcommando uitvoeren en vervolgens afsluiten met Ctrl+B gevolgd door D. De server blijft op de achtergrond draaien.
Op dit moment is Data Crow bereikbaar via een adres zoals http://<your-ip>:8080 — functioneel, maar onbeveiligd.
HTTPS toevoegen met Caddy
Om Data Crow via HTTPS aan te bieden, kun je gebruikmaken van Caddy als reverse proxy. Caddy regelt automatisch de uitgifte van SSL-certificaten.
Stap 1 — Een DNS-record toevoegen
Voeg een Een plaat naar uw DNS-configuratie van het domein die verwijst naar het IP-adres van uw VPS. Bijvoorbeeld, het toevoegen van een record met de naam mijn naar datacrow.org geeft je my.datacrow.org.
Stap 2 — Installeer Caddy
sudo apt update && sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf ‘https://dl.cloudsmith.io/public/caddy/stable/gpg.key’ | sudo gpg –dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf ‘https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt’ | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update && sudo apt install caddy
Stap 3 — Configureer de Caddyfile
my.datacrow.org {
reverse_proxy localhost:8080
}
my.datacrow.org:8083 {
omgekeerde_proxy localhost:8081
}
my.datacrow.org:8084 {
omgekeerde_proxy localhost:8082
}
Dit mapt respectievelijk de webinterface, API-server en image server via Caddy.
Stap 4 — Start Data Crow met adresoverschrijvingen
Aangezien de API en de afbeeldingsserver nu via Caddy op verschillende externe poorten worden aangeboden, moet Data Crow worden geïnformeerd over de openbare adressen. Voeg de volgende parameters toe aan je opstartcommando:
-apiserverport:8081 -api_address_overrule:https://my.datacrow.org:8083/datacrow-api/api -imageserverport:8082 -imageserver_address_overrule:https://my.datacrow.org:8084
Caddy zet inkomende verzoeken op poorten 8083 en 8084 automatisch om naar de interne poorten 8081 en 8082. Het resultaat is een overzichtelijk, via HTTPS beveiligd adres voor je Data Crow-instantie.
Connection with the server #
The bottom left of the main window of the full client shows the connection with the server as a colored dot: green (fast), yellow (slow), orange (very slow, or the server is in maintenance) and red (no connection). The tooltip shows the server and the response time. When the connection is lost, a window blocks the application and tries to connect again (up to 20 attempts) and closes as soon as the server answers. After 20 attempts you choose to keep waiting or to close Data Crow.