We recommend a recent unix/linux-based OS. Please check if your desired OS meets the following requirements. If not, we recommend debian (9.5 aka Stretch or later) or Ubuntu (18.04 LTS aka Bionic Beaver or later). For Giza and later at least PHP 7.1.3 is required. Note: Installation on Windows 10 with PHP 5.6 was also successfully tested, but you will need to adjust the commands in these instructions by yourself to your local Windows version equivalents.
The following packages you should be able to install from your package manager:
- git
- Apache (or any other web server-software, e.g. nginx)
- PHP (
>= 8.0.2
) with the following extensions installed and enabled:- Imagick
- memcached (on Windows this will not work -- see later)
- mbstring
- gd
- xml
- zip
- libapache2-mod-php (on Unix systems)
- composer
- PostGIS (
>= 2.5
) - PostgreSQL (
>= 13
) - ImageMagick
- ufraw
- memcached (extension DLL not available for Windows at the moment, see later)
- unzip
- php-pgsql
- phpunit
- nodejs
- npm
Beside these packages we use a couple of packages you have to install on your own.
- Laravel (PHP-Framework), currently included in the Spacialist repository, so no need to install.
- GeoServer for hosting your own geo maps
There are no additional database migrations steps required. Laravel's migration command should take care of database changes. But you must update to the latest pre-0.6 release before switching to 0.6+. However, since we switched to a different code base, you have to get the new dependencies (see Download Dependencies in Package Installation). You should also check for changes in Proxy Setup and Configure Laravel. After switching to the new branch/release, you should get rid of the old dependencies. Before downloading the new dependencies, you should do the following steps:
- Copy
.env
file fromlumen
folder to the root folder (mv lumen/.env .env
) - Remove entire
lumen
folder (rm -rf lumen
) - Remove
bower_components
(if coming from a very old version) andnode_modules
(rm -rf bower_components node_modules
)
Some parts of Spacialist (Map, Files) have been released as separate Plugin. Thus, migrations have changed and only migrating from scratch or from the latest pre-0.9-Release (Helgö) is supported. However, since we switched to a different code base, you have to get the new dependencies (see Download Dependencies in Package Installation).
-
Install all the required packages. For debian-based/apt systems you can use the following command
sudo apt-get install git apache2 libapache2-mod-php unzip php composer postgresql postgis imagemagick php-pgsql php-imagick php-memcached php-mbstring php-gd php-zip php-xml ufraw memcached phpunit nodejs npm unzip
If the required php modules are not enabled by default, you can enable them with
a2enmod mod_proxy a2enmod mod_rewrite systemctl restart apache2.service
-
Clone This Repository
git clone https://github.com/DH-Center-Tuebingen/Spacialist
-
Download Dependencies
Please note: Before moving on, check your versions of composer (
composer -v
) and npm (npm -v
). Older versions can cause problems (composer < 1.8, npm < 6.x). Update them manually if your OS has outdated versions.cd Spacialist npm install composer install
Since Laravel has a sub-folder as document root Spacialist/public
, it won't work to simply copy Laravel to your webserver's root directory.
One solution is to setup a proxy on the same machine and re-route all requests from /Spacialist
to Laravel's public folder (e.g. /var/www/html/Spacialist/public
).
-
Enable the webserver's proxy packages and the rewrite engine
sudo a2enmod proxy proxy_http rewrite
-
Add a new entry to your hosts file, because your proxy needs a (imaginary) domain.
sudo nano /etc/hosts # Add an entry to "redirect" a domain to your local machine (localhost) 127.0.0.1 spacialist-laravel.tld # or anything you want
-
Add a new vHost file to your apache
cd /etc/apache2/sites-available sudo nano spacialist-laravel.conf
Paste the following snippet into the file:
<VirtualHost *:80> ServerName spacialist-laravel.tld ServerAdmin webmaster@localhost DocumentRoot /var/www/html/Spacialist/public DirectoryIndex index.php <Directory "/var/www/html/Spacialist/public"> AllowOverride All Require all granted </Directory> </VirtualHost>
-
Add the proxy route to your default vHost file (e.g.
/etc/apache2/sites-available/000-default.conf
)ProxyPass "/Spacialist" "http://spacialist-laravel.tld" ProxyPassReverse "/Spacialist" "http://spacialist-laravel.tld"
-
Enable the new vHost file and restart the webserver
sudo a2ensite spacialist-laravel.conf sudo service apache2 restart
In your config/app.php
you have to adjust the APP_URL
key. Replace http://localhost
with the URL of your instance.
E.g. https://spacialist.mydomain.tld
Laravel should now work, but to test it you need to create a .env
file which stores the Laravel configuration.
Inside the installation folder, create the .env
file:
cd /var/www/html/Spacialist
sudo nano .env
Then paste this configuration (Please edit some of the configuration settings *
to match your installation). Note: on Windows, memchached extension DLL seems unavailable. Use CACHE_DRIVER=array
instead where indicated:
APP_NAME=Spacialist
APP_ENV=local
APP_DEBUG=false
APP_KEY=base64:<32bit-key> #this needs to be a 32 digit random key. Use 'php artisan key:generate'
APP_URL=http://localhost #set this to your proxy url if needed and enable it by setting APP_FORCE_URL to true
APP_FORCE_URL=false #set this if you need to force using your proxy url
# Your database setup. pgsql is PostgreSQL. Host, port, database, username and password need to be configured first (e.g. using your database server's commands).
DB_CONNECTION=pgsql
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=*
DB_USERNAME=*
DB_PASSWORD=*
BROADCAST_DRIVER=log
CACHE_DRIVER=memcached # on Windows memcached extension unavailable, but it seems to work with "array"
SESSION_DRIVER=file
QUEUE_DRIVER=sync
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=webmaster@localhost
MAIL_FROM_NAME=Webmaster
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
JWT_SECRET=ase64:<32bit-key> #this needs to be a 32 digit random key. Use 'php artisan jwt:secret'
JWT_BLACKLIST_GRACE_PERIOD=0
VITE_APP_PATH=${APP_URL}
VITE_APP_NAME='Custom Instance'
If you want to send mails to your users, you have to adjust the MAIL_*
settings to match a smtp server from where you can send mails.
Spacialist is based on several JavaScript libraries, which are bundled using Vite.
Before running Vite (npm run dev
or npm run build
), you have to adjust the app location path and the app name. This is done using the VITE_APP_PATH
and VITE_APP_NAME
variables in .env
file.
Note: In the future zipped releases might be released, containing already bundled JavaScript libraries.
VITE_APP_PATH=Spacialist/subfolder/instance/
VITE_APP_NAME=Custom Spacialist Instance
Now you can run Vite using
npm run dev
# or
npm run build
depending on whether you want a debugging-friendly development build or an optimized production-ready build.
After the .env
file has been configured you should run the migrations to setup your database.
php artisan migrate
After your tables are set up, you need to create a new user to login and set the necessary permissions for this account. Luckily, Spacialist comes with a pre-defined account and permissions. Only thing you have to do is run
php artisan db:seed
We also have some demo data to play around with or get familiar with Spacialist. To add the demo data, run this command instead of php artisan db:seed
:
php artisan db:seed --class=DemoSeeder
Now you can login with:
- Email:
admin@admin.com
- Password:
admin
Important: Since this is the same default password for all instances, we strongly recommend to change your password to something more secure. Even better is to create a new admin account with your actual email address and delete this default account.
Laravel supports different filesystems. Some of the most popular adapters:
- AWS S3
- Dropbox
- Rackspace
- SFTP
- WebDAV
To enable one of these adapters you need to add the driver to your composer.json
. For a list of available adapters, see here. To use one of the drivers add it to the config => filesystems => disks
array in bootstrap/app.php
. The local
driver is already configured and set as default. To switch to another default adapter simply add the configuration to the disks
array and set the default
to the key of your added driver.
For further informations regarding the cotent of config => filesystems => disks
see these documentations:
// bootstrap/app.php
<?php
....
config([
"filesystems" => [
'default' => 'ftp',
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'ftp' => [
'driver' => 'ftp',
'host' => 'ftp.example.com',
'username' => 'your-username',
'password' => 'your-password',
// Optional FTP Settings...
// 'port' => 21,
// 'root' => '',
// 'passive' => true,
// 'ssl' => true,
// 'timeout' => 30,
]
],
],
]);
....
?>
Additional geographical data are included through a GeoServer (see installation/linux.html).
- Download the GeoServer software: http://geoserver.org/release/stable/ (for Unix/Linux-based OS use the platform independent binary)
- Install Java Runtime
sudo apt-get install openjdk-8-jre
- Create a new directory for GeoServer
sudo mkdir /usr/share/geoserver
- Unpack the binary into the newly created folder
unzip geoserver-2.9.1-bin.zip -d /usr/share/geoserver
- Set the correct folder permissions
sudo chown -R www-data: /usr/share/geoserver/
andsudo chmod -R g+w /usr/share/geoserver
(Please note: Your current user has to be in your webserver's group (on Ubuntu it is the groupwww-data
), otherwise you'll get errors on startup due to missing permissions. Alternatively you can use your own username in thechown
command to fix this) - Change directory to
/usr/share/geoserver/geoserver-2.9.1/bin
- Run
./startup.sh
Your server should now be ready. To check if it's running visit http://localhost:8080/geoserver Use the following credentials to login:
- User: admin
- Password: geoserver
- Download extension from http://geoserver.org/release/2.9.1/ (Extensions > Miscellaneous > Importer)
- Unzip the extension to the GeoServer's webapps lib folder
unzip ~/Downloads/geoserver-2.9.1-importer-plugin.zip -d /usr/share/geoserver/geoserver-2.9.1/webapps/geoserver/WEB-INF/lib
(Overwrite thecommons-fileupload-1.2.1.jar
file)