Eloquent is a lightweight web application written in D
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
i18n initial changers for internationalization support Aug 25, 2016
public change font Mar 19, 2017
source remove consoled as it's not maintained May 11, 2018
views
.editorconfig removed coveralls stuff as something in vibe-d breaks coverage Aug 20, 2016
.gitignore ignore local dub settings.json May 11, 2018
.travis.yml travis should run doveralls at script phase so failures are detected Jun 12, 2018
Brewfile fix travis-ci Mac builds May 13, 2018
LICENSE
README.md
dub.json update dependencies Jun 11, 2018
eloquent.sublime-project updated gitignore and my sublime-project file Dec 30, 2015
package.json updated front-end dependencies May 12, 2018
schema.sql corrected key for user level Sep 1, 2016
screenshot.png minor layout changes Apr 18, 2016
yarn.lock

README.md

Eloquent

Build Status

Coverage Status

Eloquent is a lightweight web application written in D. It is essentially an implementation of Wordpress. If you already have a Wordpress installation you can use the existing database and serve the content using Eloquent instead of the usual application written in PHP.

This application is currently a work in progress and should only currently be used as an example of how to get going with developing web applications in D. Functionality is currently limited to merely displaying existing blog posts.

Wordpress blog posts being served by Eloquent

Main dependencies

Yet to implement

  • editing/creating content
  • comments
  • internationalisation

Running the application

You'll need an existing wordpress database running on MySQL or Mariadb. The application looks for a file named app.properties that should be placed in the same directory as the compiled executable.

The properties file should contain your database connection details and path for an error log in the following format:

http.port=80

db.dialect=MySQL
db.domain=localhost
db.port=3306
db.name=mywordpressdb
db.user=dbusername
db.password=dbPassword
db.createSchema=false

auth.salt=RANDOMLY GENERATED 32-bit SALT HERE

# optional log settings. The default log level is info (options: verbose, debug, trace, error, info) with filename as eloquent-server.log
log.file=eloquent-server.log
log.level=trace

Building

You'll need the D compiler and DUB. The following versions or higher

  • dmd v2.069.2 or ldc v1.0.0
  • dub v1.0.0

If your system uses version 1.1 of OpenSSL (such as Fedora) use VibeUseOpenSSL11 in the versions of dub.json

Build using dub

Release builds can be done using the default configuration.

dub --compiler=ldc2

During development the unittest configuration can be used if you only intend to use sqlite.

dub --config=unittest

Build dependencies (client side)

The front end uses jQuery, Bootstrap 4, and Font Awesome. These dependencies are handled via Bower which can be installed using npm

On Fedora nodejs and npm can be installed from the repository:

sudo dnf install nodejs npm

Then install bower globally:

sudo npm install -g bower

There's no need to do a bower install as this will be done by dub during the build process.

Build dependencies (server side)

You will also need libevent on your system

Ubuntu:

sudo apt-get install libevent-dev libsqlite3-dev libpq-dev

Fedora:

sudo dnf install libevent-devel openssl-devel sqlite-devel postgresql-devel

OSX:

brew install libev libevent sqlite

Setting up the database

Install Maria DB

Ubuntu: sudo apt-get install mariadb-client mariadb-server Fedora: sudo dnf install mariadb mariadb-server

Create the database and a user

CREATE DATABASE eloquent;
CREATE USER 'dbuser'@'localhost' IDENTIFIED BY 'passw0rd';
GRANT ALL PRIVILEGES ON eloquent.* TO 'dbuser'@'localhost';

Then import a SQL dump of a wordpress installation

mysql -u dbuser -p eloquent < wordpress-bak.sql

Running behind Apache

Make sure you have Apache installed:

sudo apt-get install apache2

Configure a Virtual Host for use with the application sudo vim /etc/apache2/sites-available/eloquent.conf using the following content:

<VirtualHost *:80>
    ServerAdmin webmaster@example.com
    ServerName example.com
    ServerAlias www.example.com

    ErrorLog /var/log/apache2/mysite-error.log
    CustomLog /var/log/apache2/mysite-access.log common

    ProxyRequests off
    ProxyPreserveHost off
    ProxyPass / http://127.0.0.1:8080
    ProxyPassReverse / http://127.0.0.1:8080

</VirtualHost>

Then make sure to enable the relevant mods and restart Apache

sudo vim /etc/apache2/sites-available/eloquent.conf
sudo a2enmod proxy proxy_http
sudo a2ensite eloquent

Check the config and restart

Verfiy the Apache config with apachectl configtest then restart:

sudo systemctl restart apache2