We assume that you have app
and config
repository cloned in the same directory and that you have an empty cache
directory at the same level (it will be used to store localisation cache).
# 1. build a base image
docker build -f base/Dockerfile -t artifactory.wikia-inc.com/sus/php-wikia-base:0b02db1c1f7 ./base
docker push artifactory.wikia-inc.com/sus/php-wikia-base:0b02db1c1f7
# 2. and then dev image
docker build -f dev/Dockerfile -t php-wikia-dev ./dev
docker build -f dev/Dockerfile-nginx -t nginx-wikia-dev ./dev
# 3. you can now run eval.php (execute this from root directory of app repo clone)
docker run -it --rm -h localhost -e 'SERVER_ID=165' -e 'WIKIA_ENVIRONMENT=dev' -e 'WIKIA_DATACENTER=poz' -v "$PWD":/usr/wikia/slot1/current/src -v "$PWD/../config":/usr/wikia/slot1/current/config -v "$PWD/../cache":/usr/wikia/slot1/current/cache/messages artifactory.wikia-inc.com/sus/php-wikia-dev php maintenance/eval.php
# 4. in order to run service locally use docker-compose
docker-compose -f ./dev/docker-compose.yml up
# 5. then you can use `docker exec` to take a look inside the container
docker exec -it dev_php-wikia_1 bash
In order to run service locally you need to configure hosts. Add below line to /etc/hosts
127.0.0.1 wikia-local.com dev.wikia-local.com muppet.dev.wikia-local.com
This section describe how to deploy mediawiki to various environments, how they work and how to introduce changes to it.
There are 2 main parts of all deployments:
- Jenkins job that is defined in jenkins-jobs repository that accepts needed parameters to deploy to a given environment
- a jenkins file that is in this repo that is being executed by Jenkins as a pipeline job
- Open mediawiki-deploy-sandbox
- Press run button, fill in the form and submit the form
- Profit!
This job is ran by daily-release-cut but if you need to deploy manually:
- Open mediawiki-deploy-preview
- Press run button, fill in the form
- new release - will create new release branch, new release tag and push that to preview
- hotfix - will checkout a release branch that is currently on preview and if there are any changes on this branch against the tag that is deployed - it will create new tag and push that to preview
- latest - fetch a latest tag that is on github and push that to preview
- Submit the form
- This job will wait for your input on stage 'Fetch version' - if you won't press Proceed it will be aborted
Please keep in mind that preview deployment will automatically start all functional tests.
- Open mediawiki-deploy-prod
- Press run button, fill in the form
- preview - fetch a version from preview environment and push the same to prod
- hotfix - will checkout a release branch that is currently on prod and if there are any changes on this branch against the tag that is deployed - it will create new tag and push that to prod
All 3 jobs are defined in jenkins-jobs repo in this file mediawiki-deployment-pipeline
The jenkins files are taken from dev branch, so if you want to introduce changes to the deployment pipeline make sure they are merged to dev branch.
- Create a branch in app repository and change a Jenkinsfile
- Create a branch in jenkins-jobs and change
- name of the job - so you can push it to jenkins for testing purposes
- branch from where the Jenkinsfile is fetched to the branch when your changes are
- Push the job to jenkins for tesing purposes
- If all is functioning properly - merge branch in app repository
- In jenkins-jobs repo - change back the name of a job, branch to dev and merge it
No, docker images have app and config commit hashes in an image name. So if you push the same app and config combo - docker image won't be rebuilt.
To run unit tests set up the app/tests/build
directory to be owned by nobody:nogroup
.
To rebuild localisation cache you need to have cache
directory created at the same level as app
and config
git clones.
cache
directory should have 777
rights set up and have an empty file touched there.
If localisation cache is missing, regenerate it by running SERVER_ID=177 php maintenance/rebuildLocalisationCache.php
within the container
If you have problems with DNS host names resolution in your Docker container, you need to disable dnsmasq
on your machine.
If docker service fails to start run the following to diagnose the problem:
sudo dockerd
Follow these instructions.