Coder Social home page Coder Social logo

jarvvski / xenforo-development Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 1.0 26 KB

A repo to use as a template when creating Xenforo addons or just testing an instance locally.

License: GNU General Public License v3.0

Shell 65.11% PHP 21.55% Dockerfile 13.34%

xenforo-development's Introduction

Xenforo Local Development

A template for developing addons for xenforo locally using docker containers to replicate a server experience using PHP-FPM, Nginx & MariaDB. All ports are exposed for easy access when querying the DB locally, or using xdebug in your IDE.

Requirements

  • docker-ce installed with respective command line
  • docker-compose cli installed
  • a copy of xenforo downloaded from the accounts panel

Development env setup

You will only need to run these steps on the first run. So long as you don't destroy the docker Volumes, you can just run Step 3 again to restart the env

  1. Download a copy of xenforo 2 from your account panel, place into this directory and rename as xenforo.zip

  2. Run ./install-from-zip.sh to unpack the xenforo source

  3. Run docker-compose up -d to start the containers

  4. Run docker exec xenforo php cmd.php xf:install --user=admin --password=admin --clear to run the database migrations

  5. Rename src/addons/Acme/My-Addon/ to the relevant org name and addon name in both the file structure, config.php and the .gitignore file

  6. Run docker exec -it xenforo php cmd.php xf-addon:create to create your addon

Note: you can run step 2 again if you need to restore any default xenforo files to default

PHPStorm Xdebug setup

Because FPM is running on it's default port of 9000 and exposed on your host, you will need to change a few defaults with PHPstorm to get things working. I recommend the this youtube video as a guide.

Note: the IDE key is set via .docker/xdebug.ini file. By default, it is set to docker.

Xenforo reporting file inconsistencies

If you accidentally changed one of the core XF files during development, and you want to wipe and reinstall Xenforo source, just run ./install-from-zip.sh and choose to wipe and unpack the source once again.

Running xenforo CLI

If you want to use the xenforo CLI to it's full extent, you can execute it via the docker CLI to run within the PHP container

docker exec -it xenforo php cmd.php

It's important to keep the -it after docker exec, so that we attach to the output of the command in case there are any input prompts

Editing Xenforo Config

The config file for this setup exists in the root directory, not the usual src/config.php. Feel free to make whatever edits you like to the config file.

Note: You may see that there is also a src/config.php that exists. This is an artifact of how docker binds our local config inside the xenforo source code volume. It's fine that it's empty, just leave that file as is.

Handy docker commands

To quickly kill the collection of containers

docker-compose kill

To remove/delete them

docker-compose rm

Kill/Remove from anywhere on the host

docker <kill/rm> $(docker ps -f name="xenforo*" -q)

Remove all associated volumes

docker volume rm $(docker volume ls -f name="xenforo*" -q)

xenforo-development's People

Contributors

jarvvski avatar

Stargazers

Christian Lopez avatar Mücahid Deniz avatar Navjot Singh avatar Bot Molu avatar Julian Muñoz avatar  avatar  avatar René Roth avatar  avatar David Mayr avatar Alex Winton avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

juliand

xenforo-development's Issues

Xenforo in Docker for Production?

For those who don't want XenForo running on the bare metal system, I see there are no official docker images or dockerfiles for XenForo - which is unfortunate. Have you run this XenForo in Docker in a public-facing production environment? The issue with asking on XenForo is you have to buy XenForo in order to ask questions on their forum.
Thanks!

P.S. In order to integrate XenForo with other services it must talk to, then it makes sense to have it dockerized if those other services are too.

PHP fatal error - curly braces

After following the directions in the readme, the nginx container and xenforo-development container contains these logs:

Fatal error:  Array and string offset access syntax with curly braces is no longer supported in /var/www/html/src/vendor/dokuwiki/utf8/utf8.php on line 66
NOTICE: PHP message: PHP Stack trace:
NOTICE: PHP message: PHP   1. {main}() /var/www/html/index.php:0
NOTICE: PHP message: PHP   2. XF::start($rootDirectory = '/var/www/html') /var/www/html/index.php:12
NOTICE: PHP message: PHP   3. XF::startSystem() /var/www/html/src/XF.php:72

This error also occurs when running step 4 docker exec xenforo php cmd.php xf:install --user=admin --password=admin --clear

This happens when using Xenforo v2.1.2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.