Docker

Run the development containers of Clientverse with Docker and Docker Compose utility. Docker allows you to compose your application from microservices, without worrying about inconsistencies between development and production environments and without locking into any platform or language.

Prerequisites

  • Docker (v20.10 or newer recommended)
  • Docker Compose (v2.0 or newer)
  • At least 1 GB of free disk space for images and volumes

Getting Started

Clone the repository and start the environment:

# Clone the Clientverse repository
git clone https://github.com/alextselegidis/clientverse.git
cd clientverse

# Start the containers in detached mode
docker-compose up -d

This will start the following services:

  • php-fpm — PHP application server
  • nginx — Web server (accessible at http://localhost)
  • mysql — Database server (accessible at localhost:3306)

Environment Configuration

You will need to modify the server's .env so that it matches the following example:

# This value is the name of your application. This value is used when the
# framework needs to place the application's name in a notification or
# any other location as required by the application or its packages.
APP_NAME=Clientverse

# This value determines the "environment" your application is currently
# running in. This may determine how you prefer to configure various
# services the application utilizes. Set this in your ".env" file.
APP_ENV=local

# This key is used by the Illuminate encrypter service and should be set
# to a random, 32 character string, otherwise these encrypted strings
# will not be safe. Please do this before deploying an application and
# make sure you do not lose this key!
APP_KEY=E6972E6A6DC41B193CD90ED830085859

# When your application is in debug mode, detailed error messages with
# stack traces will be shown on every error that occurs within your
# application. If disabled, a simple generic error page is shown.
APP_DEBUG=true

# This URL is used by the console to properly generate URLs when using
# the Artisan command line tool. You should set this to the root of
# your application so that it is used when running Artisan tasks.
APP_URL=http://localhost

# This URL is used by the auto update mechanism to resolve available updates
# whenever available. Change this only if you have your own Clientverse repository
# configured.
APP_REPOSITORY=https://github.com/alextselegidis/clientverse

# Here you may specify which of the database connections below you wish
# to use as your default connection for all database work. Of course
# you may use many connections at once using the Database library.
DB_CONNECTION=mysql

# The database connection host, this defaults to "localhost" for most servers.
DB_HOST=mysql

# The database connection port, this defaults to "3306" for most servers.
DB_PORT=3306

# The database name to connect to, make sure the database is created.
DB_DATABASE=clientverse

# The database username for the connection.
DB_USERNAME=user

# The database password for the connection.
DB_PASSWORD=password

Database Setup

Enter the server container and seed the database:

# Enter the PHP container
docker exec -it clientverse-php-fpm-1 bash

# Run database migrations and seed the initial data
php artisan migrate:fresh --seed

This creates the necessary database tables and an initial admin account you can use to log in.

Accessing the Application

In the host machine the server is accessible from http://localhost and the database from localhost:3306.

Viewing Logs

To view logs from the running containers:

# View all container logs
docker-compose logs

# Follow logs in real time
docker-compose logs -f

# View logs for a specific service
docker-compose logs php-fpm

Persistent Data

Docker Compose is configured to use volumes for persistent data. Your database data survives container restarts. To back up your data:

# Back up the database from inside the container
docker exec clientverse-mysql-1 mysqldump -u user -ppassword clientverse > backup.sql

Stopping the Containers

You can stop or remove the docker containers:

# Stop containers (preserves data)
docker-compose stop

# Remove containers and volumes (deletes all data)
docker compose down --volumes

Development Mode

You can then execute npm start from within the client directory and the php-fpm container to run the dev server in development mode.

Need Help?

If you run into issues with Docker: