|
| 1 | +# Test-Panel Operation Notes |
| 2 | + |
| 3 | +view nginx file |
| 4 | +```bash |
| 5 | +docker exec -it specify7-test-panel-panel-1 cat /home/node/nginx.conf.d/nginx.conf |
| 6 | +``` |
| 7 | +or |
| 8 | +```bash |
| 9 | +docker exec -it specify7-test-panel-panel-1 cat /etc/nginx/conf.d/servers/nginx.conf |
| 10 | +``` |
| 11 | +or |
| 12 | +```bash |
| 13 | +sudo vim /var/lib/docker/volumes/specify7-test-panel_nginx-conf/_data/nginx.conf |
| 14 | +``` |
| 15 | + |
| 16 | + |
| 17 | +view currently deployed docker-compose.yml |
| 18 | +```bash |
| 19 | +docker exec -it specify7-test-panel-panel-1 cat /home/node/state/docker-compose.yml |
| 20 | +``` |
| 21 | +or |
| 22 | +```bash |
| 23 | +sudo vim /var/lib/docker/volumes/specify7-test-panel_state/_data/docker-compose.yml |
| 24 | +``` |
| 25 | + |
| 26 | +view current instance configuration |
| 27 | +```bash |
| 28 | +docker exec -it specify7-test-panel-panel-1 cat /home/node/state/configuration.json |
| 29 | +``` |
| 30 | +or |
| 31 | +```bash |
| 32 | +sudo vim /var/lib/docker/volumes/specify7-test-panel_state/_data/configuration.json |
| 33 | +``` |
| 34 | + |
| 35 | +Fix SSL cert problem |
| 36 | +```bash |
| 37 | +cp -r test.specifysystems.org-0001/ test.specifysystems.org/ |
| 38 | +``` |
| 39 | +or |
| 40 | +```bash |
| 41 | +sudo cp -r /etc/letsencrypt/live/test.specifysystems.org-0001/ |
| 42 | +``` |
| 43 | + |
| 44 | +`/etc/letsencrypt/live/test.specifysystems.org/` |
| 45 | + |
| 46 | +Docker build |
| 47 | +``` |
| 48 | +sudo docker compose \ |
| 49 | + -f docker-compose.yml \ |
| 50 | + -f docker-compose.production.yml \ |
| 51 | + up --no-start --build |
| 52 | +``` |
| 53 | +or |
| 54 | +``` |
| 55 | +sudo docker compose \ |
| 56 | + -f docker-compose.yml \ |
| 57 | + -f docker-compose.production.yml \ |
| 58 | + build |
| 59 | +``` |
| 60 | + |
| 61 | +Docker run |
| 62 | +``` |
| 63 | +sudo docker compose \ |
| 64 | + -f docker-compose.yml \ |
| 65 | + -f docker-compose.production.yml \ |
| 66 | + -f /var/lib/docker/volumes/specify7-test-panel_state/_data/docker-compose.yml \ |
| 67 | + up --remove-orphans -d |
| 68 | +``` |
| 69 | + |
| 70 | +Restart |
| 71 | +``` |
| 72 | +sudo docker compose down; sudo docker compose -f docker-compose.yml -f docker-compose.production.yml -f /var/lib/docker/volumes/specify7-test-panel_state/_data/docker-compose.yml up --remove-orphans -d |
| 73 | +``` |
| 74 | + |
| 75 | +Docker stop |
| 76 | +```bash |
| 77 | +sudo docker stop $(sudo docker ps --all -q) |
| 78 | +``` |
| 79 | + |
| 80 | +Full stop, rebuild, and restart |
| 81 | +```bash |
| 82 | +sudo docker stop $(sudo docker ps --all -q); |
| 83 | +sudo docker rm $(sudo docker ps --all -q); |
| 84 | +sudo docker compose \ |
| 85 | + -f docker-compose.yml \ |
| 86 | + -f docker-compose.production.yml \ |
| 87 | + up --no-start --build; |
| 88 | +sudo docker compose \ |
| 89 | + -f docker-compose.yml \ |
| 90 | + -f docker-compose.production.yml \ |
| 91 | + -f /var/lib/docker/volumes/specify7-test-panel_state/_data/docker-compose.yml \ |
| 92 | + up --remove-orphans -d; |
| 93 | +``` |
| 94 | + |
| 95 | +full stop and restart without rebuild |
| 96 | +```bash |
| 97 | +sudo docker compose down; |
| 98 | +sudo docker stop $(sudo docker ps --all -q); |
| 99 | +sudo docker rm $(sudo docker ps --all -q); |
| 100 | +sudo docker compose \ |
| 101 | + -f docker-compose.yml \ |
| 102 | + -f docker-compose.production.yml \ |
| 103 | + -f /var/lib/docker/volumes/specify7-test-panel_state/_data/docker-compose.yml \ |
| 104 | + up --remove-orphans -d; |
| 105 | +``` |
| 106 | + |
| 107 | +Check SPECIFY_THICK_CLIENT |
| 108 | +``` |
| 109 | +docker exec -it specify7-test-panel-geo20241205-production-2-1 bash |
| 110 | +ve/bin/python manage.py shell |
| 111 | +from django.conf import settings |
| 112 | +settings.SPECIFY_THICK_CLIENT |
| 113 | +``` |
| 114 | +or |
| 115 | +```bash |
| 116 | +docker exec specify7-test-panel-_-1 ve/bin/python -c "from django.conf import settings; print(settings.SPECIFY_THICK_CLIENT)" |
| 117 | +``` |
| 118 | + |
| 119 | +```bash |
| 120 | +docker exec -it specify7-test-panel-<_name>-1 ve/bin/python -c "from django.conf import settings; import; if os.path.exists('/opt/specify7/config') : settings.SPECIFY_THICK_CLIENT='/opt/specify7') |
| 121 | +``` |
| 122 | +
|
| 123 | +```bash |
| 124 | +#!/bin/bash |
| 125 | +
|
| 126 | +# Get all running container names |
| 127 | +all_containers=$(docker ps --format "{{.Names}}") |
| 128 | +
|
| 129 | +# Filter out unwanted containers |
| 130 | +filtered_containers=$(echo "$all_containers" | grep -vE '(panel-panel|redis|nginx)') |
| 131 | +
|
| 132 | +# Loop through filtered containers and execute the command |
| 133 | +while IFS= read -r container_name; do |
| 134 | + echo "Processing container: $container_name" |
| 135 | + |
| 136 | + # Execute the command inside the container using multiline syntax |
| 137 | + docker exec $container_name ve/bin/python <<EOF |
| 138 | +from django.conf import settings |
| 139 | +import os |
| 140 | +if os.path.exists('/opt/specify7/config'): |
| 141 | + settings.SPECIFY_THICK_CLIENT = '/opt/specify7' |
| 142 | +EOF |
| 143 | + |
| 144 | + echo "Finished processing $container_name" |
| 145 | +done <<< "$filtered_containers" |
| 146 | +
|
| 147 | +echo "All containers processed." |
| 148 | +
|
| 149 | +``` |
| 150 | +
|
| 151 | +SSL renewal (not sure yet) - need to get 'etc/letsencrypt/live/test.specifysystems.org' directory to match /etc/letsencrypt/live/test.specifysystems.org-0001 |
| 152 | +
|
| 153 | +```bash |
| 154 | +ls -la /etc/letsencrypt/live/test.specifysystems.org; |
| 155 | +ls -la /etc/letsencrypt/live/test.specifysystems.org-0001; |
| 156 | +ls -la /etc/letsencrypt/archive/test.specifysystems.org-0001; |
| 157 | +
|
| 158 | +sudo rm /etc/letsencrypt/live/test.specifysystems.org-0001/fullchain.pem; |
| 159 | +sudo ln -s /etc/letsencrypt/archive/test.specifysystems.org-0001/fullchain6.pem /etc/letsencrypt/live/test.specifysystems.org-0001/fullchain.pem; |
| 160 | +
|
| 161 | +sudo rm /etc/letsencrypt/live/test.specifysystems.org-0001/privkey.pem; |
| 162 | +sudo ln -s /etc/letsencrypt/archive/test.specifysystems.org-0001/privkey6.pem /etc/letsencrypt/live/test.specifysystems.org-0001/privkey.pem; |
| 163 | +
|
| 164 | +sudo rm /etc/letsencrypt/live/test.specifysystems.org-0001/chain.pem; |
| 165 | +sudo ln -s /etc/letsencrypt/archive/test.specifysystems.org-0001/chain6.pem chain.pem; |
| 166 | +
|
| 167 | +sudo rm /etc/letsencrypt/live/test.specifysystems.org-0001/cert.pem; |
| 168 | +sudo ln -s /etc/letsencrypt/archive/test.specifysystems.org-0001/cert6.pem cert.pem; |
| 169 | +
|
| 170 | +docker exec -it specify7-test-panel-nginx-1 nginx -s reload; |
| 171 | +``` |
| 172 | +
|
| 173 | +```bash |
| 174 | +# Change the ssl files nginx points to |
| 175 | +sudo ln -sf /etc/letsencrypt/archive/test.specifysystems.org-0001/cert6.pem /etc/letsencrypt/live/test.specifysystems.org/cert.pem; |
| 176 | +sudo ln -sf /etc/letsencrypt/archive/test.specifysystems.org-0001/chain6.pem /etc/letsencrypt/live/test.specifysystems.org/chain.pem; |
| 177 | +sudo ln -sf /etc/letsencrypt/archive/test.specifysystems.org-0001/fullchain6.pem /etc/letsencrypt/live/test.specifysystems.org/fullchain.pem; |
| 178 | +sudo ln -sf /etc/letsencrypt/archive/test.specifysystems.org-0001/privkey6.pem /etc/letsencrypt/live/test.specifysystems.org/privkey.pem; |
| 179 | +docker exec -it specify7-test-panel-nginx-1 nginx -s reload; |
| 180 | +``` |
| 181 | +
|
| 182 | +### Check instance migration state |
| 183 | +find container name |
| 184 | +`docker stats --no-stream` |
| 185 | +
|
| 186 | +bash into container |
| 187 | +`docker exec -it <container_name> bash` |
| 188 | +
|
| 189 | +see migration state |
| 190 | +`ve/bin/python manage.py showmigrations` |
| 191 | +
|
| 192 | +# Test static file access for an instance |
| 193 | +
|
| 194 | +Create test config file for an instance: |
| 195 | +```bash |
| 196 | +touch config/test.txt; |
| 197 | +echo "Testing" > config/test.txt; |
| 198 | +``` |
| 199 | +
|
| 200 | +request: |
| 201 | +```bash |
| 202 | +curl https://ojsmnh110242024prod-production.test.specifysystems.org/static/config/icons_datamodel.xml |
| 203 | +
|
| 204 | +curl https://ojsmnh110242024prod-production.test.specifysystems.org/static/config/test.txt |
| 205 | +
|
| 206 | +curl https://ojsmnh110242024prod-production.test.specifysystems.org/static/config/geology/geology.views.xml |
| 207 | +
|
| 208 | +curl https://sandbox-rbge.specifycloud.org/context/view.json?name=CollectionObjectGroup |
| 209 | +``` |
| 210 | +
|
| 211 | +test config |
| 212 | +``` |
| 213 | +ve/bin/python manage.py shell |
| 214 | +
|
| 215 | +from django.conf import settings |
| 216 | +settings.SPECIFY_CONFIG_DIR |
| 217 | +``` |
| 218 | +
|
| 219 | +view all django. settings |
| 220 | +```python |
| 221 | +from django.conf import settings; print("\n".join(f"{setting}: {getattr(settings, setting)}" for setting in dir(settings) if setting.isupper())) |
| 222 | +``` |
| 223 | +
|
| 224 | +```bash |
| 225 | +ve/bin/python manage.py shell -c 'from django.conf import settings; print("\n".join(f"{setting}: {getattr(settings, setting)}" for setting in dir(settings) if setting.isupper()))' |
| 226 | +``` |
| 227 | +
|
| 228 | +vim command |
| 229 | +``` |
| 230 | +%s/THICK_CLIENT_LOCATION/SPECIFY_CONFIG_DIR/g |
| 231 | +
|
| 232 | +%s/volumes:\n\s\s\s\s\s\s\n/volumes:\n\s\s\s\s\n/g |
| 233 | + ``` |
0 commit comments