-
Notifications
You must be signed in to change notification settings - Fork 0
Installation Setup Nginx
- Linux Operating System for hosting
- Docker for MySQL Database
- Nginx
- PHP 7.2+
- Git
note: This installation guide assumes you'll be installing the SDLT to /opt/SDLT
From your Linux command line, make a folder to house the code and download the SDLT code from GitHub
cd /opt/
git clone https://github.com/NZTA/SDLT
cd SDLT
composer install
When this completes you should receive the message
All modules updated!
This deployment is using a simple HTTP based connection. We're not covering any deployment of HTTPS/TLS/SSL in this tutorial. We do recommend that you do use HTTPS with appropriate protection.
Create the nginx configuration file /etc/nginx/vhosts.d/sdlt.conf
A simple, usable configuration file is: https://forum.silverstripe.org/t/nginx-webserver-configuration/2246
Next, create the assets folder in /opt/SDLT/public
Now, we need to change permissions on the folder where SDLT is stored so that nginx and php can correctly work with it. This is done with chown -R nobody.nobody /opt/SDLT
For the purposes of this installation, we'll be using MySQL8 within a Docker container to give us a quick database. We will start a Docker container with MySQL8, then attach ourselves to it so we can enable remote login with password as this is disabled by default in version 8.
docker run --name sdlt-mysql -e MYSQL_ROOT_PASSWORD=rootpassword -p 3306:3306 -d mysql:8
docker exec -it sdlt-mysql bash
mysql -p
CREATE USER 'sdlt'@'%' IDENTIFIED BY 'sdltpassword';
GRANT ALL PRIVILEGES ON *.* TO 'sdlt'@'%';
ALTER USER 'sdlt'@'%' IDENTIFIED WITH mysql_native_password BY 'sdltpassword';
Note: If you connect to the container soon after starting it. The mysql -p command may fail as the MySQL server has not fully initialized
There is an example .env.example file on /opt/SDLT. Copy this with cp .env.example .env and then edit it.
# Example SDLT SilverStripe 4 settings file
# https://docs.silverstripe.org/en/4/getting_started/environment_management
# What kind of environment is this? One of "dev", "test" or "live"
# live is default because warnings on PHP 7.4 stop test from letting
# you login after a new setup
SS_ENVIRONMENT_TYPE="live"
# Database connection
SS_DATABASE_CLASS="MySQLDatabase"
SS_DATABASE_SERVER=127.0.0.1
SS_DATABASE_PORT=3306
SS_DATABASE_NAME=sdlt
SS_DATABASE_USERNAME=sdlt
SS_DATABASE_PASSWORD=sdltpassword
# The url for use by the CLI SAPI
SS_BASE_URL="https://my-sdlt.dept.govt.nz"
SS_DEFAULT_ADMIN_USERNAME="admin"
SS_DEFAULT_ADMIN_PASSWORD="admin"
# JIRA
JIRA_USERNAME="janedoe@dept.govt.nz"
JIRA_API_KEY="<Generated_By_JIRA>"
JIRA_ATLASSIAN_INSTANCE="https://mydept.atlassian.net"
# NGINX
NGINX_HOST=localhost
# PHP
PHP_VERSION=7.2
# MySQL
MYSQL_ROOT_PASSWORD=rootpassword
MYSQL_VERSION=5.7.30
Next we'll setup the Silverstripe Database layout and import the default records.
From the command line, in /opt/SDLT/ execute the following (note: SetupSDLTDataTask will take a few minutes to complete)
vendor/bin/sake dev/build flush=
vendor/bin/sake dev/tasks/HydrateCustomConfig
vendor/bin/sake dev/tasks/SetupSDLTDataTask
composer vendor-expose
At this point, you can restart nginx and php-fpm to have SS pick up all changes/configurations required to run the SDLT.
The site can be accessed through http://sdlt.int (or the IP/hostname of your machine)