This part of the documentation is aimed at people want to compile the project. As there are currently no pre-compiled distributions available, it is also relevant for administrators wanting to run their own server.
Currently it is assumed that this project will built on a UNIX-like environment. Although building it on Windows should be possible, all helper scripts (and Makefiles) make a lot of UNIX -centric assumptions.
There are loads of fancy task-runners out there, but a “normal” interface to all programming-related tasks is still a Makefile. Most tasks you will need to do regulary are therefore available via make. Apart from that there are folders for schemas, documentation, example projects and helper scripts.
At its core the server is a “typical” Ruby on Rails application which relies on the following software. The given versions are a known konfiguration, more recent versions will probably work as well.
Alternatively you may use Docker to run the server and compile the client.
Database schemas created with BlattWerkzeug make use of regular expressions which are usually not compiled into the sqlite3 binary. To work around this most distributions provide some kind of sqlite3-pcre-package which provides the regex implementation.
These packages should install a single library at /usr/lib/sqlite3/pcre.so which can be loaded with .load /usr/lib/sqlite3/pcre.so from the sqlite3-REPL. If you wish, you can write the same line into a file at ~/.sqliterc which will be executed by sqlite3 on startup.
The development environment assumes that any subdomains of localdomain will be routed to the localhost. This works out of the box on various GNU/Linux-distributions, but as this behaviour is not standardised it should not be relied upon. To reliably resolve project-subdomains you should either write custom entries for each project in /etc/hosts or use a lightweight local DNS-server like Dnsmasq. In a production environment you should run the server on a dedicated domain and route all subdomains to the same server instance.
The application itself is available in multiple languages. en.blattwerkzeug.localdomain should render the english version, de.blattwerkzeug.localdomain the german version.
The web-projects will be rendered on their own subdomains.
The actual project code is stored in a PostgreSQL database. You will need to provide a user who is able to create databases. For development you should stick to the default options that are provided in the server/config/database.yml file.
Clone the sources from the git repository at BitBucket.
Ensure you have the “main” dependencies installed (ruby and bundle for the Server, node and npm for the client).
Compiling all variants of the client requires can be done by navigating to the client folder and executing the following steps.
make install-deps will pull all further dependencies that are managed by the respective packet managers. If this fails check that your environment meets the requirements: Environment Dependencies.
After that, the web application need to be compiled and packaged once: make client-compile for a fully optimized version or make client-compile-dev for a development version.
The server requires the special “IDE Service” variant of the client to function correctly. It can be created via make cli-compile.
Start a PostgreSQL-server that has a user who is allowed to create databases.
Setup the database and fill the database (make reset-live-databases). This will create all required tables and load some sample data.
You may now run the server, to do this locally simply use make run-dev and it will spin up a local server instance listening on port 9292. You can alternatively run a production server using make run.
Run NG_OPTS="--watch" make client-compile-dev in the client folder. The --watch option starts a filesystem watcher that rebuilds the client incrementally on any change, which drastically reduces subsequent compile times.
Run make client-test-watch to continously run the client testcases in the background.
Run make test-watch to continously run the server testcases in the background. This requires a running PostgreSQL database server.
Calling make test in the client folder will run the tests once against a headless version of Google Chrome and Firefox.
make test-watch will run the tests continously after every change to the clients code.
Firefox and Chrome for the non-headless variants that open dedicated browser windows.
FirefoxHeadless and ChromeHeadless that run in the background without any visible window.
BlattWerkzeug comes with a complex set of required objects to work properly. This includes grammars, block languages, example projects, … The “normal” Rails way of providing those objects via db/seeds.rb does not work for these structures at all: They are simply to complex to be meaningfully edited by hand.
The Makefile therefore exposes the store-live-data target which stores the current state of the programing languages and projects in the seed folder. This allows programmers to edit grammars, block languages and projects using the web-IDE and to persist those changes in the git repository.
The YAML-files in the seed-folder are very prone to merge conflicts. Please make sure to only ever commit as small changes as possible. It is good practive to routinely use make reset-live-data run-dev when starting the server to ensure that your database-state is always up do date. If you run store-live-data from an old database state you may override newer changes that are part of the repository already.
There are pre-built docker images for development use on docker hub: marcusriemer/sqlino. These are built using the various Dockerfiles in this repository and can also be used with the docker-compose.yml file which is also part of this repository. Under the hood these containers use the same Makefiles and commands that have been mentioned above.
Depending on your local configuration you might need to run the mentioned Makefile with sudo.
make -f Makefile.docker pull-all retrieves the most recent version of all images from the docker hub.
make -f Makefile.docker run-dev starts docker containers that continously watch for changes to the server and client folders. It mounts the projects root folder as volumes into the containers, which allows you to edit the files in server and client in your usual environment. A third container is started for PostgreSQL.
make -f Makefile.docker shell-server-dev opens a shell inside the docker container of the server. You might require this to do maintenance tasks with bin/rails for the server.
These issues happen on a semi-regular scale.
You probably forgot to load the initial data. Run make load-live-data in the server folder.
Startup Error: No cli program at "../client/dist/cli/main.cli.js"
The server requires the cli version of the IDE to run. Create it using make compile-cli in the client folder.