Skip to content

Instantly share code, notes, and snippets.

@fabiomontefuscolo
Created July 21, 2019 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabiomontefuscolo/6413587debccc9058d7850b96c5f91e5 to your computer and use it in GitHub Desktop.
Save fabiomontefuscolo/6413587debccc9058d7850b96c5f91e5 to your computer and use it in GitHub Desktop.
Create a development environment for Tiki using Docker

Docker dev environment for Tiki

Getting the tiki repository

The first thing needed for any development environment is the source code of application to work on.

Tiki has a huge history and this means a huge git repository. So, instead to clone a full Tiki repository for each instance of Tiki website, it is possible to create a central repository and create clones from this local repository.

mkdir $HOME/repositories
git clone --bare git@gitlab.com:tikiwiki/tiki.git  $HOME/repositories/tikiwiki

Creating the working directories

As each version of Tiki has different composer dependencies, the easy way to work on different versions is having different versions for each Tiki version.

For this proposal, all development projects will be inside the $HOME/devel directory, but it can be changed according to developer needs or habits. Also, the Tiki version will be 20.x, but it can be changed to other version.

# our assumptions
tiki_ver="20"
tiki_project="$HOME/devel/tiki${tiki_ver}"
tiki_repo="$HOME/repositories/tikiwiki"
mkdir -p "$tiki_project"

Now it is time to get the source code from the local Tiki repository. To save disk space and speedup the cloning process, each Tiki clone will borrow the git files from the main repository.

git clone --branch=${tiki_ver}.x --reference=$tiki_repo git@gitlab.com:tikiwiki/tiki.git "${tiki_project}/src"

Create the docker-compose.yml file

The docker-compose.yml contains the configuration for you containers and how they can communicate to each other.

cat > ${tiki_project}/docker-compose.yml << EOF
version: '2'
services:
  tiki:
    image: tikiwiki/tikiwiki:${tiki_ver}.x
    depends_on:
      - db
    ports:
      - 80:80
    environment:
      - TIKI_DB_USER=tiki
      - TIKI_DB_PASS=wiki
      - TIKI_DB_NAME=tikiwiki
    volumes:
      - ./src:/var/www/html
  db:
    image: mariadb
    environment:
      - MYSQL_USER=tiki
      - MYSQL_PASSWORD=wiki
      - MYSQL_DATABASE=tikiwiki
      - MYSQL_ROOT_PASSWORD=tkwkiiii
      - TERM=dumb
    volumes:
      - ./mysql:/var/lib/mysql
EOF

Run the docker-compose.yml files

The docker-compose tool will run the containers specified on docker-compose.yml file. It will create the necessary volumes mapping.

cd "${tiki_project}"
docker-compose up -d

Setting Tiki up

If you mounted the Tiki source code over the default container Tiki, you may need to install Tiki composer dependencies.

cd "${tiki_project}"
docker-compose exec -u $UID tiki composer install -d /var/www/html/vendor_bundled --prefer-dist

Tiki needs some folders to have write permission

docker-compose exec tiki chown www-data db dump templates

Install the database using the command line

docker-compose exec tiki php console.php d:i

Accessing through the browser

Tiki should be availabe at http://localhost on your browser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment