Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imp/Merge existing pull requests #213

Merged
merged 99 commits into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
2794c36
restrict uploader access through external url
Mar 17, 2021
3af2355
fix code style checks
Mar 17, 2021
0793301
add tests to single mode application features
Mar 17, 2021
567b061
fix code style checks
Mar 17, 2021
5983b8b
add new tests configs to tox.ini
Mar 17, 2021
287f6fe
bump python version on github checks
Mar 17, 2021
827f5fc
bump dev requirements
Mar 17, 2021
88d38d5
add readme to tests and make the test workflow more friendly
Mar 17, 2021
15c54ee
remove docker-init from superset
Jul 15, 2021
3e5ec04
upgrade box plot plugin
Jul 15, 2021
37caf39
remove code checks on superset's docker-init
Jul 15, 2021
586f6e9
remove old description + image of dashboard_viewer
Jul 16, 2021
2b61f92
add first docs
Jul 16, 2021
ebcabc3
correct index of docs
Jul 16, 2021
f976ab5
bump requirements + pip-compile
Apr 9, 2021
e57ceaf
fix failling tests
Apr 9, 2021
8c16cd2
only need for one migrate command
Apr 9, 2021
eafba61
fix media files problems
Apr 9, 2021
66fced1
change to new way of getting model's field name
Apr 9, 2021
d55da57
upgrade requirements
Jul 21, 2021
9360508
add new django 3.2 setting
Jul 21, 2021
71f6b61
achilles results dist columns to float
Jun 9, 2021
ce14001
fix isort code checks
Jun 9, 2021
000410d
' -> "
Jul 21, 2021
5730eb7
also change fields of archive table
Jul 21, 2021
cf6c82d
fix timout on refresh of multiple mat views
Jul 23, 2021
6139584
bold important notes
Jul 26, 2021
261acfa
Update processes.md
Jul 26, 2021
1458f7a
add files of gh-pages branch
Aug 2, 2021
d08192a
add processes + change sections levels
Aug 2, 2021
dfca196
Refer to documentation - installation
Aug 3, 2021
790254d
Update with dev
Aug 3, 2021
a368d9d
Move backups docs to gitbook
Aug 3, 2021
aba81b2
add new sections
Aug 3, 2021
98a79bc
deprecate unused dashboards
Aug 3, 2021
ad5cc64
move some sections up so they dont get hidden
Aug 3, 2021
45d3c3d
Merge branch 'dev' into imp/docs
Aug 3, 2021
b339895
processes/tabs manager
Aug 3, 2021
0d2b2d2
customizations
Aug 3, 2021
430a457
remove old readme
Aug 3, 2021
bdc1986
Processes/data source/draft status
Aug 3, 2021
b5f06b9
progress on development instructions
Aug 3, 2021
6acf0d1
documentation section of developent chapter
Aug 4, 2021
bc59e11
development/github actions
Aug 4, 2021
213b76c
add intellij config files
Aug 4, 2021
472023e
development/superset
Aug 4, 2021
e1c2c18
fix tests docker-compose stack + github workflow
Aug 4, 2021
aca7a06
developer/tests
Aug 4, 2021
8456f0b
code doc/tabs manager
Aug 4, 2021
ed7a7d9
code/materializedqueries
Aug 5, 2021
1084015
code/uploader
Aug 5, 2021
29457f1
progress on dashboards
Aug 5, 2021
346b79c
dashboards/network dashboard
Aug 6, 2021
001d543
dashboards/database level
Aug 6, 2021
aed96e7
simplify docs build script
Aug 6, 2021
34e7efa
fix uploader models
Aug 10, 2021
aa0d295
update main presets
Aug 12, 2021
159bf9d
add workflows to test docker build + publish
Aug 12, 2021
f99a5e3
fetch superset submodule
Aug 12, 2021
c2123d9
upgrade to 1.3
Aug 23, 2021
29ecf8d
Merge branch 'dev' into imp/bump_superset_to_1.3
Aug 24, 2021
180fb34
Update requirements.in
Sep 8, 2021
0f6a087
Update requirements.txt
Sep 13, 2021
7c66f54
fix code style checks
Sep 13, 2021
a7d61f5
fix black check
Sep 13, 2021
a8ca278
bump to 1.3.1
Sep 29, 2021
1a7ca4a
superset: bump to 1.3.2
Oct 21, 2021
fce58da
backups: improve organization to comply to changes on montra
Nov 4, 2021
f06cbca
github actions: publish docker on release instead of master push
Nov 4, 2021
7acd2da
Delete dashboard_viewer/.idea directory
Nov 22, 2021
8d44c4e
Merge dev into imp/docs
Nov 30, 2021
933d03b
update docs build output + README
Nov 30, 2021
b5ebc2f
remove duplicate pandoc
Nov 30, 2021
ac896f6
Merge dev into imp/bump_superset_to_1.3
Nov 30, 2021
1784da2
Merge dev into imp/restrict-uploader-access
Dec 20, 2021
bb29bd5
Merge imp/django3.2 into imp/big_deploy
Dec 20, 2021
9757fb0
Merge fix/decimal_columns_with_bigint_to_float into imp/big_deploy
Dec 20, 2021
7f97525
Merge fix/timeout_on_matviews_refresh into imp/big_deploy
Dec 20, 2021
1e197ff
Merge imp/docs into imp/big_deploy
Dec 20, 2021
cf48fba
Merge fix/code_style_checks into imp/big_deploy
Dec 20, 2021
1ede4aa
Merge fix/backups into imp/big_deploy
Dec 20, 2021
36a2726
fix code style checks
Dec 20, 2021
d80d11a
fix csrf protection bug
Dec 20, 2021
7f4e732
Merge dev into imp/automate_docker_images
Dec 20, 2021
53214ff
Merge imp/automate_docker_images into imp/big_deploy
Dec 20, 2021
c415496
fix superset docker image build
Dec 20, 2021
1d58083
fix publish workflow
Dec 21, 2021
8352358
upgrade python packages + version
Dec 21, 2021
30cbff8
add missing package-lock.json file
Dec 21, 2021
e191023
fix exposing achilles files publically
Dec 21, 2021
0046b30
fix prospector checks
Dec 21, 2021
3bce152
fix kwargs to serve
Dec 21, 2021
5b327bf
add code to create shared links for backups
Jan 3, 2022
d9c0c5d
Merge imp/bump_superset_to_1.3 into imp/big_deploy
Jan 4, 2022
6af490e
no need to specify specific application on migrate command
Jan 4, 2022
1157c79
no need to specify superset dockerfile now
Jan 4, 2022
25850dd
no need to specify dockerfile on supeset build test
Jan 4, 2022
646245d
actually fix the timeout problem of materialized views
Jan 4, 2022
356efc8
increase nginx max body size
Jan 4, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 3 additions & 4 deletions .github/workflows/code_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
pythonversion: [3.7]
pythonversion: [3.9]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
pythonversion: [3.7]
pythonversion: [3.9]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
pythonversion: [3.7]
pythonversion: [3.9]

steps:
- uses: actions/checkout@v2
Expand All @@ -88,4 +88,3 @@ jobs:
- name: prospector
run: |
prospector dashboard_viewer
prospector docker/superset
62 changes: 62 additions & 0 deletions .github/workflows/publish_docker_images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build & Publish Docker Images

on:
release:
types: [published]

jobs:
dashboards:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Extract metadata
id: meta
uses: docker/metadata-action@v3
with:
images: aspedrosa/networkdashboards
tags: |
type=pep440,pattern={{version}}

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: dashboard_viewer
push: true
tags: ${{ steps.meta.outputs.tags }}

superset:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
with:
submodules: true

- name: Extract metadata
id: meta
uses: docker/metadata-action@v3
with:
images: aspedrosa/networkdashboards_superset
tags: |
type=pep440,pattern={{version}}

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: superset
push: true
tags: ${{ steps.meta.outputs.tags }}
50 changes: 50 additions & 0 deletions .github/workflows/test_docker_images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Test Build Docker Images

on:
pull_request:
branches: [ dev ]

jobs:
# JOB to run change detection
changes:
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
dashboards: ${{ steps.filter.outputs.dashboards }}
superset: ${{ steps.filter.outputs.superset }}
steps:
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
dashboards:
- 'dashboard_viewer/**'
superset:
- 'superset/**'

dashboards:
needs: changes
if: ${{ needs.changes.outputs.dashboards == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Test build
run: |
docker build dashboard_viewer

superset:
needs: changes
if: ${{ needs.changes.outputs.superset == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
with:
submodules: true

- name: Test build
run: |
docker build superset
12 changes: 5 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
pythonversion: [3.7]
pythonversion: [3.9]

steps:
- uses: actions/checkout@v2
Expand All @@ -27,10 +27,8 @@ jobs:
${{ runner.os }}-pip-
- name: Setup Data Containers
run: |
export $(grep -v '^#' tests/.env | xargs -d '\n')
cp tests/docker-compose.yml docker
cp tests/init-dbs.sh docker/postgres-entrypoint
cd docker
cd tests
export $(grep -v '^#' .env | xargs -d '\n')
docker-compose up -d
- name: Install Dependencies
run: |
Expand All @@ -40,5 +38,5 @@ jobs:
run: |
export $(grep -v '^#' tests/.env | xargs -d '\n')
cd dashboard_viewer
python manage.py migrate
python manage.py test
python manage.py test --exclude-tag third-party-app
SINGLE_APPLICATION_MODE=n MAIN_APPLICATION_HOST=mainapp.host.com python manage.py test --tag third-party-app
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# documentation temporary files
docs/src/_book

# dashboard_viewer django app ERRORs logs
logs

Expand Down
111 changes: 111 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
[MESSAGES CONTROL]

# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once). You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=unnecessary-semicolon,
superfluous-parens,
bad-mcs-classmethod-argument,
too-many-lines,
bad-whitespace,
I0014,
relative-import,
E1103,
C0322,
fixme,
too-many-instance-attributes,
no-init,
C0323,
trailing-whitespace,
property-on-old-class,
too-few-public-methods,
invalid-name,
exec-used,
assignment-from-none,
C0324,
abstract-class-little-used,
pointless-except,
redefined-outer-name,
star-args,
missing-final-newline,
bad-mcs-method-argument,
empty-docstring,
no-name-in-module,
global-variable-undefined,
too-many-return-statements,
W0701,
bad-builtin,
W5103,
deprecated-lambda,
abstract-method,
no-member,
unused-format-string-key,
no-self-use,
wildcard-import,
too-many-public-methods,
broad-except,
bad-classmethod-argument,
bad-continuation,
attribute-defined-outside-init,
W0713,
ungrouped-imports,
anomalous-backslash-in-string,
too-many-ancestors,
wrong-import-order,
multiple-statements,
missing-docstring,
no-self-argument,
global-statement,
super-init-not-called,
raise-missing-from,
protected-access,
invalid-str-returned,
invalid-repr-returned,

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
enable=


[FORMAT]

# Maximum number of characters on a single line.
max-line-length=159

# Maximum number of lines in a module.
max-module-lines=1000


[DESIGN]

# Maximum number of attributes for a class (see R0902).
max-attributes=7

# Maximum number of branch for function / method body.
max-branches=15

# Maximum number of locals for function / method body.
max-locals=15

# Maximum number of parents for a class (see R0901).
max-parents=7

# Maximum number of public methods for a class (see R0904).
max-public-methods=20

# Maximum number of return / yield for function / method body.
max-returns=6

# Maximum number of statements in function / method body.
max-statements=60

# Minimum number of public methods for a class (see R0903).
min-public-methods=1
99 changes: 1 addition & 98 deletions backups/README.md
Original file line number Diff line number Diff line change
@@ -1,100 +1,3 @@
# Backup

1. Create a credentials file (the structure of the file depends on the target cloud server)

2. Create a `.dashboards_backups.conf` file under your home directory (variable `$HOME`) using `dashboards_backups.conf.example` as base, setting the appropriate value for the several variables.

For variables associated with files and directories always use *absolute* paths.

Variables:

- `RUN`: Set it to `0` if you don't want the next scheduled backup to run.

This variable allows you to cancel any backup runs while you are doing some maintenance on the application.

- `CONSTANCE_REDIS_DB`: Number of the Redis database where the django constance config is stored. The default value is 2. This value should be the same as the environment variable `REDIS_CONSTANCE_DB` of the dashboard container.

- The following variables are associated with the arguemtns of the `backup_uploader` python package. Check its [usage](https://github.com/aspedrosa/BackupUploader#usage) for more details:

- `APP_NAME`: The backup process will generate some directories with this name in places that are shared with other applications.

- `SERVER`: The name of the target cloud server to where backups should be uploaded (dropbox or mega).

- `BACKUP_CHAIN_CONFIG`: Allows having different directories with backups of different ages.

- `CREDENTIALS_FILE_PATH`: File containing the credentials to access the server to upload the backup file.

3. Install the `backup_uploader` python package by following its [install](https://github.com/aspedrosa/BackupUploader#install) instructions.

4. Schedule your backups

```sh
* * * * * Command_to_execute
| | | | |
| | | | Day of the Week ( 0 - 6 ) ( Sunday = 0 )
| | | |
| | | Month ( 1 - 12 )
| | |
| | Day of Month ( 1 - 31 )
| |
| Hour ( 0 - 23 )
|
Min ( 0 - 59 )
```

(Retrived from: [Tutorialspoint](https://www.tutorialspoint.com/unix_commands/crontab.htm))

Ex: To run every day at 3:00 am

1. `crontab -e`

2. Add entry `0 3 * * * $HOME/NetworkDashboards/backups/backup.sh` (The path to the backup script might be different)

### Restore

1. Select the compressed backup you want to restore and decompress it:

`tar -xJf BACKUP_FILE.tar.xz`.

2. 1. **Redis**

1. Make sure the redis docker container is down.

2. (Re)place the file `dump.rdb` on the redis volume by the file `redis.rdb`. By default the redis volume is located where this repository was cloned on the directory `docker/volumes/redis`.

3. Change its permissions, owner and group:

```shell
chmod 0644 docker/volumes/redis/dump.rdb
sudo chown -R 999:999 docker/volumes/redis
```

2. **Postgres**

1. Make sure all containers that make changes on the database are stopped.

2. Copy the file `postgres_backup.sql` into the postgres container

`docker cp postgres.sql [CONTAINER_ID]:/tmp`.

5. Execute the backup script:

`docker exec -u root dashboard_viewer_postgres_1 psql -f /tmp/postgres_backup.sql -U \$POSTGRES_USER -d \$POSTGRES_DB`.

3. **Media Files** If you have a volume pointing to where the media files are stored, replace all files with the ones present on the downloaded backup file. Else:

1. Bring the dashoard container up `docker-compose up -d dashboard`

2. Enter in the container `docker exec -it [CONTAINER_ID] bash`

3. If you don't know where the media files are stored you can check the value of the MEDIA_ROOT variable

1. `python manage.py shell`

2. `from django.conf import settings`

3. `print(settings.MEDIA_ROOT)`

4. Remove the entire MEDIA_ROOT directory and exit the container

5. Copy the media directory present on the backup file to the catalogue container `docker cp -a collected-media [CONTAINER_ID]:[MEDIA_ROOT_PARENT_PATH]`
Refer to the [Backups](https://ehden.github.io/NetworkDashboards/backups.html) chapter of the documentation
Loading