diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..efc9117bf --- /dev/null +++ b/.gitattributes @@ -0,0 +1,7 @@ +* text=auto eol=lf + +*.sh text eol=lf + +Dockerfile text eol=lf +Dockerfile.* text eol=lf +docker-compose*.yml text eol=lf diff --git a/apps/azerothcore/mysql-tools/build-dump-parser.sh b/apps/azerothcore/mysql-tools/build-dump-parser.sh index 8f96ed556..a38a195f8 100755 --- a/apps/azerothcore/mysql-tools/build-dump-parser.sh +++ b/apps/azerothcore/mysql-tools/build-dump-parser.sh @@ -1,5 +1,5 @@ -#!/bin/bash - -gcc -O2 -Wall -pedantic dump-parser.c -o ./bin/dump-parser - -read -p "done" +#!/bin/bash + +gcc -O2 -Wall -pedantic dump-parser.c -o ./bin/dump-parser + +read -p "done" diff --git a/apps/db_exporter/db_import.sh b/apps/db_exporter/db_import.sh index 9670d6652..8a7174cb9 100755 --- a/apps/db_exporter/db_import.sh +++ b/apps/db_exporter/db_import.sh @@ -1,11 +1,11 @@ -#!/usr/bin/env bash - -CURPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -source "$CURPATH/shared.sh" - -for d in "$SQL_PATH/*/"" ; do - echo "Importing $d" - find "$SQL_PATH/$d/" -name '*.sql' | awk '{ print "source",$0 }' | mysql --batch -u "$MYSQL_USER" -p "$MYSQL_PASS" "$d" && echo "done" -done - +#!/usr/bin/env bash + +CURPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +source "$CURPATH/shared.sh" + +for d in "$SQL_PATH/*/"" ; do + echo "Importing $d" + find "$SQL_PATH/$d/" -name '*.sql' | awk '{ print "source",$0 }' | mysql --batch -u "$MYSQL_USER" -p "$MYSQL_PASS" "$d" && echo "done" +done + diff --git a/docker-compose.yml b/docker-compose.yml index a74da6f2e..29ebf6077 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,152 +1,152 @@ -services: - wp-db: - restart: unless-stopped - image: mysql:8 - command: "mysqld --mysql-native-password=ON --binlog_expire_logs_seconds=259200" - volumes: - - mysql-data:/var/lib/mysql - - ./data:/data/ - - ./apps:/apps/ - - ./conf:/conf/ - env_file: - # environment variables are retrieved by this file - # NOTE: you can add more variables to the .env file but - # you cannot override the .env.docker ones (by design) - - .env.docker - environment: - DOCKER_CONTAINER: 1 - MYSQL_ROOT_PASSWORD: ${DOCKER_WORDPRESS_DB_ROOT_PASSWORD:-flkdsjalfh} - MYSQL_DATABASE: ${DOCKER_WORDPRESS_DB_NAME:-wordpress} - MYSQL_USER: ${DOCKER_WORDPRESS_DB_USER:-wordpress} - MYSQL_PASSWORD: ${DOCKER_WORDPRESS_DB_PASSWORD:-wordpress} - networks: - - local-private-net - - ac-network - healthcheck: - test: mysqladmin ping -h 127.0.0.1 -u $$MYSQL_USER --password=$$MYSQL_PASSWORD - interval: 5s - timeout: 10s - retries: 30 - cap_add: - - SYS_NICE # CAP_SYS_NICE - php: - restart: ${DOCKER_PHP_RESTART:-unless-stopped} - build: - context: . - dockerfile: data/docker/Wordpress.Dockerfile - args: - USER_ID: ${DOCKER_USER_ID:-1000} - GROUP_ID: ${DOCKER_GROUP_ID:-1000} - depends_on: - wp-db: - condition: service_healthy - redis: - condition: service_started - volumes: - - type: bind - source: ${DOCKER_CONF_PHP_PATH:-./conf/dist/php-conf/upload.ini} - target: /usr/local/etc/php/conf.d/upload.ini - - ./src/acore-wp-plugin:/var/www/html/wp-content/plugins/acore-wp-plugins - - ${DOCKER_WORDPRESS_SRC_PATH:-wordpress-src}:/var/www/html - - ./apps:/usr/local/bin/apps - - ${DOCKER_CONF_INIT_PATH:-./conf/init}:/conf/init:ro - env_file: - # environment variables are retrieved by this file - # NOTE: you can add more variables to the .env file but - # you cannot override the .env.docker ones (by design) - - .env.docker - environment: - DOCKER_CONTAINER: 1 - ENVIRONMENT: ${DOCKER_ENVIRONMENT:-production} - WORDPRESS_URL: ${DOCKER_WORDPRESS_URL:-http://localhost} - WORDPRESS_TITLE: ${DOCKER_WORDPRESS_TITLE:-ACoreCMS} - WORDPRESS_MULTISITE: ${DOCKER_WORDPRESS_MULTISITE:-true} - WORDPRESS_MULTISITE_USE_SUBDOMAINS: ${DOCKER_WORDPRESS_MULTISITE_USE_SUBDOMAINS:-false} - WORDPRESS_ADMIN_USER: ${DOCKER_WORDPRESS_ADMIN_USER:-admin} - WORDPRESS_ADMIN_PASSWORD: ${DOCKER_WORDPRESS_ADMIN_PASSWORD:-admin} - WORDPRESS_ADMIN_EMAIL: ${DOCKER_WORDPRESS_ADMIN_EMAIL:-admin@example.com} - WORDPRESS_DB_HOST: wp-db:3306 - WORDPRESS_DB_USER: ${DOCKER_WORDPRESS_DB_USER:-wordpress} - WORDPRESS_DB_PASSWORD: ${DOCKER_WORDPRESS_DB_PASSWORD:-wordpress} - PHP_OPCACHE_VALIDATE_TIMESTAMPS: 1 - _OPCACHE_MAX_ACCELERATED_FILES: 100000 - PHP_OPCACHE_MEMORY_CONSUMPTION: 64 - PHP_OPCACHE_MAX_WASTED_PERCENTAGE: 5 - DOCKER_USER_ID: ${DOCKER_USER_ID:-1000} - DOCKER_GROUP_ID: ${DOCKER_GROUP_ID:-1000} - networks: - - local-private-net - - ac-network - # allow the container to access the host machine - # this is useful for development purposes, e.g. to access the database/AC server running on the host - extra_hosts: - - "host.docker.internal:host-gateway" - healthcheck: - test: ["CMD", "/usr/local/bin/apps/init/healthcheck.sh"] - interval: 5s - timeout: 10s - retries: 30 - web.local: - restart: unless-stopped - image: nginx - env_file: - # environment variables are retrieved by this file - # NOTE: you can add more variables to the .env file but - # you cannot override the .env.docker ones (by design) - - .env.docker - environment: - DOCKER_CONTAINER: 1 - depends_on: - php: - condition: service_healthy - volumes: - - ${DOCKER_CONF_NGINX_PATH:-./conf/dist/nginx-conf}:/etc/nginx/conf.d/ - - ${DOCKER_CONF_CERTS_PATH:-./conf/dist/certs/}:/etc/nginx/certs/ - - ${DOCKER_CONF_CERTS_PATH:-./data/plugins/}:/tmp/plugins - - ./var/logs:/var/log/nginx - - ${DOCKER_WORDPRESS_SRC_PATH:-wordpress-src}:/var/www/html:ro - - ./src/acore-wp-plugin:/var/www/html/wp-content/plugins/acore-wp-plugins - extra_hosts: - - "web.local:127.0.0.1" - ports: - - ${DOCKER_HTTP_PORTS:-80:80} - - ${DOCKER_HTTPS_PORTS:-443:443} - expose: - - "80" - - "443" - networks: - - local-private-net - - local-shared-net - - ac-network - redis: - image: redis:alpine - networks: - - local-private-net - expose: - - "6379" - acore-cms-maintenance: - image: nginx - environment: - DOCKER_CONTAINER: 1 - MAINTENANCE_MODE: "true" - volumes: - - ${DOCKER_CONF_CERTS_PATH:-./conf/dist/certs/}:/etc/nginx/certs/ - - ${DOCKER_CONF_NGINX_MAINTENANCE_CONF:-./conf/dist/maintenance/conf}:/etc/nginx/conf.d/ - - ${DOCKER_CONF_NGINX_MAINTENANCE_HTML:-./conf/dist/maintenance/html}:/var/www/html - ports: - - ${DOCKER_HTTP_PORTS:-80:80} - - ${DOCKER_HTTPS_PORTS:-443:443} - profiles: [maintenance] - -networks: - local-shared-net: - name: local-shared-net - driver: bridge - local-private-net: - driver: bridge - ac-network: - name: ${DOCKER_AC_NETWORK_NAME:-azerothcore-wotlk_ac-network} # default network name if you use the docker setup of ac - external: ${DOCKER_AC_NETWORK_EXTERNAL:-false} -volumes: - mysql-data: - wordpress-src: +services: + wp-db: + restart: unless-stopped + image: mysql:8 + command: "mysqld --mysql-native-password=ON --binlog_expire_logs_seconds=259200" + volumes: + - mysql-data:/var/lib/mysql + - ./data:/data/ + - ./apps:/apps/ + - ./conf:/conf/ + env_file: + # environment variables are retrieved by this file + # NOTE: you can add more variables to the .env file but + # you cannot override the .env.docker ones (by design) + - .env.docker + environment: + DOCKER_CONTAINER: 1 + MYSQL_ROOT_PASSWORD: ${DOCKER_WORDPRESS_DB_ROOT_PASSWORD:-flkdsjalfh} + MYSQL_DATABASE: ${DOCKER_WORDPRESS_DB_NAME:-wordpress} + MYSQL_USER: ${DOCKER_WORDPRESS_DB_USER:-wordpress} + MYSQL_PASSWORD: ${DOCKER_WORDPRESS_DB_PASSWORD:-wordpress} + networks: + - local-private-net + - ac-network + healthcheck: + test: mysqladmin ping -h 127.0.0.1 -u $$MYSQL_USER --password=$$MYSQL_PASSWORD + interval: 5s + timeout: 10s + retries: 30 + cap_add: + - SYS_NICE # CAP_SYS_NICE + php: + restart: ${DOCKER_PHP_RESTART:-unless-stopped} + build: + context: . + dockerfile: data/docker/Wordpress.Dockerfile + args: + USER_ID: ${DOCKER_USER_ID:-1000} + GROUP_ID: ${DOCKER_GROUP_ID:-1000} + depends_on: + wp-db: + condition: service_healthy + redis: + condition: service_started + volumes: + - type: bind + source: ${DOCKER_CONF_PHP_PATH:-./conf/dist/php-conf/upload.ini} + target: /usr/local/etc/php/conf.d/upload.ini + - ./src/acore-wp-plugin:/var/www/html/wp-content/plugins/acore-wp-plugins + - ${DOCKER_WORDPRESS_SRC_PATH:-wordpress-src}:/var/www/html + - ./apps:/usr/local/bin/apps + - ${DOCKER_CONF_INIT_PATH:-./conf/init}:/conf/init:ro + env_file: + # environment variables are retrieved by this file + # NOTE: you can add more variables to the .env file but + # you cannot override the .env.docker ones (by design) + - .env.docker + environment: + DOCKER_CONTAINER: 1 + ENVIRONMENT: ${DOCKER_ENVIRONMENT:-production} + WORDPRESS_URL: ${DOCKER_WORDPRESS_URL:-http://localhost} + WORDPRESS_TITLE: ${DOCKER_WORDPRESS_TITLE:-ACoreCMS} + WORDPRESS_MULTISITE: ${DOCKER_WORDPRESS_MULTISITE:-true} + WORDPRESS_MULTISITE_USE_SUBDOMAINS: ${DOCKER_WORDPRESS_MULTISITE_USE_SUBDOMAINS:-false} + WORDPRESS_ADMIN_USER: ${DOCKER_WORDPRESS_ADMIN_USER:-admin} + WORDPRESS_ADMIN_PASSWORD: ${DOCKER_WORDPRESS_ADMIN_PASSWORD:-admin} + WORDPRESS_ADMIN_EMAIL: ${DOCKER_WORDPRESS_ADMIN_EMAIL:-admin@example.com} + WORDPRESS_DB_HOST: wp-db:3306 + WORDPRESS_DB_USER: ${DOCKER_WORDPRESS_DB_USER:-wordpress} + WORDPRESS_DB_PASSWORD: ${DOCKER_WORDPRESS_DB_PASSWORD:-wordpress} + PHP_OPCACHE_VALIDATE_TIMESTAMPS: 1 + _OPCACHE_MAX_ACCELERATED_FILES: 100000 + PHP_OPCACHE_MEMORY_CONSUMPTION: 64 + PHP_OPCACHE_MAX_WASTED_PERCENTAGE: 5 + DOCKER_USER_ID: ${DOCKER_USER_ID:-1000} + DOCKER_GROUP_ID: ${DOCKER_GROUP_ID:-1000} + networks: + - local-private-net + - ac-network + # allow the container to access the host machine + # this is useful for development purposes, e.g. to access the database/AC server running on the host + extra_hosts: + - "host.docker.internal:host-gateway" + healthcheck: + test: ["CMD", "/usr/local/bin/apps/init/healthcheck.sh"] + interval: 5s + timeout: 10s + retries: 30 + web.local: + restart: unless-stopped + image: nginx + env_file: + # environment variables are retrieved by this file + # NOTE: you can add more variables to the .env file but + # you cannot override the .env.docker ones (by design) + - .env.docker + environment: + DOCKER_CONTAINER: 1 + depends_on: + php: + condition: service_healthy + volumes: + - ${DOCKER_CONF_NGINX_PATH:-./conf/dist/nginx-conf}:/etc/nginx/conf.d/ + - ${DOCKER_CONF_CERTS_PATH:-./conf/dist/certs/}:/etc/nginx/certs/ + - ${DOCKER_CONF_CERTS_PATH:-./data/plugins/}:/tmp/plugins + - ./var/logs:/var/log/nginx + - ${DOCKER_WORDPRESS_SRC_PATH:-wordpress-src}:/var/www/html:ro + - ./src/acore-wp-plugin:/var/www/html/wp-content/plugins/acore-wp-plugins + extra_hosts: + - "web.local:127.0.0.1" + ports: + - ${DOCKER_HTTP_PORTS:-80:80} + - ${DOCKER_HTTPS_PORTS:-443:443} + expose: + - "80" + - "443" + networks: + - local-private-net + - local-shared-net + - ac-network + redis: + image: redis:alpine + networks: + - local-private-net + expose: + - "6379" + acore-cms-maintenance: + image: nginx + environment: + DOCKER_CONTAINER: 1 + MAINTENANCE_MODE: "true" + volumes: + - ${DOCKER_CONF_CERTS_PATH:-./conf/dist/certs/}:/etc/nginx/certs/ + - ${DOCKER_CONF_NGINX_MAINTENANCE_CONF:-./conf/dist/maintenance/conf}:/etc/nginx/conf.d/ + - ${DOCKER_CONF_NGINX_MAINTENANCE_HTML:-./conf/dist/maintenance/html}:/var/www/html + ports: + - ${DOCKER_HTTP_PORTS:-80:80} + - ${DOCKER_HTTPS_PORTS:-443:443} + profiles: [maintenance] + +networks: + local-shared-net: + name: local-shared-net + driver: bridge + local-private-net: + driver: bridge + ac-network: + name: ${DOCKER_AC_NETWORK_NAME:-azerothcore-wotlk_ac-network} # default network name if you use the docker setup of ac + external: ${DOCKER_AC_NETWORK_EXTERNAL:-false} +volumes: + mysql-data: + wordpress-src: diff --git a/docs/README.md b/docs/README.md index e3b3fff43..99500f013 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,43 +1,78 @@ # ACore CMS -ACore CMS is a content management system based on WordPress, designed to provide a robust and flexible platform for managing your website content. -**ACore CMS has been built to be integrated with AzerothCore**, allowing features such as account registration, WooCommerce integration (to sell items and services), etc. -It leverages the power of Docker for easy setup and deployment, and includes a variety of plugins to extend its functionality. +### **A**zeroth**Core** **C**ontent **M**anagement **S**ystem based on WordPress which provides a native integration with AzerothCore Emulator while having a robust and flexiable platform to manage your website content. -## Features +# Features -- **Easy Setup**: Quickly get started with Docker and docker-compose. -- **Extensible**: Includes a variety of plugins such as WooCommerce, and you can add or create more. Extend it with any WordPress plugins, themes, and consume the REST/GraphQL APIs available. -- **AzerothCore Integration**: Integrated with AzerothCore to provide account registration, item selling, and more. +### - **Quick and Easy Setup**: With `Docker` and `docker-compose`. + +### - **Multiple Operating Systems Support**: If it can run `Docker`, you can run it. + +### - **Customisable**: Various systems to work with other popular plugins like `WooCommerce`. + +You can add, modify, create within the `acore-cms` plugin, themes and others, while benefiting from `REST/GraphQL` APIs, if available. + +You can read more about what comes with `acore-cms` by checking [documentation](configure-cms.md) in the `docs` folder. Whether you're building a simple website or a complex e-commerce site, ACore CMS provides the tools you need to create and manage your content effectively. +> [!IMPORTANT] +> At this current point `acore-cms` does not provide any `WordPress` themes, only the functionality. + +### - **Natively Supported by and for the AzerothCore Emulator** + +
+ + Click to see the dashboard + ![Dashboard](dashboard.png) -## Requirements +
-- Docker & docker-compose -- Nodejs & npm +# Requirements -If you do not have **docker**, [install it](https://docs.docker.com/compose/install/). +### - [Docker & docker-compose](https://docs.docker.com/compose/install/) -About **Nodejs & npm**, you can install it from [here](https://nodejs.org/en/). +### - [Nodejs & npm](https://nodejs.org/en/) ## Installation & Usage ### 0. Run the init scripts -Run the `init.sh` script to initialize the project and set up the required configuration files. This script will also clone the necessary submodules. +Either using a terminal of choice Linux Terminal, Powershell, Git Bash others. + +Go in the folder of your downloaded or cloned repository e.g `C:\Users\Ryan Turner\Documents\Github\acore-cms` + +```bash +cd "C:\Users\Ryan Turner\Documents\Github\acore-cms" +``` + + Run the `init.sh` (example for Git Bash or Linux Terminal) Type `./init.sh` and it will run it ```bash ./init.sh ``` +> [!IMPORTANT] +> This script will initialize the project and set up the required configuration files. This is also required to clone the necessary [Git Submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) that this project uses. + + ### 1. Configure your .env file Create an `.env` file and copy the `.env.docker` content file to `.env`, configuring the variables as you prefer. +```bash +# Linux / Git Bash +cp .env.docker .env +``` + +```bash +# Windows (CMD) +copy .env.docker .env +``` +Now inside of your + The most important variables are: ```bash DOCKER_WORDPRESS_URL=http://localhost # the url of the website