Structr

This whole process is a whack-a-mole of versions and environments.

structr-core/src/test/java/org/structr/test/core/script/LicensingScriptingTest.java structr-test-configuration/pom.xml structr-core/src/test/java/org/structr/test/common/LicensingTest.java structr-core/src/test/java/org/structr/test/common/StructrTest.java structr-ui/src/test/java/org/structr/test/web/StructrUiTest.java structr-db-driver-api/src/main/java/org/structr/api/config/Settings.java structr-ui/src/main/resources/structr/js/config.js

sudo docker exec c4d1b8a60842 tar Ccf $(dirname /home/user/Downloads/app) - $(basename /home/user/Downloads/app) | tar Cxf /home/user/Downloads/app -

Docker cp man

sudo docker exec -it c4d1b8a60842 /bin/bash

Work Log

13 Feb 2022

As it turns out, there were a lot of changes between structr 4.0 and 4.1. Now I am building the src. There doesn’t seem to be a branch for version 4.1, so I went with the main branch.

sudo apt install maven
git clone https://github.com/structr/structr.git
cd structr
sudo mvn clean install

I ran into trouble with the neo4j test configuration:

Failed to execute goal io.fabric8:docker-maven-plugin:0.36.0:start (prepare-database) on project structr-test-configuration: I/O Error: [neo4j:4.3] “database”: Timeout after 20097 ms while waiting on log out ‘(.?)Bolt enabled on 0.0.0.0:7687.’ -> [Help 1]

The test config file has a profile for testing the neo4j database connection. It includes the authentication neo4j/admin but obviously our database doesn’t use that username/pass combination.

So edit that line in structr-test-configuration/pom.xml to read:

<NEO4J_AUTH>[username]/[password]</NEO4J_AUTH>

Also, if you are running neo4j on a nonstandard port, modify <port>7689:7687</port> appropriately.

And of course if you want the latest graalvm that is supported:

wget https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/graalvm-ce-java11-linux-amd64-22.0.0.2.tar.gz
tar -xvf graalvm-ce-java11-linux-amd64-22.0.0.2.tar.gz
sudo mv graalvm-ce-java11-22.0.0.2/ /usr/lib/jvm/
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/graalvm-ce-java11-22.0.0.2/bin/java 1
sudo update-alternatives --config java

Then I had problems with the surefire plugin.

[ERROR] Error occurred in starting fork, check output in log [ERROR] Process Exit Code: 1 [ERROR] ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called?

Upon calling the command directly (with sudo), I got

Error: Unable to access jarfile /home/user/structr/structr-core/target/surefire/surefirebooter5618511526590783598.jar

And upon inspection, the surefire folder did not exist.

wget https://dlcdn.apache.org/maven/surefire/surefire-3.0.0-M5-source-release.zip
unzip surefire-3.0.0-M5-source-release.zip
cd surefire-3.0.0-M5/
sudo mvn clean install
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/graalvm-ce-java11-22.0.0.2/bin/jar 1
sudo update-alternatives --install /usr/bin/jshell jshell /usr/lib/jvm/graalvm-ce-java11-22.0.0.2/bin/jshell 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/graalvm-ce-java11-22.0.0.2/bin/javac 1

If you have other versions of these bins, you will need to sudo update-alternatives --config javac (jshell, jar) to change the order.

Also, you need to update the JAVA_HOME variable. I added permanent lines in ~/.bashrc:

export PATH=/usr/lib/jvm/graalvm-ce-java11-22.0.0.2/bin:$PATH
export JAVA_HOME=/usr/lib/jvm/graalvm-ce-java11-22.0.0.2/

Structr has some hard coded neo4j password in their tests in structr-core/src/test/java/org/structr/test/common/LicensingTest.java. So I modified that line too.

Settings.ConnectionPassword.setValue("admin");

And again in structr-core/src/test/java/org/structr/test/common/StructrTest.java

Settings.ConnectionPassword.setValue("admin");

And again in structr-db-driver-api/src/main/java/org/structr/api/config/Settings.java

public static final Setting<String> Neo4jDefaultUsername         = new StringSetting(databaseGroup,  "hidden",                  "database.neo4j.default.username",   "neo4j");
public static final Setting<String> Neo4jDefaultPassword         = new StringSetting(databaseGroup,  "hidden",                  "database.neo4j.default.password",   "admin");

public static final Setting<String> ConnectionPassword           = new StringSetting(databaseGroup,  "hidden",                  "database.connection.password",     "admin");
public static final Setting<String> ConnectionDatabaseName       = new StringSetting(databaseGroup,  "hidden",                  "database.connection.databasename", "neo4j");

And again in structr-ui/src/test/java/org/structr/test/web/StructrUiTest.java

Settings.ConnectionUser.setValue("neo4j");
Settings.ConnectionPassword.setValue("admin");

There are also lines for database name and user if you need to change those. Though you won’t be able to use more than one database with the community edition of Neo4j.

Seriously. Why put so many hard coded passwords? There might be more in the future so if you keep getting errors, check for more “admin” or “neo4j” passwords.

The only reason I found this line was because I searched through the pages of search results on github for neo4j.

The most recent version of structr also includes some alternative language interpretations so you need to install those through Graalv:

gu install python R

I don’t know which ones are necessary. It seems that python and R are currently experimental You might need to install others gu available.

Make sure that you log out and log back in when you make changes to the environment.

One of the test scripts was throwing an very helpful error:

[ERROR] LicensingScriptingTest.testUnlicensedFunctions:54 Unexpected exception.

I couldn’t immediately figure out the source of the problem (and apparently neither could the devs) so I just commented that line out in the file structr-core/src/test/java/org/structr/test/core/script/LicensingScriptingTest.java:

/*fail("Unexpected exception.");*/

This might be related to the fact that I have not obtained a license key from Structr. I’ve filled their webform for obtaining one several times with different email addresses, and still nothing.

I changed the Iteration of 100 nodes via getNextSibling to 150ms in stead of 100ms. structr-ui/src/test/java/org/structr/test/web/basic/DOMAndPageTest.java

Anyway… I still couldn’t get it to work. I guess I will just have to deal with docker.

12 Feb 2022

Trying to get docker to work with a vpn: https://maxammann.org/posts/2020/04/routing-docker-container-over-vpn/

Failed.

Structr on Ubuntu 18.04 native

I executed the standard install of structr but could not get it to work.

sudo dpkg -i structr-4.0.1.deb

The .deb is provided as a link to download via their signup webform.

At first I was getting IP address binding errors. That seems like a docker issue, not a structr one. Ultimately, I had to shut down my VPN to get that solved.

Anyway, when I attempted to start structr sudo systemctl start structr I kept getting errors saying:

ERROR org.structr.core.Services - Strict Java Runtime Version check enabled. Aborting due to version mismatch. Please set application.runtime.enforce.recommended = false in structr.conf to enable start despite Java Runtime Version mismatch

application.runtime.enforce.recommended seems to be available on the structr dashboard during runtime. Not exactly helpful.

I think this error was written with docker in mind, since the /usr/lib/structr/bin/structr.conf file is nothing but command line options. The problem seems to be fixed for the next version by changing the default enforcement=false.

Anyway, until they come out with another release (I don’t feel confident enough to build from source without instruction):

wget https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.3.0/graalvm-ce-java11-linux-amd64-20.3.0.tar.gz
tar -xvf graalvm-ce-java11-linux-amd64-20.3.0.tar.gz
sudo mkdir /usr/lib/jvm
sudo mv graalvm-ce-java11-20.3.0/ /usr/lib/jvm/
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/graalvm-ce-java11-20.3.0/bin/java 1

If you have other java versions installed, you will need to update the order using sudo update-alternatives --config java.

I also put a rule into my firewall for structr and neo4j (not a permanent thing for security reasons):

sudo ufw allow in 8082/tcp
sudo ufw allow in 7687/tcp

Then I had to install neo4j:

sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://debian.neo4j.com/neotechnology.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb https://debian.neo4j.com stable 4.1"
sudo apt install neo4j
sudo systemctl enable neo4j.service

This is install openjdk and set the priority above your Graalvm install that we set before, so update the priority with sudo update-alternatives --config java and setting your Graalvm install from the selections.

Start up structr and neo4j:

sudo systemctl start structr
sudo systemctl start neo4j.service
cypher-shell

Log in with the initial username pass neo4j neo4j. Then set your new password (required) and then :exit.

I also uncommented the line dbms.default_listen_address=0.0.0.0 in /etc/neo4j/neo4j.conf to allow the neo4j browser on my laptop to connect to the neo4j database on my server (where structr is located).

If you made changes to neo4j config, make sure to restart the service: sudo systemctl restart neo4j.service.

Navigate to http://[your server ip address]:8082/structr/config to trigger the initial setup. You might have to wait 30-60 seconds for structr to actually start.

An automatic config setup page should trigger and make you set a superuser password and set up a database connection. If not, click the Security Settings and Database Connections tabs respectively.

  • Connection URL: bolt://localhost:7687
  • Username: neo4j
  • Password: [the neo4j pass you set earlier]

Click Save to structr.conf to commit the changes. Then restart the service sudo systemctl restart structr and navigate to http://[server address]:8082/structr/ (give it 60 seconds to start up) to make sure everything works as expected.

More:

Bibliography