cURL command to download TRAM docker-compose.yml broken (doesn't follow redirect, zero byte file downloaded)
nathanching opened this issue · comments
WHERE: Step 2 of "Installation/Web Application/" hosted at "https://github.com/center-for-threat-informed-defense/tram/wiki/Installation"
EXPECTED RESULT: non-zero byte "docker-compose.yml" downloaded to current directory after executing listed cURL command
OBSERVED RESULT: zero-byte "docker-compose.yml" created from executing "curl -O https://github.com/center-for-threat-informed-defense/tram/raw/main/docker/docker-compose.yml"
WHY: The target url redirects to final url "https://raw.githubusercontent.com/center-for-threat-informed-defense/tram/main/docker/docker-compose.yml" and the cURL "-O" option alone does not follow redirects
SUGGESTED FIX: use the -L option to force cURL to follow redirect(s) e.g., "curl -L -O https://github.com/center-for-threat-informed-defense/tram/raw/main/docker/docker-compose.yml"
SUPPORTING DATA (terminal transcript):
localhost:~/tram$ ls -la
total 8
drwxr-sr-x 2 nathan nathan 4096 Sep 13 10:42 .
drwxr-sr-x 3 nathan nathan 4096 Sep 13 10:42 ..
localhost:~/tram$ curl -O https://github.com/center-for-threat-informed-defense/
tram/raw/main/docker/docker-compose.yml
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
localhost:~/tram$ ls -la
total 8
drwxr-sr-x 2 nathan nathan 4096 Sep 13 10:44 .
drwxr-sr-x 3 nathan nathan 4096 Sep 13 10:42 ..
-rw-r--r-- 1 nathan nathan 0 Sep 13 10:44 docker-compose.yml
localhost:~/tram$ rm docker-compose.yml
localhost:~/tram$ curl -s -L -D - https://github.com/center-for-threat-informed-defense/tram/raw/main/docker/docker-compose.yml -o /dev/null -w '%{url_effective}\n\n'
HTTP/2 302
server: GitHub.com
date: Wed, 13 Sep 2023 10:46:53 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, X-Requested-With
access-control-allow-origin: https://render.githubusercontent.com
location: https://raw.githubusercontent.com/center-for-threat-informed-defense/tram/main/docker/docker-compose.yml
cache-control: no-cache
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com objects-origin.githubusercontent.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com cdn.optimizely.com logx.optimizely.com/v1/events *.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ wss://*.actions.githubusercontent.com github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com support.github.com; img-src 'self' data: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com objects-origin.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/
content-length: 0
x-github-request-id: C9C6:6255:47E3B4C:4B04BB0:6501931D
HTTP/2 200
cache-control: max-age=300
content-security-policy: default-src 'none'; style-src 'unsafe-inline'; sandbox
content-type: text/plain; charset=utf-8
etag: "b4981856678d55fda3ac924d94d74d51edd1af438cfc24de8a64bd1d8d078bda"
strict-transport-security: max-age=31536000
x-content-type-options: nosniff
x-frame-options: deny
x-xss-protection: 1; mode=block
x-github-request-id: C3A2:6442:6559CC:78ACCE:650189FB
accept-ranges: bytes
date: Wed, 13 Sep 2023 10:46:53 GMT
via: 1.1 varnish
x-served-by: cache-bur-kbur8200144-BUR
x-cache: HIT
x-cache-hits: 1
x-timer: S1694602014.628118,VS0,VE1
vary: Authorization,Accept-Encoding,Origin
access-control-allow-origin: *
cross-origin-resource-policy: cross-origin
x-fastly-request-id: 9651738f71971f0b444ec2950c3420a7e6fa8f54
expires: Wed, 13 Sep 2023 10:51:53 GMT
source-age: 91
content-length: 1271
https://raw.githubusercontent.com/center-for-threat-informed-defense/tram/main/docker/docker-compose.yml
localhost:~/tram$ curl -L -O https://github.com/center-for-threat-informed-defense/tram/raw/main/docker/docker-compose.yml
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 1271 100 1271 0 0 2771 0 --:--:-- --:--:-- --:--:-- 2771
localhost:~/tram$ ls -la
total 12
drwxr-sr-x 2 nathan nathan 4096 Sep 13 10:48 .
drwxr-sr-x 3 nathan nathan 4096 Sep 13 10:42 ..
-rw-r--r-- 1 nathan nathan 1271 Sep 13 10:48 docker-compose.yml
localhost:~/tram$ cat docker-compose.yml
# TRAM compose file.
# - TRAM is currently setup to use Django with SQLite DB
# - TRAM currently only works from localhost on port 8000 (or whatever port you select here)
# - Any ML data and DB data is stored at the path stored in the environment variable
# `DATA_DIRECTORY`. This is internal to Django.
# - ALLOWED_HOSTS is a list of hosts allowed to connect to the Django server (in settings.py)
# - SECRET_KEY is generated at startup to a random value. Set SECRET_KEY env variable for tram service below
# to use a static value.
version: '3.5'
services:
tram:
image: ghcr.io/center-for-threat-informed-defense/tram:latest
environment:
- DATA_DIRECTORY=/tram/data
- ALLOWED_HOSTS=["example_host1", "localhost"]
- DJANGO_SUPERUSER_USERNAME=djangoSuperuser
- DJANGO_SUPERUSER_PASSWORD=LEGITPassword1234 # your password here
- DJANGO_SUPERUSER_EMAIL=test@example.com # your email address here
volumes:
- tram:/tram/data
- tram_static:/tram/src/tram/staticfiles
nginx:
image: ghcr.io/center-for-threat-informed-defense/tram-nginx:latest
ports:
- "8000:80"
volumes:
- tram:/tram/data:ro
- tram_static:/tram/src/tram/staticfiles:ro
volumes:
tram:
tram_static:
localhost:~/tram$
Thank you @nathanching for catching this and taking the time to report it. I just added your suggested fix to the install instructions.