|
| 1 | +## Docker Based Examples |
| 2 | +This module provides docker compose files for the various architectures for experimentation purposes. This gives you the ability to stand up an entire PE stack in order to learn how this module and HA works. If you have docker and docker-compose you can start up a full Puppet architecture with a single command. Please note that Puppet does not support PE on containers in production. |
| 3 | + |
| 4 | +In order to decouple Bolt from a dev system, a special bolt container is created that will run all the bolt commands. This is |
| 5 | +required to achieve maximum portability. Should you want to run bolt commands against the PE stack you must |
| 6 | +first login to this bolt container via ssh, docker or docker-compose. |
| 7 | + |
| 8 | +Example: `docker-compose run --entrypoint=/bin/bash bolt` |
| 9 | + |
| 10 | +### Requirements |
| 11 | +To run the container based examples you will need the following requirements: |
| 12 | + |
| 13 | +2. Docker |
| 14 | +3. Docker compose |
| 15 | +4. 16GB memory, 24GB+ for XL and XL-HA architectures |
| 16 | +5. CPU with many cores (Tested with Core i7 6700) |
| 17 | + |
| 18 | +### Starting the example |
| 19 | +We have provided a provision.sh script to help making these examples simple. |
| 20 | +To use perform the following: |
| 21 | + |
| 22 | +1. cd spec/docker |
| 23 | +2. bash provision.sh |
| 24 | +3. select desired architecture when prompted (ie. extra-large-ha ) |
| 25 | +4. Wait 10-20 minutes for provisioning to complete |
| 26 | + |
| 27 | +``` |
| 28 | +Please choose a PE architecture to build: |
| 29 | +1) extra-large/ 3) large/ 5) standard/ |
| 30 | +2) extra-large-ha/ 4) large-ha/ 6) standard-ha/ |
| 31 | +#? |
| 32 | +``` |
| 33 | + |
| 34 | +### Stopping the example |
| 35 | +In order to stop and remove the containers you will need to perform the following. |
| 36 | + |
| 37 | +1. cd spec/docker |
| 38 | +2. `cd <chosen architecture>` |
| 39 | +3. docker-compose down |
| 40 | + |
| 41 | +### Logging into the console |
| 42 | +You can login to the PE Console after successful provision. However, first you will need to |
| 43 | +grab the mapped port number of the PE console. The port numbers are mapped dynamically as to not |
| 44 | +cause port conflicts on your system. To see how the ports are mapped you can view them via: |
| 45 | + |
| 46 | +1. docker ps |
| 47 | + ``` |
| 48 | + 80c6f0b5525c pe-base "/sbin/init" 2 hours ago Up 2 hours 0.0.0.0:32774->22/tcp, 0.0.0.0:32773->443/tcp, 0.0.0.0:32772->4433/tcp, 0.0.0.0:32771->8080/tcp, 0.0.0.0:32770->8081/tcp, 0.0.0.0:32769->8140/tcp, 0.0.0.0:32768->8443/tcp pe-lg.puppet.vm |
| 49 | + ``` |
| 50 | +2. Note the mapped port for 443, which in this case is 32773 |
| 51 | +3. Visit https://localhost:32773 in your browser |
| 52 | +4. Accept security risk (self signed cert) |
| 53 | +5. Login: admin/puppetlabs |
| 54 | +
|
| 55 | +### Logging into any of the containers |
| 56 | +Ssh is running in all the containers so you can use ssh if you grab the mapped ssh port number. `ssh root@localhost -p 32774` |
| 57 | +
|
| 58 | +Login: root/test |
| 59 | +
|
| 60 | +You can also bypass ssh and run docker exec or docker-compose exec |
| 61 | +
|
| 62 | +1. cd spec/docker/extra-large |
| 63 | +2. docker-compose exec pe_xl_core /bin/bash |
| 64 | +
|
| 65 | +**Note:** pe_xl_core is the name of the service defined in the respective docker-compose file. |
| 66 | +
|
| 67 | +This will run an interactive bash shell in the running container. |
| 68 | +
|
| 69 | +### Upgrades |
| 70 | +There is also a upgrade.sh script that is similar to the provision.sh script. This script will upgrade an already provisioned PE stack to the version specified in the update_params.json file. |
| 71 | +
|
| 72 | +### Other notes |
| 73 | +1. The provision plan is not fully idempotent. |
| 74 | +2. Some tasks may fail when run due to resource constraints. |
| 75 | +3. You can rerun the provision.sh script on the same architecture without destroying the containers. This can sometimes complete the provision process successfully. |
| 76 | +4. Rerunning the provision script may result in errors due to idempotency issues with tasks and plans. |
| 77 | +5. Please remember you are starting the equilivent of 3-6 VMs on a single system. |
| 78 | +6. You can use top to view all the processes being run in the containers. |
| 79 | +7. Docker will use the privilege mode option when running these examples (systemd support) |
| 80 | +8. Systemd is running inside these containers! The real systemd, not the fake one. |
0 commit comments