Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dadokkio committed May 18, 2020
0 parents commit a95ad43
Show file tree
Hide file tree
Showing 170 changed files with 4,665 additions and 0 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LDO-CERT
10 changes: 10 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

The MIT License (MIT)
Copyright (c) 2020, LDO-CERT

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

111 changes: 111 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
orochi
======

Orochi - the volatility collaborative gui

.. image:: https://img.shields.io/badge/built%20with-Cookiecutter%20Django-ff69b4.svg
:target: https://github.com/pydanny/cookiecutter-django/
:alt: Built with Cookiecutter Django
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/ambv/black
:alt: Black code style


:License: MIT


Settings
--------

Moved to settings_.

.. _settings: http://cookiecutter-django.readthedocs.io/en/latest/settings.html

Basic Commands
--------------

Setting Up Your Users
^^^^^^^^^^^^^^^^^^^^^

* To create a **normal user account**, just go to Sign Up and fill out the form. Once you submit it, you'll see a "Verify Your E-mail Address" page. Go to your console to see a simulated email verification message. Copy the link into your browser. Now the user's email should be verified and ready to go.

* To create an **superuser account**, use this command::

$ python manage.py createsuperuser

For convenience, you can keep your normal user logged in on Chrome and your superuser logged in on Firefox (or similar), so that you can see how the site behaves for both kinds of users.

Type checks
^^^^^^^^^^^

Running type checks with mypy:

::

$ mypy orochi

Test coverage
^^^^^^^^^^^^^

To run the tests, check your test coverage, and generate an HTML coverage report::

$ coverage run -m pytest
$ coverage html
$ open htmlcov/index.html

Running tests with py.test
~~~~~~~~~~~~~~~~~~~~~~~~~~

::

$ pytest

Live reloading and Sass CSS compilation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Moved to `Live reloading and SASS compilation`_.

.. _`Live reloading and SASS compilation`: http://cookiecutter-django.readthedocs.io/en/latest/live-reloading-and-sass-compilation.html




Email Server
^^^^^^^^^^^^

In development, it is often nice to be able to see emails that are being sent from your application. For that reason local SMTP server `MailHog`_ with a web interface is available as docker container.

Container mailhog will start automatically when you will run all docker containers.
Please check `cookiecutter-django Docker documentation`_ for more details how to start all containers.

With MailHog running, to view messages that are sent by your application, open your browser and go to ``http://127.0.0.1:8025``

.. _mailhog: https://github.com/mailhog/MailHog



Sentry
^^^^^^

Sentry is an error logging aggregator service. You can sign up for a free account at https://sentry.io/signup/?code=cookiecutter or download and host it yourself.
The system is setup with reasonable defaults, including 404 logging and integration with the WSGI application.

You must set the DSN url in production.


Deployment
----------

The following details how to deploy this application.



Docker
^^^^^^

See detailed `cookiecutter-django Docker documentation`_.

.. _`cookiecutter-django Docker documentation`: http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html



58 changes: 58 additions & 0 deletions compose/local/dask/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
FROM continuumio/miniconda3:4.7.12

RUN conda install --yes \
-c conda-forge \
python==3.8 \
python-blosc \
cytoolz \
dask==2.16.0 \
lz4 \
nomkl \
numpy==1.18.1 \
pandas==1.0.1 \
tini==0.18.0 \
&& conda clean -tipsy \
&& find /opt/conda/ -type f,l -name '*.a' -delete \
&& find /opt/conda/ -type f,l -name '*.pyc' -delete \
&& find /opt/conda/ -type f,l -name '*.js.map' -delete \
&& find /opt/conda/lib/python*/site-packages/bokeh/server/static -type f,l -name '*.js' -not -name '*.min.js' -delete \
&& rm -rf /opt/conda/pkgs

RUN apt-get update \
# dependencies for building Python packages
&& apt-get install -y build-essential \
# ldap support
&& apt-get install -y libsasl2-dev libldap2-dev libssl-dev \
# git for cloning
&& apt-get install -y git curl unzip \
# psycopg2 dependencies
&& apt-get install -y libpq-dev \
# Translations dependencies
&& apt-get install -y gettext \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir /opt/app
# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
RUN pip install -r /requirements/local.txt

RUN curl -Lo /tmp/windows.zip https://downloads.volatilityfoundation.org/volatility3/symbols/windows.zip && \
unzip /tmp/windows.zip -d /src/volatility/volatility/symbols/ && \
rm /tmp/windows.zip

RUN curl -Lo /tmp/mac.zip https://downloads.volatilityfoundation.org/volatility3/symbols/mac.zip && \
unzip /tmp/mac.zip -d /src/volatility/volatility/symbols/ && \
rm /tmp/mac.zip

RUN curl -Lo /tmp/linux.zip https://downloads.volatilityfoundation.org/volatility3/symbols/linux.zip && \
unzip /tmp/linux.zip -d /src/volatility/volatility/symbols/ && \
rm /tmp/linux.zip

COPY ./compose/local/dask/prepare.sh /usr/bin/prepare.sh
RUN chmod +x /usr/bin/prepare.sh

WORKDIR /opt/app

ENTRYPOINT ["tini", "-g", "--", "/usr/bin/prepare.sh"]
30 changes: 30 additions & 0 deletions compose/local/dask/prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -x

# We start by adding extra apt packages, since pip modules may required library
if [ "$EXTRA_APT_PACKAGES" ]; then
echo "EXTRA_APT_PACKAGES environment variable found. Installing."
apt update -y
apt install -y $EXTRA_APT_PACKAGES
fi

if [ -e "/opt/app/environment.yml" ]; then
echo "environment.yml found. Installing packages"
/opt/conda/bin/conda env update -f /opt/app/environment.yml
else
echo "no environment.yml"
fi

if [ "$EXTRA_CONDA_PACKAGES" ]; then
echo "EXTRA_CONDA_PACKAGES environment variable found. Installing."
/opt/conda/bin/conda install -y $EXTRA_CONDA_PACKAGES
fi

if [ "$EXTRA_PIP_PACKAGES" ]; then
echo "EXTRA_PIP_PACKAGES environment variable found. Installing".
/opt/conda/bin/pip install $EXTRA_PIP_PACKAGES
fi

# Run extra commands
exec "$@"
47 changes: 47 additions & 0 deletions compose/local/django/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM python:3.8-slim-buster

ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1

RUN apt-get update \
# dependencies for building Python packages
&& apt-get install -y build-essential \
# ldap support
&& apt-get install -y libsasl2-dev libldap2-dev libssl-dev \
# git for cloning
&& apt-get install -y git curl unzip \
# psycopg2 dependencies
&& apt-get install -y libpq-dev \
# Translations dependencies
&& apt-get install -y gettext \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*

# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
RUN pip install -r /requirements/local.txt

RUN curl -Lo /tmp/windows.zip https://downloads.volatilityfoundation.org/volatility3/symbols/windows.zip && \
unzip /tmp/windows.zip -d /src/volatility/volatility/symbols/ && \
rm /tmp/windows.zip

RUN curl -Lo /tmp/mac.zip https://downloads.volatilityfoundation.org/volatility3/symbols/mac.zip && \
unzip /tmp/mac.zip -d /src/volatility/volatility/symbols/ && \
rm /tmp/mac.zip

RUN curl -Lo /tmp/linux.zip https://downloads.volatilityfoundation.org/volatility3/symbols/linux.zip && \
unzip /tmp/linux.zip -d /src/volatility/volatility/symbols/ && \
rm /tmp/linux.zip

COPY ./compose/production/django/entrypoint /entrypoint
RUN sed -i 's/\r$//g' /entrypoint
RUN chmod +x /entrypoint

COPY ./compose/local/django/start /start
RUN sed -i 's/\r$//g' /start
RUN chmod +x /start

WORKDIR /app

ENTRYPOINT ["/entrypoint"]
9 changes: 9 additions & 0 deletions compose/local/django/start
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -o errexit
set -o pipefail
set -o nounset


python manage.py migrate
uvicorn config.asgi:application --host 0.0.0.0 --reload
9 changes: 9 additions & 0 deletions compose/local/node/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:10-stretch-slim

WORKDIR /app

COPY ./package.json /app

RUN npm install && npm cache clean --force

ENV PATH ./node_modules/.bin/:$PATH
26 changes: 26 additions & 0 deletions compose/production/dask/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM continuumio/miniconda3:4.7.12

RUN conda install --yes \
-c conda-forge \
python-blosc \
cytoolz \
dask==2.16.0 \
lz4 \
nomkl \
numpy==1.18.1 \
pandas==1.0.1 \
tini==0.18.0 \
&& conda clean -tipsy \
&& find /opt/conda/ -type f,l -name '*.a' -delete \
&& find /opt/conda/ -type f,l -name '*.pyc' -delete \
&& find /opt/conda/ -type f,l -name '*.js.map' -delete \
&& find /opt/conda/lib/python*/site-packages/bokeh/server/static -type f,l -name '*.js' -not -name '*.min.js' -delete \
&& rm -rf /opt/conda/pkgs

COPY prepare.sh /usr/bin/prepare.sh

RUN chmod +x /usr/bin/prepare.sh

RUN mkdir /opt/app

ENTRYPOINT ["tini", "-g", "--", "/usr/bin/prepare.sh"]
30 changes: 30 additions & 0 deletions compose/production/dask/prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -x

# We start by adding extra apt packages, since pip modules may required library
if [ "$EXTRA_APT_PACKAGES" ]; then
echo "EXTRA_APT_PACKAGES environment variable found. Installing."
apt update -y
apt install -y $EXTRA_APT_PACKAGES
fi

if [ -e "/opt/app/environment.yml" ]; then
echo "environment.yml found. Installing packages"
/opt/conda/bin/conda env update -f /opt/app/environment.yml
else
echo "no environment.yml"
fi

if [ "$EXTRA_CONDA_PACKAGES" ]; then
echo "EXTRA_CONDA_PACKAGES environment variable found. Installing."
/opt/conda/bin/conda install -y $EXTRA_CONDA_PACKAGES
fi

if [ "$EXTRA_PIP_PACKAGES" ]; then
echo "EXTRA_PIP_PACKAGES environment variable found. Installing".
/opt/conda/bin/pip install $EXTRA_PIP_PACKAGES
fi

# Run extra commands
exec "$@"
49 changes: 49 additions & 0 deletions compose/production/django/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM node:10-stretch-slim as client-builder

WORKDIR /app
COPY ./package.json /app
RUN npm install && npm cache clean --force
COPY . /app
RUN npm run build

# Python build stage
FROM python:3.8-slim-buster

ENV PYTHONUNBUFFERED 1

RUN apt-get update \
# dependencies for building Python packages
&& apt-get install -y build-essential \
# ldap support
&& apt-get install -y libsasl2-dev libldap2-dev libssl-dev \
# git for cloning
&& apt-get install -y git curl unzip \
# psycopg2 dependencies
&& apt-get install -y libpq-dev \
# Translations dependencies
&& apt-get install -y gettext \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*

RUN addgroup --system django \
&& adduser --system --ingroup django django

# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements

COPY ./compose/production/django/entrypoint /entrypoint
RUN sed -i 's/\r$//g' /entrypoint
RUN chmod +x /entrypoint
RUN chown django /entrypoint

COPY ./compose/production/django/start /start
RUN sed -i 's/\r$//g' /start
RUN chmod +x /start
RUN chown django /start

USER django

WORKDIR /app

ENTRYPOINT ["/entrypoint"]
Loading

0 comments on commit a95ad43

Please sign in to comment.