Skip to content

rycbar-software/website

Repository files navigation

Webserver on docker containers for Laravel 10.0

License: MIT Stand With Ukraine

Based on docker-webserver.

Webserver included:

  • Nginx
  • PHP
  • Redis
  • MySQL
  • composer
  • cloud backups
  • Mailhog (for development environment)
  • NodeJS (for development environment)

Before starting

  1. Prepare server;
  2. Install docker;
  3. Install docker-compose;

Installation:

1. Clone repository

git clone git@github.com:rycbar-software/website.git .

2. Create copy of .env file and copy of laravel .env file:

cp .env.example .env && cp www/.env.example www/.env

3. Modify .env, set up variables

  • COMPOSE_SEPARATOR - separator for compose files in .env file. ":" for linux/MacOS, ";" for Windows;
  • COMPOSE_FILE - which docker-compose files will be included;
  • SYSTEM_GROUP_ID - ID of host user group. Usually 1000;
  • SYSTEM_USER_ID - ID of host user. Usually 1000;
  • APP_NAME - url by which the site is accessible. For example, example.com or example.local for local development;
  • ADMINISTRATOR_EMAIL - email to which we send information about certificates;
  • DB_HOST - database host. By default db, but in the case when the database is on another server - specify the server address;
  • DB_DATABASE - database name;
  • DB_USER - the name of the user who works with the database;
  • DB_USER_PASSWORD - database user password;
  • DB_ROOT_PASSWORD - password of the root database user;
  • AWS_S3_URL - url of cloud backup storage;
  • AWS_S3_BUCKET - name of the bucket in the backup storage;
  • AWS_S3_ACCESS_KEY_ID - storage key;
  • AWS_S3_SECRET_ACCESS_KEY - storage password;
  • AWS_S3_LOCAL_MOUNT_POINT - path to the local folder where we mount the cloud storage.

4. Compose files description

  • dc-app.yml - core webserver services. Include nginx, php, redis;
  • dc-db.yml - database service. Use if you database is on same server;
  • dc-dev.yml - dev environment services. NPM, NodeJs, MailHog;
  • dc-cloud.yml - cloud backups storage.

5. Set up laravel variables

6. Build application

docker-compose build
docker-compose up -d
docker-compose run --rm composer install --no-dev -o
docker-compose run --rm artisan key:generate
docker-compose run --rm artisan storage:link
docker-compose run --rm artisan migrate
docker-compose run --rm artisan admin:create

7. [Optional] For ssl certificates up nginx-proxy

./nginx-proxy-up.sh

8. Init crontab

./cgi-bin/prepare-crontab.sh

9. Using artisan, composer and npm

Webserver present standalone containers for composer, artisan and npm commands. To run commands - use next examples:

docker-compose run --rm composer [you composer command]
docker-compose run --rm composer require spatie/laravel-permission
docker-compose run --rm artisan [you artisan command]
docker-compose run --rm artisan migrate
docker-compose run --rm npm [you npm command]
docker-compose run --rm npm build

About

RYCBAR software main website source code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published