run.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. # Copyright 2016 - 2020 Crunchy Data Solutions, Inc.
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. docker compose -p "nominatim" -f docker-compose.yml up -d
  15. docker exec -u root nominatim bash -c "
  16. echo 'ssl = off' >> /etc/postgresql/12/main/postgresql.conf && \
  17. chown -R postgres:postgres /etc/postgresql/12/main/ && \
  18. # PostgreSQL andmed
  19. chown -R postgres:postgres /var/lib/postgresql/12/main && \
  20. chmod 700 /var/lib/postgresql/12/main && \
  21. # PostgreSQL konfiguratsioon
  22. chown -R postgres:postgres /etc/postgresql/12/main && \
  23. # Logikataloog
  24. mkdir -p /var/log/postgresql && \
  25. chown -R postgres:postgres /var/log/postgresql && \
  26. # SSL võti
  27. chgrp ssl-cert /etc/ssl/private/ssl-cert-snakeoil.key && \
  28. chmod 640 /etc/ssl/private/ssl-cert-snakeoil.key && \
  29. # Run
  30. mkdir -p /var/run/postgresql/12-main.pg_stat_tmp && \
  31. chown -R postgres:postgres /var/run/postgresql && \
  32. chmod -R 775 /var/run/postgresql
  33. "
  34. # Kopeeri tagasi
  35. docker cp conf/pg_hba.conf nominatim:/etc/postgresql/12/main/pg_hba.conf
  36. docker exec nominatim bash -c "chown postgres:postgres /etc/postgresql/12/main/pg_hba.conf;"
  37. docker restart nominatim
  38. sleep 5
  39. # 5. Reload
  40. docker exec nominatim su - postgres -c "psql -c 'SELECT pg_reload_conf();'"
  41. # 6. Kontrolli
  42. docker exec nominatim su - postgres -c "psql -c 'SELECT * FROM pg_hba_file_rules;'"
  43. # Kontrolli kas kasutatakse õiget conf faili
  44. docker exec nominatim su - postgres -c "psql -c 'SHOW hba_file;'"
  45. #docker restart nominatim
  46. exit 0