Darkmatter's Website.
You first need to copy and configure a few PHP files along with the NGINX conf file.
- Copy
site/application/config/config.php.example
tosite/application/config/config.php
and configure it. - Copy
site/application/config/database.php.example
tosite/application/config/database.php
and configure it. - Copy
site/application/config/migration.php.example
tosite/application/config/migration.php
and configure it. - Copy
site/application/config/darkmatter.php.example
tosite/application/config/darkmatter.php
and configure it. - Copy
nginx/development.conf.example
tonginx/default.conf
and configure it.
You will need a valid MySQL/MariaDB database configured in site/application/config/database.php
.
If you encounter "Permission denied." or "Access denied." you may need to run:
chmod 777 -R site/
./docker-build.sh
docker network create darkmatter
# Create a Database server
docker run -d \
-h darkmatter-mariadb \
--name darkmatter-mariadb \
--net darkmatter \
-h darkmatter-mariadb \
-e MARIADB_ROOT_PASSWORD="secure_password_goes_here" \
mariadb:latest
# Run a MariaDB Client to create users and permissions etc.
# use the root password we created earlier to login.
docker run --rm -it --net darkmatter mariadb mariadb -h darkmatter-mariadb -u root -p
-- Create database and the database user account
CREATE DATABASE site;
CREATE USER 'site'@'%' IDENTIFIED BY 'secure_password_from_config_database_php';
GRANT ALL PRIVILEGES ON site.* TO 'site'@'%';
FLUSH PRIVILEGES;
Add the following to your hosts file:
127.0.0.1 darkmatter.local
In order to initialize the database you will need to enable migrating in application/config/migration.php
.
Then you will want to use a Web Browser and navigate to https://darkmatter.local/migrate and ensure you see "Successfully migrated".
If so, the database has been successfully initialized and you can now disable migrations in application/config/migration.php
.
Run the container:
docker run --rm \
-it \
--net darkmatter \
--name darkmatter-site \
-p 80:80/tcp \
-p 443:443/tcp \
-v "$(pwd)/nginx/:/etc/nginx/conf.d/:ro" \
-v "$(pwd)/site/:/mnt:ro" \
darkmatter-site
Navigate to https://darkmatter.local/
Similar steps to the development setup. Instead;
- Copy
nginx/production.conf.example
tonginx/default.conf
and configure it.
# You might also wanna run `docker update darkmatter-mariadb --restart always`.
# Deploy container, change ports if needed.
docker run -d \
-h darkmatter-site \
--restart always \
--net darkmatter \
--name darkmatter-site \
-p 80:80/tcp \
-p 443:443/tcp \
-v "$(pwd)/nginx/:/etc/nginx/conf.d/:ro" \
-v "$(pwd)/site/:/mnt" \
darkmatter-site