Smederee (low german: forge/smithy)
A frugal platform which is dedicated to help people build great software together.
License
This code is licensed under the GNU Affero General Public License 3.0 or
later, see the LICENSE file for details.
System requirements
- Java 17 (or higher)
- PostgreSQL 13 (or higher)
- The time zone of the DBMS is expected to be set to
Etc/UTC
!
- Darcs
- colordiff (for coloured diffs)
Developer guide
For development and testing you need to install sbt.
Please see CONTRIBUTING.md for details how to to contribute
to the project.
During development you can start (and restart) the application via the reStart
sbt task provided by the sbt-revolver plugin.
Cloning via ssh has the following constraints currently:
- An RSA key is required!
- A custom port is used!
- Problems with newer SSH implementations due to changed
scp
!
Using a custom ssh port
To make darcs use the custom port either set the SSH_PORT
environment
variable (SSH_PORT=30983 darcs clone ...
) or configure your ssh client
accordingly in ~/.ssh/config
. Something like this should be sufficient:
# Only use configured identities even if there are more available.
IdentitiesOnly yes
IdentityFile ~/.ssh/id_ed25519
Host darcs.smeder.ee
IdentityFile ~/.ssh/id_rsa
Port 30983
User darcs
With such a configuration you should be able to use darcs clone
etc.
without having to set the environment variable.
Fixing problems with scp
On some systems the scp
command will use sftp
internally which will
cause operations to break because we currently do not have a working SFTP
repository access layer. But you can circumvent the issue by providing a
flag (custom scp
command to darcs) by using the DARCS_SCP
environment
variable:
% DARCS_SCP="scp -O" SSH_PORT=30983 darcs clone ...
Protecting endpoints
If an endpoint is intended to be used only by guests (users that are not
logged in) then it should be implemented two times:
- a regular endpoint (
HttpRoutes
) with the intended implementation
- a protected endpoint (
AuthedRoutes
) with:
- a simple redirect (
SeeOther
) or error page
- put within a middleware with fall through
Tests
Tests are included in the project. You can run them via the appropriate sbt tasks
test
and IntegrationTest/test
. The latter will execute the integration tests.
Be aware that the integration tests might need a working database.
Deployment guide
Please ensure that the system requirements are met and that you have the
credentials needed to access the database.
Database setup
The application uses schemas which may reside in a single database or not
but it is important that the configured database users have all necessary
permissions on that schemas. This can be achieved in a multitude of ways:
- The schema is created beforehand by the administrator with the correct
owner, for example:
CREATE SCHEMA "hub" AUTHORIZATION smederee_hub;
- The database is owned by the user and the schema will be created on the
first application start automatically.
Please note that different users (modules) sharing the same database (which
is possible due to the schema separation) need CONNECT
and CREATE
permissions on the database.
GRANT CONNECT, CREATE ON DATABASE <database name> TO <role name>;
TODO
Coloured diffs
- Install
colordiff
- Configure the
$SMEDEREE_USER/.darcs/defaults
file to contain the following line:
diff diff-command colordiff -rN -u %1 %2