Created
June 19, 2020 07:15
-
-
Save Niccolum/14fade708d07a64672451300dd2bbec8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.4' | |
services: | |
kosmos-app: | |
container_name: kosmos_app | |
build: | |
context: . | |
dockerfile: backend_Dockerfile | |
env_file: | |
- .env | |
environment: | |
- STATIC_ROOT=/opt/kosmos/frontend | |
restart: always | |
network_mode: "host" | |
healthcheck: | |
test: curl -f http://localhost:8080/backend/healthcheck || exit 1 | |
interval: 1m | |
timeout: 1m | |
retries: 3 | |
start_period: 5s | |
# depends_on: | |
# - kosmos-db | |
kosmos-cron: | |
container_name: kosmos_cron | |
build: | |
context: . | |
dockerfile: engine_Dockerfile | |
env_file: | |
- .env | |
environment: | |
- BACKEND_URL=http://kosmos-app:8080 | |
restart: always | |
network_mode: "host" | |
# depends_on: | |
# - kosmos-db | |
# kosmos-db: | |
# container_name: kosmos_db | |
# image: postgres:latest | |
# restart: always | |
# env_file: | |
# - .env | |
# volumes: | |
# - ./postgresql-kosmos-volume:/var/lib/postgresql | |
# - ./precreate_db.sql:/precreate_db.sql | |
# ports: | |
# - 15432:5432 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from settings import BACKEND_URL, BACKEND_SERVICE_KEY | |
def refill(): | |
success = True | |
print(BACKEND_URL) | |
r = requests.get(f'{BACKEND_URL}/backend/action/refill', params={'service_key': BACKEND_SERVICE_KEY}) | |
try: | |
r = requests.get(f'{BACKEND_URL}/backend/action/refill', params={'service_key': BACKEND_SERVICE_KEY}) | |
print('Responce', r.content) | |
if not r.content == b"Table's cache refilled": | |
success = False | |
except: | |
print('Error while refilling the cache') | |
success = False | |
return success |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kosmos_cron | start at 2020-06-19 07:12:01.918786 | |
kosmos_cron | http://kosmos-app:8080 | |
kosmos_cron | Traceback (most recent call last): | |
kosmos_cron | File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn | |
kosmos_cron | (self._dns_host, self.port), self.timeout, **extra_kw | |
kosmos_cron | File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 61, in create_connection | |
kosmos_cron | for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): | |
kosmos_cron | File "/usr/local/lib/python3.7/socket.py", line 752, in getaddrinfo | |
kosmos_cron | for res in _socket.getaddrinfo(host, port, family, type, proto, flags): | |
kosmos_cron | socket.gaierror: [Errno -3] Temporary failure in name resolution | |
kosmos_cron | | |
kosmos_cron | During handling of the above exception, another exception occurred: | |
kosmos_cron | | |
kosmos_cron | Traceback (most recent call last): | |
kosmos_cron | File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen | |
kosmos_cron | chunked=chunked, | |
kosmos_cron | File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 392, in _make_request | |
kosmos_cron | conn.request(method, url, **httplib_request_kw) | |
kosmos_cron | File "/usr/local/lib/python3.7/http/client.py", line 1252, in request | |
kosmos_cron | self._send_request(method, url, body, headers, encode_chunked) | |
kosmos_cron | File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request | |
kosmos_cron | self.endheaders(body, encode_chunked=encode_chunked) | |
kosmos_cron | File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders | |
kosmos_cron | self._send_output(message_body, encode_chunked=encode_chunked) | |
kosmos_cron | File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output | |
kosmos_cron | self.send(msg) | |
kosmos_cron | File "/usr/local/lib/python3.7/http/client.py", line 966, in send | |
kosmos_cron | self.connect() | |
kosmos_cron | File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 187, in connect | |
kosmos_cron | conn = self._new_conn() | |
kosmos_cron | File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 172, in _new_conn | |
kosmos_cron | self, "Failed to establish a new connection: %s" % e | |
kosmos_cron | urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7ff3711107d0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution | |
kosmos_cron | | |
kosmos_cron | During handling of the above exception, another exception occurred: | |
kosmos_cron | | |
kosmos_cron | Traceback (most recent call last): | |
kosmos_cron | File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send | |
kosmos_cron | timeout=timeout | |
kosmos_cron | File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 725, in urlopen | |
kosmos_cron | method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] | |
kosmos_cron | File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 439, in increment | |
kosmos_cron | raise MaxRetryError(_pool, url, error or ResponseError(cause)) | |
kosmos_cron | urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='kosmos-app', port=8080): Max retries exceeded with url: /backend/action/refill?service_key=test_service_key (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff3711107d0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) | |
kosmos_cron | | |
kosmos_cron | During handling of the above exception, another exception occurred: | |
kosmos_cron | | |
kosmos_cron | Traceback (most recent call last): | |
kosmos_cron | File "/opt/kosmos/engine/main.py", line 55, in <module> | |
kosmos_cron | copy_wrapper(restart_server.refill, 'Refill backend cache') # about 30 seconds | |
kosmos_cron | File "/opt/kosmos/engine/main.py", line 32, in copy_wrapper | |
kosmos_cron | success = func() | |
kosmos_cron | File "/opt/kosmos/engine/restart_server.py", line 10, in refill | |
kosmos_cron | r = requests.get(f'{BACKEND_URL}/backend/action/refill', params={'service_key': BACKEND_SERVICE_KEY}) | |
kosmos_cron | File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 76, in get | |
kosmos_cron | return request('get', url, params=params, **kwargs) | |
kosmos_cron | File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 61, in request | |
kosmos_cron | return session.request(method=method, url=url, **kwargs) | |
kosmos_cron | File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request | |
kosmos_cron | resp = self.send(prep, **send_kwargs) | |
kosmos_cron | File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 643, in send | |
kosmos_cron | r = adapter.send(request, **kwargs) | |
kosmos_cron | File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send | |
kosmos_cron | raise ConnectionError(e, request=request) | |
kosmos_cron | requests.exceptions.ConnectionError: HTTPConnectionPool(host='kosmos-app', port=8080): Max retries exceeded with url: /backend/action/refill?service_key=test_service_key (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff3711107d0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment