medic / cht-release-testing

Used to track release testing on medic projects
2 stars 0 forks source link

Test Log Rotation #211

Closed ngaruko closed 1 year ago

ngaruko commented 1 year ago

User: Admin/ Online Site: local docker Platform: CLI Test Steps: Steps for test

All commands are run outside the container, on your local, bare-metal host 1. on your download the docker compose files and start an instance: ``` wget https://staging.dev.medicmobile.org/_couch/builds/medic:medic:master/docker-compose/cht-core.yml wget https://staging.dev.medicmobile.org/_couch/builds/medic:medic:master/docker-compose/cht-couchdb.yml CHT_COMPOSE_PROJECT_NAME=test5 COUCHDB_SECRET=test5 DOCKER_CONFIG_PATH=./ COUCHDB_DATA=./couchdb CHT_COMPOSE_PATH=./ COUCHDB_USER=medic COUCHDB_PASSWORD=password docker-compose -f cht-core.yml -f cht-couchdb.yml up -d ``` 1. find the full ID of the nginx container: `docker inspect --format="{{.Id}}" deleteme_nginx_1` 2. using the full ID from step 2 above, run `watch` to monitor the number and size of the files for this container: `watch sudo ls -ahl /var/lib/docker/containers/10b6141e2cd2914d4ace05886823feb4bf17ca6f9db48144c1e754d559fb9473/local-logs` 4. create a >50MB text file by finding some text, any text, and putting it in `file.txt`. Then run this until the file is >50MB: `for i in {1..3}; do cat file.txt file.txt > file2.txt && mv file2.txt file.txt; done` 3. become root: `sudo su -` 4. spam the log with your new file, restarting the container each time: `while true; do cat file.txt >> /var/lib/docker/containers/10b6141e2cd2914d4ace05886823feb4bf17ca6f9db48144c1e754d559fb9473/local-logs/container.log; docker restart deleteme_haproxy_1; done` . replace the full ID in this command from step2 above Expected Result: 1. no more than 20 files are kept for a given service. 19 of them should be compressed in `.gz` format. You can watch this in real time by opening a second terminal and running: `sudo tail -f /var/lib/docker/containers/10b6141e2cd2914d4ace05886823feb4bf17ca6f9db48144c1e754d559fb9473/local-logs/container.log` be sure to replace the full ID in this command with the one from step 2 above