Nginx image with geoip2 module and City, Country maps
707
Scoreboard docker setup
git clone [email protected]:digital-agenda-data/scoreboard.docker.git
If it's already saved, make sure it's on the latest version
cd scoreboard.docker
git pull
If you are restoring the database from another environment, please copy here the same passwords that are saved in the database:
You need to set the NGINX port to an available value in the docker-compose file. It is located in the nginx->ports section and has the format:
- <HOST_PORT>:<CONTAINER_PORT>
For example, if port 81 is not available, but 82 is, we modify this:
nginx:
image: nginx:1.13
depends_on:
- haproxy
- piwik
- solr
restart: always
ports:
- 81:80
into:
nginx:
image: nginx:1.13
depends_on:
- haproxy
- piwik
- solr
restart: always
ports:
- 82:80
links:
- nginx:${SCOREBOARDBASE_URL}
If you want to deploy another version on plone site ( DEV or TEST) you need to set the correct image name in the plone section of the docker-compose.yml:
So:
plone:
image: digitalagendadata/plone:latest
restart: always
depends_on:
- zeoserver
- memcached
environment:
ZEO_ADDRESS: "zeoserver:8080"
MEMCACHE_SERVER: "memcached:11211"
SOLR_URL: "http://solr:8983/solr/scoreboard"
will become
plone:
image: digitalagendadata/plone.staging
restart: always
depends_on:
- zeoserver
- memcached
environment:
ZEO_ADDRESS: "zeoserver:8080"
MEMCACHE_SERVER: "memcached:11211"
SOLR_URL: "http://solr:8983/solr/scoreboard"
The exportcl.sh script that updates the RDF repositoryโ runs daily on production. It needs to use a SSH private key that has write access to the GIT repo.
exportcl.sh hostIf you are using the same user/host, you need just to:
cd <SCOREBOARD.DOCKER_HOME>
cp ~/.ssh/* cron/ssh/
Run in <SCOREBOARD.DOCKER_HOME>:
Create a new key
ssh-keygen -t rsa -b 4096 -C "[email protected]" -N '' -f cron/ssh/id_rsa
Open the public key file an copy its contents:
cat cron/ssh/id_rsa.pub
Copy the file contents in: https://github.com/digital-agenda-data/rdf/settings/keys/newโ
Keep the existing cron/ssh/known_hosts file because it contains the github servers
docker-compose up -d --scale plone=2
docker-compose up -d
Identify zeo docker name - <ZEO_DOCKER_NAME>:
docker-compose ps | grep zeo
Copy blobstorage and filestorage directories from the source plone site and put it into the current directory
Copy blobstorage and filestorage directories to the zeoserver data volume:
docker cp blobstorage <ZEO_DOCKER_NAME>:/data/ docker cp filestorage <ZEO_DOCKER_NAME>:/data/
Run chown on the /data directory from the server to make sure all the files have the correct permissions docker-compose exec zeoserver sh -c "chown -R 500:500 /data"
Restart zeoserver
docker-compose restart zeoserver
Check zeoserver logs for errors
docker-compose logs -f zeoserver
Restart plone
docker-compose restart plone
Check plone logs for errors
docker-compose logs -f plone
Stop virtuoso server
docker-compose stop virtuoso
Identify virtuoso docker name - <VIRTUOSO_DOCKER_NAME> ( check first column on the following command) :
docker-compose ps | grep virtuoso
Copy database backup from source database and name it virtuoso.db
Identify volume location on the host - <VIRTUOSO_VOLUME_PATH>
docker inspect <VIRTUOSO_DOCKER_NAME> | grep volume
or
docker ps --filter expose=8890 --format "{{.Names}}" | xargs docker inspect | grep virtuoso_db
<VIRTUOSO_VOLUME_PATH> should be similar to /var/lib/docker/volumes/_virtuoso_db/_data
Clean-up the volume:
sudo rm -rf <VIRTUOSO_VOLUME_PATH>/*
Copy the database:
sudo cp virtuoso.db <VIRTUOSO_VOLUME_PATH>/
Start server
docker-compose start virtuoso
Check virtuoso logs for errors
docker-compose logs -f virtuoso
Run a backup on the source database. If you are not sure of the database password you can check it in the piwik directory: $ cd <PIWIK_LOCATION> $ grep password config/config.ini.php
Run the piwik database backup, providing the password: $ mysqldump -u piwik -p piwik > /tmp/piwik.dump
Copy the database dump to the destination host using scpโ
Identify the docker name of the mariadb container <MARIADB_DOCKER_NAME> ( run from the docker-compose.yml file location ) docker-compose ps | grep virtuoso
copy the database dump to the mariadb container
docker cp piwik.dump <MARIADB_DOCKER_NAME>:/tmp/piwik.dump
Import the database, providing the password set in the .env file: $ docker-compose exec mariadb bash $ mysql -u piwik -p piwik < /tmp/piwik.dump Enter password: $ exit
Restart the container and watch the logs for errors $ docker-compose restart mariadb $ docker-compose logs -f mariadb
Some tables in your database have the same names as the tables Matomo is trying to create
Press Reuse the existing tables ยปManually modify docker-compose.yml with the new image version.
For example:
plone:
image: digitalagendadata/plone:1.0
to
plone:
image: digitalagendadata/plone:2.0
If you are updating the PRODUCTION image version, you need to save the changes in GITโ
Change environment variable value in the .env file.
Update the available configuration files. Any update on PRODUCTION and TEST environments for cron/, solr/, nginx/* should be saved in GITโ .
If you only changed the configuration file, it's enough to run restart on the containers:
For cron/ changes:
docker-compose restart cron
For nginx/ changes:
docker-compose restart nginx
For solr/ changes:
docker-compose restart solr
First you should take note how many plone instances you have running:
docker-compose ps | grep -c plone
Use the number of running instances to run the upgrade:
docker-compose up -d --scale plone=<NUMBER_OF_PLONE_INSTANCES>
The docker hub automated build can be found on https://hub.docker.com/r/digitalagendadata/scoreboard.cron/โ
The steps to create a new release, follow this steps on your Dev environment:
Update files located in crontab directoryโ - docker image files and cron directoryโ - scripts and crontab files )
Push the changes on master
git add -A
git commit
git push
On every push to the master branch, a new digitalagendadata/scoreboard.cron:latest image is created. You can view the build status on: https://hub.docker.com/r/digitalagendadata/scoreboard.cron/builds/โ
Once the digitalagendadata/scoreboard.cron:latest image is succesfully built, you can test ( if needed ), and then create a new release.
View most recent tag on git:
git describe --tags
Choose a new tag, bigger than the latest one, using a MAJOR.MINOR format. Save it in a variable:
export NEW_TAG="<NEW_TAG>"
Create and push tag on repo:
git tag -a "$NEW_TAG" -m "$NEW_TAG"
git push origin $NEW_TAG
Follow the release on docker hub https://hub.docker.com/r/digitalagendadata/scoreboard.cron/builds/โ . The new image will have the following format:
digitalagendadata/scoreboard.cron:$NEW_TAG
Update docker-compose.yml with the new image:
sed -i 's/image: digitalagendadata\/scoreboard.cron.*/image: digitalagendadata\/scoreboard.cron:$NEW_TAG/' docker-compose.yml
Push the change on the GIT repo:
git add docker-compose.yml
git commit -m "Updated cron image to $NEW_TAG"
git push
The docker hub automated build can be found on https://hub.docker.com/r/digitalagendadata/scoreboard.elda/โ
The steps to create a new release, follow this steps on your Dev environment:
Update files located in elda directoryโ
Push the changes on master
git add -A
git commit
git push
On every push to the master branch, a new digitalagendadata/scoreboard.elda:latest image is created. You can view the build status on: https://hub.docker.com/r/digitalagendadata/scoreboard.elda/builds/โ
Once the digitalagendadata/scoreboard.elda:latest image is succesfully built, you can test ( if needed ), and then create a new release.
View most recent tag on git:
git describe --tags
Choose a new tag, bigger than the latest one, using a MAJOR.MINOR format. Save it in a variable:
export NEW_TAG="<NEW_TAG>"
Create and push tag on repo:
git tag -a "$NEW_TAG" -m "$NEW_TAG"
git push origin $NEW_TAG
Follow the release on docker hub https://hub.docker.com/r/digitalagendadata/scoreboard.elda/builds/โ . The new image will have the following format:
digitalagendadata/scoreboard.elda:$NEW_TAG
Update docker-compose.yml with the new image:
sed -i 's/image: digitalagendadata\/scoreboard.elda.*/image: digitalagendadata\/scoreboard.elda:$NEW_TAG/' docker-compose.yml
Push the change on the GIT repo:
git add docker-compose.yml
git commit -m "Updated elda image to $NEW_TAG"
git push
The docker hub automated build for the production plone images can be found:
| Environment | Dockerfile location | Base image | Dockerhub | How to trigger |
|---|---|---|---|---|
| PRODUCTION | https://github.com/digital-agenda-data/scoreboard.docker/tree/master/ploneโ | plone:4.3.17 | https://hub.docker.com/r/digitalagendadata/ploneโ | Push on master or Tag |
| STAGING | https://github.com/digital-agenda-data/scoreboard.docker/tree/master/plone/stagingโ | digitalagendadata/plone:latest | https://hub.docker.com/r/digitalagendadata/plone.staging/โ | New digitalagendadata/plone:latest |
| DEVEL | https://github.com/digital-agenda-data/scoreboard.docker/tree/master/plone/develโ | digitalagendadata/plone:latest | https://hub.docker.com/r/digitalagendadata/plone.devel/โ | New digitalagendadata/plone:latest |
Update files in https://github.com/digital-agenda-data/scoreboard.docker/tree/master/ploneโ directory
Push the changes on master
git add -A
git commit
git push
On every push to the master branch, a new digitalagendadata/plone:latest image is created. You can view the build status on: https://hub.docker.com/r/digitalagendadata/plone/builds/โ .
View most recent tag on git:
git describe --tags
Choose a new tag, bigger than the latest one, using a MAJOR.MINOR format. Save it in a variable:
export NEW_TAG="<NEW_TAG>"
Create and push tag on repo:
git tag -a "$NEW_TAG" -m "$NEW_TAG"
git push origin $NEW_TAG
Follow the release on docker hub https://hub.docker.com/r/digitalagendadata/plone/builds/โ . The new image will have the following format:
digitalagendadata/plone:$NEW_TAG
Update docker-compose.yml with the new image:
sed -i 's/image: digitalagendadata\/plone.*/image: digitalagendadata\/plone:$NEW_TAG/' docker-compose.yml
Push the change on the GIT repo:
git add docker-compose.yml
git commit -m "Updated plone image to $NEW_TAG"
git push
The docker image is based on the digitalagendadata/plone:latest image. To reduce the image building time, if you need to do changes on production and on the staging image, try to combine them in a single commit.
Update files in the https://github.com/digital-agenda-data/scoreboard.docker/tree/master/plone/stagingโ directory
Push the changes on master
git add -A
git commit
git push
On every push to the master branch, a new digitalagendadata/plone:latest image is created. You can view the build status on: https://hub.docker.com/r/digitalagendadata/plone/builds/โ . After the image is created, a new build will be started on https://hub.docker.com/r/digitalagendadata/plone.staging/builds/โ
The docker image is based on the digitalagendadata/plone:latest image. To reduce the image building time, if you need to do changes on production and on the devel image, try to combine them in a single commit.
Update files in the https://github.com/digital-agenda-data/scoreboard.docker/tree/master/plone/develโ directory
Push the changes on master
git add -A
git commit
git push
On every push to the master branch, a new digitalagendadata/plone:latest image is created. You can view the build status on: https://hub.docker.com/r/digitalagendadata/plone/builds/โ . After the image is created, a new build will be started on https://hub.docker.com/r/digitalagendadata/plone.devel/builds/โ
If CSS does not look right on the Plone site: <SCOREBOARD_URL>/portal_css/manage_cssForm - Uncheck reset.css and click SAVE
server reached pm.max_children setting or you want to offer a better performace of the web application, you will need to update the pm.max_children, pm.start_servers, pm.min_spare_servers and pm.max_spare_servers values in the corresponding www-DEPLOY_TYPE.conf configuration file located in the piwik/ directory and restart the container.Content type
Image
Digest
Size
156 MB
Last updated
over 5 years ago
docker pull digitalagendadata/nginx