Skip to main content
Version: Next

Docker installation

info

For docker installation, you need to have Docker and Docker Compose installed on your machine. You can find the installation instructions for your operating system on the Docker website.

Docker installation is the recommended way to install BiznisBox. It is easy to set up and allows you to run BiznisBox in a containerized environment. This means that you can run BiznisBox on any machine that has Docker installed, without worrying about the underlying operating system or dependencies.

BiznisBox docker image is available on the GitHub Container Registry (ghcr.io) and Docker Hub. You can pull the image from either registry using the same command.

Installation is done in a few simple steps:

docker pull ghcr.io/biznisbox/biznisbox:latest

This command will pull the latest version of BiznisBox from the Docker registry. You can also specify a specific version by replacing latest with the version number.

docker run -d -p 80:80 ghcr.io/biznisbox/biznisbox:latest

This command will run BiznisBox in a detached mode and map port 80 of the container to port 80 of your host machine. You can also specify a different port by replacing 80 with the desired port number.

You can also attach a volume to the container to persist data. This is useful if you want to keep your data even if you stop or remove the container. You can do this by adding the -v option to the docker run command:

docker run -d -p 80:80 -v /path/to/data:/var/www/html/storage ghcr.io/biznisbox/biznisbox:latest

Available volumes are:

  • /var/www/html/storage - this is the default storage location for BiznisBox. You can use this volume to persist your data.

Environment variables can be set using the -e option. For example, if you want to set the APP_KEY environment variable, you can do this:

docker run -d -p 80:80 -e APP_KEY=your_app_key ghcr.io/biznisbox/biznisbox:latest

Environment variables

BiznisBox uses environment variables to configure the application. You can set these variables when you run the container using the -e option or by creating a .env file in the root directory of your BiznisBox installation.

  • APP_KEY - this is the application key used for encryption. You can generate a new key by running the following command in the container:
php artisan key:generate --show
  • JWT_SECRET - this is the secret key used for JWT authentication. You can generate a new key by running the following command in the container:
php artisan jwt:secret
  • APP_ENV - this is the application environment. The default value is production.
  • APP_DEBUG - this is the application debug mode. The default value is false. You can change this to true if you want to enable debug mode. In debug mode, detailed error messages are displayed, which can be useful for development and debugging purposes.
    warning

    Do not enable debug mode in production, as it can expose sensitive information about your application.

  • APP_URL - this is the application URL. The default value is http://localhost. If you are running BiznisBox on a different domain or IP address, you can change this to the URL of your BiznisBox instance. (if you are using a reverse proxy, you can set this to the URL of your reverse proxy)
info

If you are using a reverse proxy, make sure to set the APP_URL to the URL of your reverse proxy. This is important for generating correct URLs in emails and other places. And serve static files correctly.

  • APP_NAME - this is the name of the application. The default value is BiznisBox. You can change this to the name of your application (corporate identity).

  • APP_TIMEZONE - this is the application timezone. The default value is UTC. You can change this to your desired timezone, e.g., Europe/Zagreb.

Database configuration

BiznisBox requires a database to store its data. You can use MySQL or PostgreSQL as the database. The database connection settings can be configured using environment variables.

  • DB_CONNECTION - this is the database connection type. The default value is mysql. You can change this to pgsql if you want to use PostgreSQL.
  • DB_HOST - this is the database host. The default value is db. You can change this to the IP address or hostname of your database server.
  • DB_PORT - this is the database port. The default value is 3306 for MySQL and 5432 for PostgreSQL.
  • DB_DATABASE - this is the name of the database. The default value is biznisbox. You can change this to the name of your database.
  • DB_USERNAME - this is the database username. The default value is root. You can change this to the username of your database user.
  • DB_PASSWORD - this is the database password. The default value is root. You can change this to the password of your database user.

Mail configuration

BiznisBox can send emails using the SMTP protocol. You can configure the email settings using environment variables.

  • MAIL_MAILER - this is the mail driver. The default value is log. You can change this to smtp if you want to use SMTP.
  • MAIL_HOST - this is the SMTP host. The default value is mailhog. You can change this to the IP address or hostname of your SMTP server.
  • MAIL_PORT - this is the SMTP port. The default value is 1025. You can change this to the port of your SMTP server.
  • MAIL_USERNAME - this is the SMTP username. The default value is empty. You can change this to the username of your SMTP user.
  • MAIL_PASSWORD - this is the SMTP password. The default value is empty. You can change this to the password of your SMTP user.
  • MAIL_ENCRYPTION - this is the encryption type. The default value is null. You can change this to tls or ssl if your SMTP server requires encryption.
  • MAIL_FROM_ADDRESS - this is the email address that will be used as the sender. The default value is [email protected]. You can change this to the email address you want to use as the sender.
  • MAIL_FROM_NAME - this is the name that will be used as the sender. The default value is BiznisBox. You can change this to the name you want to use as the sender.

Other environment variables

  • APP_MODE - this is the application mode. The default value is production. You can change this to development or demo if you want to run BiznisBox in development or demo mode. In demo mode, some features are disabled, and the data is reset every six hours.

Running commands in the container

You can run commands in the BiznisBox container using the docker exec command. When you like to run a commands in docker check if the user is www-data (not user root) and use the -u option to run the command as the www-data user. For example, to run the php artisan migrate command, you can do this:

docker exec -u www-data -it <container_name> php artisan migrate

Replace <container_name> with the name of your BiznisBox container. You can find the name of your container by running the docker ps command. You can also run other commands in the container, such as php artisan db:seed, php artisan cache:clear, etc. Just make sure to use the -u www-data option to run the command as the www-data user.

Persisting data

To persist data in BiznisBox, you can use Docker volumes. This allows you to keep your data even if you stop or remove the container. You can attach a volume to the container using the -v option when you run the container.

docker run -d -p 80:80 -v /path/to/data:/var/www/html/storage ghcr.io/biznisbox/biznisbox:latest

BiznisBox stores its data in the /var/www/html/storage directory inside the container. By attaching a volume to this directory, you can persist your data even if you stop or remove the container.

Accessing the BiznisBox application

After you have pulled the BiznisBox image and run the container, you can access the application by opening your web browser and navigating to http://localhost (or the URL you set in the APP_URL environment variable).

You should see the BiznisBox installation page, where you can complete the setup process. (If you are using a different port, make sure to replace 80 with the port you specified in the docker run command.)

Steps for the first run are the same as in the manual installation. You can find them in the manual installation guide.