Skip to content

Commit

Permalink
✨ Clean up and simplify config management (#320)
Browse files Browse the repository at this point in the history
* Removed ide (IDE installation instructions already in docs/Getting_Started.md)

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>

* Moved Notes.md and ROADMAP.md to docs

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>

* Changed project to use pyproject.toml

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>

* Updated how config is handled

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>

* Reverted ROADMAP.md changes

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>

* Fixed CONTRIBUTING.md with pyproject.toml and compose.yaml

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>

* Fixed documentation

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>

* Updated how config priority is done

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>

* Fixed nits

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>

* Fixed more nits

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>

* Fixed more nits

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>

* Swapped back kai copying

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>

* Fixed trunk check errors

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>

* Fixed bugs with load-data

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>

* Fixed more bugs

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>

---------

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>
  • Loading branch information
JonahSussman committed Aug 30, 2024
1 parent 4e230b3 commit 1e0252c
Show file tree
Hide file tree
Showing 45 changed files with 717 additions and 421 deletions.
168 changes: 168 additions & 0 deletions .containerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# --- Project-specific ---

debug
.vscode/
logs
.DS_Store

# --- Python ---

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
20 changes: 10 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# --- Project-specific ---

debug
.vscode/
logs
.DS_Store

# --- Python ---

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -156,13 +165,4 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/


debug

.vscode/

logs

.DS_Store
#.idea/
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ See [docs/contrib/Dev_Environment.md](docs/contrib/Dev_Environment.md)
If you need to add or update a Python dependency in the project, follow these steps:

1. **Add the dependency**:
Open `requirements.in` and add the new dependency or modify an existing one.
Open `pyproject.toml` and add the new dependency to the `dependencies` list or modify an existing one.

2. **Compile the requirements**:
Run the following commands to compile the dependencies and update the `requirements.txt` file:
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CWD := $(shell pwd)
KAI_PYTHON_PATH="$(CWD)/kai:$(PYTHONPATH)"
LOGLEVEL ?= info
NUM_WORKERS ?= 8
DEMO_MODE ?= False
KAI__DEMO_MODE ?= False
DROP_TABLES ?= False
HUB_URL ?= ""
IMPORTER_ARGS ?= ""
Expand All @@ -14,10 +14,10 @@ run-postgres:
$(CONTAINER_RUNTIME) run -it $(POSTGRES_RUN_ARGS) -v data:/var/lib/postgresql/data -e POSTGRES_USER=kai -e POSTGRES_PASSWORD=dog8code -e POSTGRES_DB=kai -p 5432:5432 docker.io/library/postgres:16.3

run-server:
PYTHONPATH=$(KAI_PYTHON_PATH) LOGLEVEL=$(LOGLEVEL) DEMO_MODE=$(DEMO_MODE) gunicorn --timeout 3600 -w $(NUM_WORKERS) --bind localhost:8080 --worker-class aiohttp.GunicornWebWorker 'kai.server:app()'
PYTHONPATH=$(KAI_PYTHON_PATH) python kai/server.py

run-konveyor-importer:
PYTHONPATH=$(KAI_PYTHON_PATH) python ./kai/hub_importer.py --loglevel ${LOGLEVEL} --config_filepath ./kai/config.toml ${IMPORTER_ARGS} ${HUB_URL}
PYTHONPATH=$(KAI_PYTHON_PATH) python kai/hub_importer.py --loglevel ${LOGLEVEL} --config_filepath ./kai/config.toml ${IMPORTER_ARGS} ${HUB_URL}

load-data:
PYTHONPATH=$(KAI_PYTHON_PATH) python ./kai/service/incident_store/psql.py --config_filepath ./kai/config.toml --drop_tables $(DROP_TABLES)
PYTHONPATH=$(KAI_PYTHON_PATH) python kai/service/incident_store/incident_store.py --config_filepath ./kai/config.toml --drop_tables $(DROP_TABLES)
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ The quickest way to get running is to leverage sample data committed into the Ka
version: "3"

x-kai-variables: &kai-variables
- DEMO_MODE: "False"
+ DEMO_MODE: "True"
- KAI__DEMO_MODE: "False"
+ KAI__DEMO_MODE: "True"
HUB_URL: ${HUB_URL:-https://tackle-konveyor-tackle.apps.example.com/hub}
IMPORTER_ARGS:
LOG_LEVEL: info
Expand Down Expand Up @@ -87,7 +87,7 @@ The above information is a quick path to enable running Kai quickly to see how i
## Roadmap and Early Builds

- Kai is in it's early development phase and is NOT ready for production usage.
- See [ROADMAP.md](/ROADMAP.md) to learn about the project's goals and milestones
- See [ROADMAP.md](ROADMAP.md) to learn about the project's goals and milestones
- Please see [docs/Evaluation_Builds.md](docs/Evaluation_Builds.md) for information on early builds.

## Contributing
Expand Down
4 changes: 4 additions & 0 deletions build/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ RUN echo -e "[almalinux9-appstream]" \
"\nbaseurl = https://repo.almalinux.org/almalinux/9/AppStream/\$basearch/os/" \
"\nenabled = 1" \
"\ngpgcheck = 0" > /etc/yum.repos.d/almalinux.repo

RUN dnf -y install postgresql && dnf clean all
USER 1001

COPY --chown=1001:1001 . /kai

RUN pip install --no-cache -r /kai/requirements.txt
RUN pip install --no-cache -e /kai

RUN cd /kai/samples && ./fetch_apps.py
COPY build/entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
Loading

0 comments on commit 1e0252c

Please sign in to comment.