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 [email protected]:tikiwiki/tiki.git $HOME/repositories/tikiwiki
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 [email protected]:tikiwiki/tiki.git "${tiki_project}/src"
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
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
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
Tiki should be availabe at http://localhost on your browser