chore: make /assets a named volume for dev container (#4018)

* chore: make /assets a static volume for dev container

* chore: fix create-dirs script to point to /assets
This commit is contained in:
Nicolas Giard 2022-05-31 17:43:29 -04:00 committed by GitHub
parent 159f89ebf3
commit e02ce05612
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 76 additions and 68 deletions

View file

@ -8,6 +8,7 @@ services:
- .:/workspace - .:/workspace
- /workspace/.parcel-cache - /workspace/.parcel-cache
- /workspace/__pycache__ - /workspace/__pycache__
- app-assets:/assets
- datatracker-vscode-ext:/root/.vscode-server/extensions - datatracker-vscode-ext:/root/.vscode-server/extensions
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:db network_mode: service:db

View file

@ -60,3 +60,4 @@ services:
volumes: volumes:
mariadb-data: mariadb-data:
app-assets:

View file

@ -48,3 +48,5 @@ USER dev:dev
COPY requirements.txt /tmp/pip-tmp/ COPY requirements.txt /tmp/pip-tmp/
RUN pip3 --disable-pip-version-check --no-cache-dir install --user --no-warn-script-location -r /tmp/pip-tmp/requirements.txt RUN pip3 --disable-pip-version-check --no-cache-dir install --user --no-warn-script-location -r /tmp/pip-tmp/requirements.txt
RUN sudo rm -rf /tmp/pip-tmp RUN sudo rm -rf /tmp/pip-tmp
VOLUME [ "/assets" ]

View file

@ -125,6 +125,9 @@ RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf
ADD https://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for /usr/local/bin/ ADD https://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for /usr/local/bin/
RUN chmod +rx /usr/local/bin/wait-for RUN chmod +rx /usr/local/bin/wait-for
# Create assets directory
RUN mkdir -p /assets
# Create workspace # Create workspace
RUN mkdir -p /workspace RUN mkdir -p /workspace
WORKDIR /workspace WORKDIR /workspace

View file

@ -31,25 +31,25 @@ INTERNET_DRAFT_ARCHIVE_DIR = "test/archive/"
INTERNET_ALL_DRAFTS_ARCHIVE_DIR = "test/archive/" INTERNET_ALL_DRAFTS_ARCHIVE_DIR = "test/archive/"
RFC_PATH = "test/rfc/" RFC_PATH = "test/rfc/"
AGENDA_PATH = 'data/developers/www6s/proceedings/' AGENDA_PATH = '/assets/www6s/proceedings/'
MEETINGHOST_LOGO_PATH = AGENDA_PATH MEETINGHOST_LOGO_PATH = AGENDA_PATH
USING_DEBUG_EMAIL_SERVER=True USING_DEBUG_EMAIL_SERVER=True
EMAIL_HOST='localhost' EMAIL_HOST='localhost'
EMAIL_PORT=2025 EMAIL_PORT=2025
MEDIA_BASE_DIR = 'data/developers' MEDIA_BASE_DIR = '/assets'
MEDIA_ROOT = MEDIA_BASE_DIR + '/media/' MEDIA_ROOT = MEDIA_BASE_DIR + '/media/'
MEDIA_URL = '/media/' MEDIA_URL = '/media/'
PHOTOS_DIRNAME = 'photo' PHOTOS_DIRNAME = 'photo'
PHOTOS_DIR = MEDIA_ROOT + PHOTOS_DIRNAME PHOTOS_DIR = MEDIA_ROOT + PHOTOS_DIRNAME
SUBMIT_YANG_CATALOG_MODEL_DIR = 'data/developers/ietf-ftp/yang/catalogmod/' SUBMIT_YANG_CATALOG_MODEL_DIR = '/assets/ietf-ftp/yang/catalogmod/'
SUBMIT_YANG_DRAFT_MODEL_DIR = 'data/developers/ietf-ftp/yang/draftmod/' SUBMIT_YANG_DRAFT_MODEL_DIR = '/assets/ietf-ftp/yang/draftmod/'
SUBMIT_YANG_INVAL_MODEL_DIR = 'data/developers/ietf-ftp/yang/invalmod/' SUBMIT_YANG_INVAL_MODEL_DIR = '/assets/ietf-ftp/yang/invalmod/'
SUBMIT_YANG_IANA_MODEL_DIR = 'data/developers/ietf-ftp/yang/ianamod/' SUBMIT_YANG_IANA_MODEL_DIR = '/assets/ietf-ftp/yang/ianamod/'
SUBMIT_YANG_RFC_MODEL_DIR = 'data/developers/ietf-ftp/yang/rfcmod/' SUBMIT_YANG_RFC_MODEL_DIR = '/assets/ietf-ftp/yang/rfcmod/'
# Set INTERNAL_IPS for use within Docker. See https://knasmueller.net/fix-djangos-debug-toolbar-not-showing-inside-docker # Set INTERNAL_IPS for use within Docker. See https://knasmueller.net/fix-djangos-debug-toolbar-not-showing-inside-docker
import socket import socket
@ -60,15 +60,15 @@ INTERNAL_IPS = [".".join(ip.split(".")[:-1] + ["1"]) for ip in ips]
# 'ietf.context_processors.sql_debug', # 'ietf.context_processors.sql_debug',
# ] # ]
DOCUMENT_PATH_PATTERN = 'data/developers/ietf-ftp/{doc.type_id}/' DOCUMENT_PATH_PATTERN = '/assets/ietf-ftp/{doc.type_id}/'
INTERNET_DRAFT_PATH = 'data/developers/ietf-ftp/internet-drafts/' INTERNET_DRAFT_PATH = '/assets/ietf-ftp/internet-drafts/'
RFC_PATH = 'data/developers/ietf-ftp/rfc/' RFC_PATH = '/assets/ietf-ftp/rfc/'
CHARTER_PATH = 'data/developers/ietf-ftp/charter/' CHARTER_PATH = '/assets/ietf-ftp/charter/'
BOFREQ_PATH = 'data/developers/ietf-ftp/bofreq/' BOFREQ_PATH = '/assets/ietf-ftp/bofreq/'
CONFLICT_REVIEW_PATH = 'data/developers/ietf-ftp/conflict-reviews/' CONFLICT_REVIEW_PATH = '/assets/ietf-ftp/conflict-reviews/'
STATUS_CHANGE_PATH = 'data/developers/ietf-ftp/status-changes/' STATUS_CHANGE_PATH = '/assets/ietf-ftp/status-changes/'
INTERNET_DRAFT_ARCHIVE_DIR = 'data/developers/ietf-ftp/internet-drafts/' INTERNET_DRAFT_ARCHIVE_DIR = '/assets/ietf-ftp/internet-drafts/'
INTERNET_ALL_DRAFTS_ARCHIVE_DIR = 'data/developers/ietf-ftp/internet-drafts/' INTERNET_ALL_DRAFTS_ARCHIVE_DIR = '/assets/ietf-ftp/internet-drafts/'
NOMCOM_PUBLIC_KEYS_DIR = 'data/nomcom_keys/public_keys/' NOMCOM_PUBLIC_KEYS_DIR = 'data/nomcom_keys/public_keys/'
SLIDE_STAGING_PATH = 'test/staging/' SLIDE_STAGING_PATH = 'test/staging/'

View file

@ -56,7 +56,7 @@ INTERNET_DRAFT_ARCHIVE_DIR = "test/archive/"
INTERNET_ALL_DRAFTS_ARCHIVE_DIR = "test/archive/" INTERNET_ALL_DRAFTS_ARCHIVE_DIR = "test/archive/"
RFC_PATH = "test/rfc/" RFC_PATH = "test/rfc/"
AGENDA_PATH = 'data/developers/www6s/proceedings/' AGENDA_PATH = '/assets/www6s/proceedings/'
MEETINGHOST_LOGO_PATH = AGENDA_PATH MEETINGHOST_LOGO_PATH = AGENDA_PATH
USING_DEBUG_EMAIL_SERVER=True USING_DEBUG_EMAIL_SERVER=True
@ -70,12 +70,12 @@ MEDIA_URL = '/media/'
PHOTOS_DIRNAME = 'photo' PHOTOS_DIRNAME = 'photo'
PHOTOS_DIR = MEDIA_ROOT + PHOTOS_DIRNAME PHOTOS_DIR = MEDIA_ROOT + PHOTOS_DIRNAME
DOCUMENT_PATH_PATTERN = 'data/developers/ietf-ftp/{doc.type_id}/' DOCUMENT_PATH_PATTERN = '/assets/ietf-ftp/{doc.type_id}/'
SUBMIT_YANG_CATALOG_MODEL_DIR = 'data/developers/ietf-ftp/yang/catalogmod/' SUBMIT_YANG_CATALOG_MODEL_DIR = '/assets/ietf-ftp/yang/catalogmod/'
SUBMIT_YANG_DRAFT_MODEL_DIR = 'data/developers/ietf-ftp/yang/draftmod/' SUBMIT_YANG_DRAFT_MODEL_DIR = '/assets/ietf-ftp/yang/draftmod/'
SUBMIT_YANG_INVAL_MODEL_DIR = 'data/developers/ietf-ftp/yang/invalmod/' SUBMIT_YANG_INVAL_MODEL_DIR = '/assets/ietf-ftp/yang/invalmod/'
SUBMIT_YANG_IANA_MODEL_DIR = 'data/developers/ietf-ftp/yang/ianamod/' SUBMIT_YANG_IANA_MODEL_DIR = '/assets/ietf-ftp/yang/ianamod/'
SUBMIT_YANG_RFC_MODEL_DIR = 'data/developers/ietf-ftp/yang/rfcmod/' SUBMIT_YANG_RFC_MODEL_DIR = '/assets/ietf-ftp/yang/rfcmod/'
DE_GFM_BINARY = '/usr/local/bin/de-gfm' DE_GFM_BINARY = '/usr/local/bin/de-gfm'

View file

@ -8,6 +8,7 @@ services:
- .:/workspace - .:/workspace
- /workspace/.parcel-cache - /workspace/.parcel-cache
- /workspace/__pycache__ - /workspace/__pycache__
- app-assets:/assets
db: db:
ports: ports:
- '3306' - '3306'

View file

@ -8,26 +8,26 @@ for sub in \
test/media \ test/media \
test/wiki/ietf \ test/wiki/ietf \
data/nomcom_keys/public_keys \ data/nomcom_keys/public_keys \
data/developers/ietf-ftp \ /assets/ietf-ftp \
data/developers/ietf-ftp/bofreq \ /assets/ietf-ftp/bofreq \
data/developers/ietf-ftp/charter \ /assets/ietf-ftp/charter \
data/developers/ietf-ftp/conflict-reviews \ /assets/ietf-ftp/conflict-reviews \
data/developers/ietf-ftp/internet-drafts \ /assets/ietf-ftp/internet-drafts \
data/developers/ietf-ftp/rfc \ /assets/ietf-ftp/rfc \
data/developers/ietf-ftp/status-changes \ /assets/ietf-ftp/status-changes \
data/developers/ietf-ftp/yang/catalogmod \ /assets/ietf-ftp/yang/catalogmod \
data/developers/ietf-ftp/yang/draftmod \ /assets/ietf-ftp/yang/draftmod \
data/developers/ietf-ftp/yang/ianamod \ /assets/ietf-ftp/yang/ianamod \
data/developers/ietf-ftp/yang/invalmod \ /assets/ietf-ftp/yang/invalmod \
data/developers/ietf-ftp/yang/rfcmod \ /assets/ietf-ftp/yang/rfcmod \
data/developers/www6s \ /assets/www6s \
data/developers/www6s/staging \ /assets/www6s/staging \
data/developers/www6s/wg-descriptions \ /assets/www6s/wg-descriptions \
data/developers/www6s/proceedings \ /assets/www6s/proceedings \
data/developers/www6/ \ /assets/www6/ \
data/developers/www6/iesg \ /assets/www6/iesg \
data/developers/www6/iesg/evaluation \ /assets/www6/iesg/evaluation \
data/developers/media/photo \ /assets/media/photo \
; do ; do
if [ ! -d "$sub" ]; then if [ ! -d "$sub" ]; then
echo "Creating dir $sub" echo "Creating dir $sub"

View file

@ -2,12 +2,13 @@
WORKSPACEDIR="/workspace" WORKSPACEDIR="/workspace"
sudo service rsyslog start sudo service rsyslog start &>/dev/null
# Fix ownership of volumes # Fix ownership of volumes
echo "Fixing volumes ownership..." echo "Fixing volumes ownership..."
sudo chown -R dev:dev "$WORKSPACEDIR/.parcel-cache" sudo chown -R dev:dev "$WORKSPACEDIR/.parcel-cache"
sudo chown -R dev:dev "$WORKSPACEDIR/__pycache__" sudo chown -R dev:dev "$WORKSPACEDIR/__pycache__"
sudo chown dev:dev "/assets"
echo "Fix chromedriver /dev/shm permissions..." echo "Fix chromedriver /dev/shm permissions..."
sudo chmod 1777 /dev/shm sudo chmod 1777 /dev/shm

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
version=0.11 version=0.12
program=${0##*/} program=${0##*/}
progdir=${0%/*} progdir=${0%/*}
if [ "$progdir" = "$program" ]; then progdir="."; fi if [ "$progdir" = "$program" ]; then progdir="."; fi
@ -23,7 +23,7 @@ DESCRIPTION
from the ietf server to a local directory, for instance drafts, from the ietf server to a local directory, for instance drafts,
charters, rfcs, agendas, minutes, etc. charters, rfcs, agendas, minutes, etc.
If no destination is given, the default is data/developers. If no destination is given, the default is /assets.
OPTIONS OPTIONS
EOF EOF
@ -32,7 +32,7 @@ EOF
AUTHOR AUTHOR
Written by: Written by:
Henrik Levkowetz, <henrik@levkowetz.com> Henrik Levkowetz, <henrik@levkowetz.com>
Lars Eggert, <lars@eggert.org> Lars Eggert, <lars@eggert.org>
COPYRIGHT COPYRIGHT
@ -40,7 +40,7 @@ COPYRIGHT
the code. All rights reserved. Redistribution and use in source and the code. All rights reserved. Redistribution and use in source and
binary forms, with or without modification, is permitted pursuant to, binary forms, with or without modification, is permitted pursuant to,
and subject to the license terms contained in, the Revised BSD and subject to the license terms contained in, the Revised BSD
License set forth in Section 4.c of the IETF Trusts Legal Provisions License set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents(https://trustee.ietf.org/license-info). Relating to IETF Documents(https://trustee.ietf.org/license-info).
EOF EOF
@ -61,52 +61,51 @@ trap 'echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)";
# Option parsing # Option parsing
shortopts=hvV shortopts=hv
args=$(getopt -o$shortopts $*) args=$(getopt -o$shortopts $*)
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
set -- $args set -- $args
while true ; do while true ; do
case "$1" in case "$1" in
-h) usage; exit;; # Show this help, then exit -h) usage; exit;; # Show this help, then exit
-v) VERBOSE=1;; # Be more talkative -v) version; exit;; # Show program version, then exit
-V) version; exit;; # Show program version, then exit --) shift; break;;
--) shift; break;; *) die "Internal error, inconsistent option specification: '$1'";;
*) die "Internal error, inconsistent option specification: '$1'";;
esac esac
shift shift
done done
# The program itself # The program itself
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
DEST_ROOT=data/developers DEST_ROOT=/assets
else else
DEST_ROOT="${1%/}" DEST_ROOT="${1%/}"
fi fi
echo "Using destination $DEST_ROOT" echo "Using destination $DEST_ROOT"
for dir in bofreq; do for dir in bofreq; do
dest="$DEST_ROOT/ietf-ftp/$dir" dest="$DEST_ROOT/ietf-ftp/$dir"
mkdir -p "$dest" mkdir -p "$dest"
echo "Fetching $dest ..." echo "Fetching $dest ..."
rsync -auz ${VERBOSE:+--info=progress2} rsync.ietf.org::$dir/ $dest/ rsync -auz --info=progress2 rsync.ietf.org::$dir/ $dest/
done done
for dir in charter conflict-reviews internet-drafts review rfc slides status-changes yang; do for dir in charter conflict-reviews internet-drafts review rfc slides status-changes yang; do
dest="$DEST_ROOT/ietf-ftp/$dir" dest="$DEST_ROOT/ietf-ftp/$dir"
mkdir -p "$dest" mkdir -p "$dest"
echo "Fetching $dest ..." echo "Fetching $dest ..."
rsync -auz ${VERBOSE:+--info=progress2} rsync.ietf.org::everything-ftp/$dir/ $dest/ rsync -auz --info=progress2 rsync.ietf.org::everything-ftp/$dir/ $dest/
done done
for dir in floor photo; do for dir in floor photo; do
dest="$DEST_ROOT/media/$dir" dest="$DEST_ROOT/media/$dir"
mkdir -p "$dest" mkdir -p "$dest"
echo "Fetching $dest ..." echo "Fetching $dest ..."
rsync -auz ${VERBOSE:+--info=progress2} rsync.ietf.org::dev.media/$dir/ $dest/ rsync -auz --info=progress2 rsync.ietf.org::dev.media/$dir/ $dest/
done done
dest="$DEST_ROOT/archive/id" dest="$DEST_ROOT/archive/id"
mkdir -p "$dest" mkdir -p "$dest"
echo "Fetching $dest ..." echo "Fetching $dest ..."
rsync -auz ${VERBOSE:+--info=progress2} rsync.ietf.org::id-archive/ $dest/ rsync -auz --info=progress2 rsync.ietf.org::id-archive/ $dest/