tdt / start
If you want to start working on The DataTank, start here! This is an installer, a config reader and a router.
Requires
- php: >=5.3.0
- justinrainbow/json-schema: 1.3.1
- tdt/core: v0.1.3
- tdt/pages: dev-master
Suggests
- tdt/core: RESTful API to configure several inputs to format using these formatters
- tdt/input: A streaming ETL with mapping function included. Depending on your configuration, you can extract files in different formats, transform then into PHP arrays, optionally map them to a vocabulary and load the arrays in a store
This package is not auto-updated.
Last update: 2024-12-21 14:17:20 UTC
README
If you want to start working on The DataTank, start here! This is an installer, a config reader and a router. If you have an empty LAMP stack, this is the right way to go. If you already have a Symfony, Drupal, WordPress, Zend... system installed, you might want to look into the separate packages.
Installation
Composer
We use composer to install all The Datatank's dependencies. Composer is a PHP package manager and installs necessary dependencies for you, instead of having to download those dependencies yourself. These dependencies are described in the composer.json file along with some additional meta-data. For more information about composer, check out their project website.
Open a terminal, and install composer:
$ curl -s https://getcomposer.org/installer | php # Move composer to a directory in your $PATH (for easy access) $ sudo mv composer.phar /usr/local/bin/composer
Create-project
If you have composer installed, you can get your copy of tdt/start by running:
$ composer create-project tdt/start -s dev
After that a composer update: composer update
is adviced.
Alternative
Clone this git repository to your machine, you can checkout to a certain tag (version) too. After that use composer to get all dependencies.
$ composer update
Getting started
There are two folders in this repository: public/ and app/. Public contains all the publicly accessible files, such as html, javascript and css files. App contains all the bootstrap code which configures and initiates the correct packages.
index.php
Copy the example index.php file from public/index.example.php → public/index.php. Change the environment setting if desired. The default environment setting is production, but if you're looking to develop or test the software you want to change the environment setting to development or testing respectively.
Configuration
Copy the config example files in app/config/ (e.g. app/config/general.example.json → app/config/general.json)
Below we cover each of the configuration files and what their configuration parameters are:
general.json
- hostname - The hostname of the server it's installed on e.g. http://localhost/ .
- subdir - The subdirectory of the host where you installed The DataTank. Mostly this is the filestructure relative to your www folder. Don't forget the trailing slash if you're filling this in!
- timezone - The timezone you're in.
- defaultlanguage - The abbreviation of your language e.g. en, nl,...
- defaultformat - The default format in which queried data will be presented in if no format is specified with the request.
- accesslogapache - The absolute path to the apache log access file. This will be used to perform some statistical queries.
- cache - Contains three parameters to perform caching:
- system - Choose from NoCache or MemCache. If you opt for MemCache, be sure that Memcached is installed.
- host - The host that the caching system is running on. Note that if NoCache has been used, host and port don't really matter.
- port - The port to which we have to connect in order to communicate with the caching system.
- logging - Contains parameters to log actions that happen within the software:
- enabled - true/false.
- path - The absolute path to a directory where we can put the logging files. Make sure PHP has write access to this directory!
db.json
- system - The system name of the database. MySQL is strongly advised, although we use an ORM that handles different kinds of databases, we have not tested this thoroughly enough.
- host - The host on which the database runs. e.g. localhost
- user - The username to connect to the database. Make sure this user has write privileges.
- name - The name of the database you want to use to let The DataTank write its meta-data in.
- password - The password for the user to connect to the database.
cores.json
This file will contain the regular expressions that will route an HTTP-request to the correct destination. Uncomment the routes in the core entry of the json file, and that should get you going.
auth.json
This file will contains your user(s) for the autheticated parts of The DataTank. Username and password are required.
These users are used in combination with routes, serveral routes in the example cores file require the user tdtadmin
for example, but here are some more:
#####Example routes
// Normal route "HTTP_METHOD | URI" : "CONTROLLER" // Single user "HTTP_METHOD | URI | @username" : "CONTROLLER" // Multiple users "HTTP_METHOD | URI | @username, @user2, @user3" : "CONTROLLER"
Virtual host
- Make the public/ folder the root of a virtual host.
Below are some examples but you can use any webserver you want.
Nginx
server{ # Listen to a certain ip/port (e.g. IPV4 and IPV6 on port 80) listen [::]:80; # This example runs the datatank on a subdomain server_name data.domain.ext; # Point your root to the correct folder root /path/to/tdt/start/public; # Rewrite for clean URLs location / { rewrite ^/(.*)$ /index.php?$1 last; } # Other directives here }
Apache
Rewrites are done by the included .htaccess file
<VirtualHost *:80> # Point your root to the correct folder DocumentRoot /path/to/tdt/start/public # This example runs the datatank on a subdomain ServerName data.domain.ext # Other directives here </VirtualHost>
Updating tdt/start
Updating tdt/start isn't something you can do with composer (for now). However you can still upgrade by pulling the latest version with GIT:
git init git remote add origin https://github.com/tdt/start.git git pull