WinterCMS

Some days ago, I created the WinterCMS Docker image for use with PHP 7.2 – 7.4 on Apache2 or FPM variants; those images/versions are publicly available, is my donation to the OpenSource and WinterCMS communities.

Today I put my hands to write a basic docker-compose.yml to test the Docker Image using Docker Compose, SQLite as a database.

I decided to bind to my SSD local directories with storage, themes, plugins, and database container directories to keep this data safe if the container crashes or is removed.

WinterCMS binding directories

WinterCMS binding directories

I created an .env file to inject environment variables and some values into the docker-compose.yml services file.

###
#
# Winter CMS Test Image
# Version 1.0
# @author: WebMago
#
###


#### ---- * WinterCMS Configuration * ---- ####

# Name
CONTAINER_CMS_NAME=wintercms
# Image
CONTAINER_CMS_IMAGE=webmago/winter:stable-v1.1.3-php7.4-apache

# Env values
APP_DEBUG=false
APP_KEY=base64:PUT-YOUR-KEY-HERE
TZ=America/Mexico_City
APP_LOCALE=en


DB_PATH_SQLITE=storage/database.sqlite
DB_TYPE=sqlite
SESSION_DRIVER=file

CMS_ACTIVE_THEME=jacoweb-freelance

#### ---- * WinterCMS Domains * ---- ####
# A fake domain to test locally
WINTER_DOMAINS=winter.webmago.io

 

On the docker-compose.yml the .env values are injected as you can view on the code below and the directories are bound locally on my SSD.

version: '3'
services:
  web-wintercms:
    image: ${CONTAINER_CMS_IMAGE}
    container_name: ${CONTAINER_CMS_NAME}
    restart: unless-stopped
    ports:
      - "80:80"
    environment:
        VIRTUAL_HOST: ${WINTER_DOMAINS}
        APP_DEBUG: ${APP_DEBUG}
        APP_KEY: ${APP_KEY}
        TZ: ${TZ}
        APP_LOCALE: ${APP_LOCALE}

        DB_PATH_SQLITE: ${DB_PATH_SQLITE}
        DB_TYPE: ${DB_TYPE}
        SESSION_DRIVER: ${SESSION_DRIVER}

        CMS_ACTIVE_THEME: ${CMS_ACTIVE_THEME}
    volumes:
     - ./config/test:/var/www/html/config/docker
     - ./wintercms/storage/database.sqlite:/var/www/html/storage/database.sqlite
     - ./wintercms/storage/logs:/var/www/html/storage/logs
     - ./wintercms/storage/app:/var/www/html/storage/app
     - ./wintercms/storage/cms:/var/www/html/storage/cms
     - ./wintercms/themes:/var/www/html/themes
     - ./wintercms/plugins:/var/www/html/plugins

 

To launch WinterCMS execute:

docker-compose up -d

This runs the process in the background, to stop the execution run:

docker-compose down

 

The first run creates the database.sqlite and assign a random password to the admin user, this is not visible if you run the docker-compose command using the flag -d.

This can be solved using three scenarios.

 

First Scenario

Execute the docker-compose without the flag -d

docker-compose up

 

Second Scenario

If you have been executed the docker-compose with the flag -d and used the YAML of this example, the database is not deleted and the change will keep on the next execution.

# Access the container
docker-compose exec -it wintercms bash

# change the admin password
php artisan winter:passwd

# Enter the username to reset, on this case is admin
 Username to reset:
 > admin

 Enter new password (leave blank for generated password) []:
 > 

Password successfully changed.

# exit the container.
exit

If you require to use redis my advice is to use my images as a base to generate a new image with this PHP extension.

 

Third Scenario

Add the environment variable INIT_WINTER with the false value into the environment section of the YAML file, only if you have not executed the docker-compose command as the first run.

# Access the container
docker-compose exec -it wintercms bash

# Winter up
php artisan winter:up
.
. # this show the DB migration process
.
.
. # finally the process displays the random password assigned, this is an example only
- The following password has been automatically generated for the "admin" account: xZ4DF20k8txIrcBRqEhkjw
 

Accessing the Backend After all the previous process, now you can access the Backend  CMS, on my case I define the host wintercms.webmago.io as a fake URL added to my hosts, on my web browser typed: http://wintercms.webmago.io/backend/ the user is admin and my password the defined or adjusted based on the previous three scenarios described. /etc/hosts file

127.0.0.1 wintercms.webmago.io

 

WinterCMS SQLite, Freelance Theme

WinterCMS SQLite, Freelance Theme

Glitches

The demo theme currently is not available, this can origin errors on the Frontend, you need to install and activate one of the suggested on the Front-end theme section, find or add your old theme with the required adjustments for WinterCMS.

 

On the Plugins section, the oldest OctoberCMS Plugins are available to be installed, this can be an additional article for the WinterCMS series.

WinterCMS Plugins

WinterCMS Plugins

 

If you require my help, please let me know, contact me.

Tags

Comments are closed

Optimized with PageSpeed Ninja