Here we will document everything required to run BoxBilling on Docker. TLDR; Jump to Running Prebuild Installation section to get this docker run on your machine.
- Docker Desktop or Docker CLI with Docker Compose installed. Follow this instructions to have Docker on your machine.
- An account on BoxBilling for acquiring product key and download application. Register one here if you don't have one already.
- Download BoxBilling latest release and while downloading get your license key here
- Make a folder named
boxbilling
and extract downloaded BoxBilling into public folder inside - Copy
bb-config-sample.php
tobb-config.php
- change
bb-config,php
from :
'url' => 'http://localhost/',
to :
'url' => 'http://localhost:8004/',
- Create
.env
file inside public folder and fill with
DB_HOST=db
DB_NAME=boxbilling
DB_USER=root
DB_PASS=myboxbilling
-
Make
docker-config
folder on the project root, and addnginx
,php
, andmysql
folders inside. These folders willl contains regular config files for Nginx, PHP, and mySQL. Some config files will be copied to docker image and other will be read anytime Docker Compose started up. -
Create
docker-compose.yml
, this is the server configuration file that will define containers and network configuration for our docker stack. -
Create
docker-compose-nginx-dockerfile
for Nginx image builder. -
Create
docker-compose-php-dockerfile
for PHP image builder. -
Create
docker-compose-mysql-dockerfile
for mySQL image builder. -
Create
01.sql
file insidedocker-config/mysql/init
that will contain initial seeder for the database. This file will be run when we build ourmysql
container. -
Now run
docker-compose-up
and let docker build images and containers. -
Once containers up and ready go to (http://localhost:8004/install/).
-
On preparation tab, ensure if all prerequisites are labeled with green, check agree and press NEXT.
-
On database tab enter all fields with all of our credetials above.
-
On Administrator tab fill in all fields. For example, our installation values are:
NAME : Administrator
Email : [email protected]
Password : MyBoxbilling
- Installation are done and we should remove
/var/www/public/install
folder, change/var/www/public/bb-config.php
to readonly (CHMOD 644), and setup cron job*/5 * * * * php /var/www/public/bb-cron.php
on our webserver docker entrypoint. - To check on installation go to
http://localhost:8004/bb-admin/staff/login
for administrator login or tohttp://localhost:8004/
to enter client area.
- Clone this repository into
boxbilling
folder - Make necessary server config changes on
docker-config
folder - Make necessary config changes on
public/bb-config.php
andpublic/.env
files - Copy your own boxbilling SQL data to
docker-config/mysql/mysql-seeder.sql
or you can leave it as is - Go back to
boxbilling
folder and rundocker compose up -d
- First run will a bit long because we are building docker images and seed our initial database. But subsequence run will be fast.
- Now browse to (http://localhost:8004) to check our BoxBilling app, or to (http://localhost:8004/bb-admin) to enter BoxBilling admin console
- For testing please login using this credentials:
Email : [email protected]
Password : MyBoxbilling
- To reset mysql docker databases and inject a new one, you can use command
docker-compose down -v
- Building docker images from scratch is not considered as best practice, as using official prebuild Docker images will fasten Docker development time and reduce the probability of server misconfigurations.