Source code for Nsustain.com
This repository shows you how to run it and how it works. Read the whole documentation if you'd like to get an overall understanding of how Nsustain works. If you just want to spin up a development server as soon as possible, just read the first section âš¡
1. How to spin up a development server
2. How to set up a production server
Important
Install Docker Compose: https://docs.docker.com/compose/install/
# Download the repository.
git clone https://github.com/Nsustain/nsustain.com.git
cd nsustain.com/src/docker
cp .env_flarum.example .env_flarum
cp .env_mariadb.example .env_mariadb
cp configs_nginx/nginx.conf.example configs_nginx/.nginx.conf
# Run.
docker compose build
docker compose up
We know that the server is ready when it prints out:
[INFO] Starting php-fpm...
That's it! 🥳 Open http://127.0.0.1
Important
The default admin ID is nim3594
, and the password is 369FQUv4eS
.
These are baked inside .env.flarum
and .env.mariadb
.
For production, ensure that these default passwords are changed.
How to stop
# Press <Ctrl + c> to exit from your Docker Compose process
# Then, shut down docker compose
docker compose down
How to restart
cd nsustain.com/src/docker
docker compose up -d
Workflows we use
# How to start a shell inside nsustain/flarum container
docker compose exec -it flarum sh
# How to start a shell inside nsustain/mariadb container
docker compose exec -it maraidb sh
# How to check all environment variables injected
env
# How to look inside the database
docker compose exec -it flarum sh
mariadb -h $DB_HOST -u $DB_USER -p$DB_PASS
# How to extract a file from container
docker ps # Suppose <CONTAINER ID> is 1b332ed2d10e
docker cp 1b332:/path/to/file ./
# How to reset all data and restart with fresh volumes
docker compose down
alias dockervrm="docker volume ls -q | xargs docker volume rm"
dockervrm
docker compose up -d
# How to renew letsencrypt certificate
docker compose exec -it flarum sh
certbot renew
Ensure that you set secure passwords.
Override the default env variables at .env_flarum
and .env_mariadb
cd nsustain.com/src/docker
vim .env_flarum
#<Change the default passwords>
vim .env_mariadb
#<Change the default passwords>
Run
docker compose up -d