Skip to content

Commit

Permalink
merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
silenus092 committed May 10, 2023
2 parents fa4a651 + 03ef30c commit 295a44d
Show file tree
Hide file tree
Showing 90 changed files with 32,153 additions and 10,598 deletions.
4 changes: 4 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ DB_URL="https://super_user:123456@localhost:3306/mpx"

## When using SQLite, this is the path to the DB file.
# DB_URL=data/db.sqlite3

REDIS_URL="redis://127.0.0.1:6379"
REDIS_DB_BROKER="1"
REDIS_DB_BACKEND="1"
35 changes: 35 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CD process
on:
push:
branches:
- dev
jobs:

deploy:
name: Deploy
environment: PROD
runs-on: ubuntu-latest
steps:
- name: Executing remote ssh commands using ssh key
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
port: 22
script: |
cd /opt/MpoxRadar/
sudo git checkout dev
sudo git pull
- name: Restart the application after deployment
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
port: 22
script: |
sudo mpoxradar.reload\&restart.everything.sh
56 changes: 56 additions & 0 deletions .github/workflows/CI.yml.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# .github/workflows/tests.yml
name: CI-CD process
on: push
jobs:
continuous-integration:
runs-on: ubuntu-latest
env:
DB_DATABASE: mpx
DB_USERNAME: root
DB_PASSWORD: password
DB_HOST: 127.0.0.1
DB_PORT: 3306
REDIS_PORT: 6379
BROADCAST_DRIVER: log
CACHE_DRIVER: redis
QUEUE_CONNECTION: redis
SESSION_DRIVER: redis
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: mpx
services:
mariadb:
image: mariadb:10.11
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.10
architecture: x64

- uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.10
mamba-version: "*"
activate-environment: covsonar
channels: conda-forge,bioconda,defaults
channel-priority: true

# mariadb
- uses: shogo82148/actions-setup-mysql@v1
with:
distribution: 'mariadb'
mysql-version: '10.11'
user: "user-test"
password: "123456"

# redis-server
- uses: shogo82148/actions-setup-mysql@v1
with:
distribution: 'mariadb'
mysql-version: '10.11'
user: "user-test"
password: "123456"

- run: pip install poetry
- run: poetry install
65 changes: 65 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# .github/workflows/tests.yml
name: Test-format-flake8
on:
pull_request:
push:
branches:
- main
- dev
jobs:
testing:
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
mariadb:
image: mariadb:10.11
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: mpx_test_04
MYSQL_USER: test_user
MYSQL_PASSWORD: test_password
ports:
- 3306:3306
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install dependencies
run: |
sudo apt install libmariadb3 libmariadb-dev
pip install poetry
- name: Poetry install env.
run: poetry install
- name: Load database
run: |
mysql --protocol=tcp -h localhost --user=root --password=password -e "CREATE DATABASE IF NOT EXISTS mpx_test_04;"
mysql --protocol=tcp -h localhost --user=root --password=password -e "GRANT ALL PRIVILEGES ON mpx_test_04.* TO 'test_user'@'%' IDENTIFIED BY 'test_password';"
mysql --protocol=tcp -h localhost --user=root --password=password mpx_test_04 < tests/sql_dumps/mpx_test_04.sql
mysql --protocol=tcp -h localhost --user=root --password=password -e "use mpx_test_04; SHOW TABLES;"
- name: Run pytest
env:
DB_URL: "https://test_user:[email protected]:3306/mpx_test_04"
REDIS_URL: "redis://127.0.0.1:6379"
REDIS_DB_BROKER: 1
REDIS_DB_BACKEND: 1
DEBUG: True
LOG_LEVEL: "DEBUG"
run: poetry run pytest -rfeP -x tests/
format-checker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install dependencies
run: pip install flake8 poetry
- name: Run flake8 - Code style check
run: poetry run flake8 . --config=.flake8 -v
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,7 @@ dmypy.json

# Pyre type checker
.pyre/

.DS_Store
.idea
dump.rdb
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ repos:
exclude: ^libs/
- repo: local
hooks:
- id: zimports
name: zimports
entry: poetry run zimports -m pages,tests
language: system
types: [python]
exclude: ^pages/libs/
- id: black
name: black
entry: poetry run black pages
Expand All @@ -30,3 +24,9 @@ repos:
language: system
types: [python]
exclude: ^pages/libs/
- id: zimports
name: zimports
entry: poetry run zimports -m pages,tests
language: system
types: [python]
exclude: ^pages/libs/
13 changes: 7 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
git checkout dev
git pull
```

2. Please consider setting a variable in the .env file and use config.py to load the environment variable.
Sometimes we don't need to update MPXSonar code for all query purposes; if some functions are not related to MPXSonar or some query can easily be implemented, please use DB manager (interface) to communicate to the database instance.
Sometimes we don't need to update MPoxSonar code for all query purposes; if some functions are not related to MPoxSonar or some query can easily be implemented, please use DB manager (interface class) to communicate to the database instance.

## If you don't install dependencies yet

Expand All @@ -31,15 +32,15 @@ you have to fix it manually according to the error message; otherwise, you will
When you're finished with the changes, create a pull request, also known as a PR.
+ Don't forget to link PR to the issue if you are solving one.

# Add/Update MPXsonar
# Add/Update MPoxSonar

## First time add MPXsonar
Add MPXsonar repository into this respository like
## First time add MPoxSonar
Add MPoxSonar repository into this respository like
```
git subtree add --prefix pages/libs/mpxsonar https://github.com/rki-mf1/MpoxSonar dev --squash
```

## Pull new MPXsonar commits
## Pull new MPoxSonar commits
Pull any new updates to the subtree from the remote.
```
git subtree pull --prefix pages/libs/mpxsonar https://github.com/rki-mf1/MpoxSonar dev --squash
Expand All @@ -51,4 +52,4 @@ If you make a change to anything in subtree the commit will be stored in the MPX
git subtree push --prefix pages/libs/mpxsonar https://github.com/rki-mf1/MpoxSonar dev
```

Note: Normally, we don't update the MPXsonar from the MPXRadar-frontend site, but it can happen occasionally. Hence, please consider updating the code from MPXsonar and then using `subtree pull` to update the code.
Note: Normally, we don't update the MPoxSonar from the MPoxRadar frontend site, but it can happen occasionally. Hence, please consider updating the code from MPoxSonar and then using `subtree pull` to update the code.
Loading

0 comments on commit 295a44d

Please sign in to comment.