Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit b54e3777 authored by Diego MENDEZ's avatar Diego MENDEZ
Browse files

Upgrading Netbox to v4.2

parent 0c85082c
No related branches found
No related tags found
No related merge requests found
Pipeline #272001 passed
Pipeline: Netbox Plugins

#272002

    FROM netboxcommunity/netbox:v4.1.6
    FROM netboxcommunity/netbox:v4.2.3
    RUN mkdir /opt/netbox/plugins
    COPY requirements.txt /opt/netbox/plugins
    ......@@ -8,7 +8,10 @@ COPY config/netbox/field_choices.py /etc/netbox/config/field_choices.py
    COPY config/netbox/entrypoint.sh /usr/bin/netbox_plugin_entrypoint.sh
    COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
    RUN pip install -r /opt/netbox/plugins/requirements.txt
    RUN /opt/netbox/venv/bin/python3 -V
    RUN /usr/local/bin/uv pip --version
    # This command will use venv from /opt/netbox/venv, 'taken from https://github.com/netbox-community/netbox-docker/blob/release/Dockerfile'
    RUN /usr/local/bin/uv pip install -r /opt/netbox/plugins/requirements.txt
    RUN rm -rf /opt/netbox/plugins
    CMD ["/usr/bin/netbox_plugin_entrypoint.sh"]
    ......@@ -16,16 +16,44 @@ migrate_func () {
    # Check if update is needed
    if ! ./manage.py migrate --check >/dev/null 2>&1; then
    echo "⚙️ Applying database migrations"
    ./manage.py migrate --no-input
    echo "⚙️ Running trace_paths"
    ./manage.py trace_paths --no-input
    echo "⚙️ Removing stale content types"
    ./manage.py remove_stale_contenttypes --no-input
    echo "⚙️ Removing expired user sessions"
    ./manage.py clearsessions
    echo "⚙️ Building search index (lazy)"
    ./manage.py reindex --lazy
    ########################################################################################
    # Piece of code borrowed from netbox official `https://github.com/netbox-community/netbox/blob/main/upgrade.sh` script.
    ########################################################################################
    # Apply any database migrations
    COMMAND="python3 ./manage.py migrate --no-input"
    echo "⚙️ Applying database migrations ($COMMAND)..."
    eval $COMMAND || exit 1
    # Trace any missing cable paths (not typically needed)
    COMMAND="python3 ./manage.py trace_paths --no-input"
    echo "⚙️ Checking for missing cable paths ($COMMAND)..."
    eval $COMMAND || exit 1
    # Build the local documentation
    #COMMAND="mkdocs build"
    #echo "⚙️ Building documentation ($COMMAND)..."
    #eval $COMMAND || exit 1
    # Collect static files
    COMMAND="python3 ./manage.py collectstatic --no-input"
    echo "⚙️ Collecting static files ($COMMAND)..."
    eval $COMMAND || exit 1
    # Delete any stale content types
    COMMAND="python3 ./manage.py remove_stale_contenttypes --no-input"
    echo "⚙️ Removing stale content types ($COMMAND)..."
    eval $COMMAND || exit 1
    # Rebuild the search cache (lazily)
    COMMAND="python3 ./manage.py reindex --lazy"
    echo "⚙️ Rebuilding search cache ($COMMAND)..."
    eval $COMMAND || exit 1
    # Delete any expired user sessions
    COMMAND="python3 ./manage.py clearsessions"
    echo "⚙️ Removing expired user sessions ($COMMAND)..."
    eval $COMMAND || exit 1
    fi
    }
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment