Skip to content

Latest commit

 

History

History
76 lines (50 loc) · 1.62 KB

INSTALL.md

File metadata and controls

76 lines (50 loc) · 1.62 KB

Installing OpenStreetMap Welcome Tool

Requirements

  • Install dependencies:

    composer install
  • Create database (if needed):

    php bin/console doctrine:database:create
  • Initialize schema:

    php bin/console doctrine:schema:create
  • Create OSMCHA_API_KEY in your environment with your OSMCha API key

Run locally

Symfony Local Web Server

  • Install Symfony CLI
  • Run symfony server:start
  • Browse the given URL

Check Symfony local server documentation for more information.

Docker

docker build . --tag osm-welcome-tool
docker run --detach --publish 80:80 --env-file .env.local osm-welcome-tool

Deploy

Check Symfony deployment documentation.

Using Deployer

vendor/bin/dep deploy --branch=2.x welcome.osm.be
npm run build
rsync -e ssh -avz public/build/ root@welcome.osm.be:/var/www/osm-welcome-tool/current/public/build/

Automated update

Cron Job (SQLite)

Create an osm-welcome-tool file in /etc/cron.daily folder (for a daily update):

#!/bin/sh

BACKUP_DIRECTORY=/root/osm-welcome-tool
BACKUP_FILENAME=data.db

mkdir -p $BACKUP_DIRECTORY

# Remove all backups older than 30 days
find $BACKUP_DIRECTORY/$BACKUP_FILENAME.* -mtime +30 -delete
# Backup database
cp "/var/www/osm-welcome-tool/current/var/data.db" "$BACKUP_DIRECTORY/$BACKUP_FILENAME.$(date +"%Y%m%d")"

# Trigger update
cd "/var/www/osm-welcome-tool/current/"
php bin/console welcome:update