Skip to content

Commit

Permalink
Streamline build process (#30)
Browse files Browse the repository at this point in the history
* fix deprecation wanring and >=py3.10

* improve deps management

* improve image build
  • Loading branch information
resmo authored May 2, 2023
1 parent 0142499 commit 35acc73
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 135 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel
- name: Build
run: |
python setup.py sdist bdist_wheel
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
FROM docker.io/python:3.11.3-slim

ENV MPLCONFIGDIR /tmp
RUN pip install --upgrade wheel pip

WORKDIR /build
COPY . .

RUN pip install -e .
COPY dist/scalr_ngine-*.whl .
RUN pip install scalr_ngine-*.whl

WORKDIR /app

Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ clean:
rm -rf *.dist-info
rm -rf dist
rm -rf build
find -name '__pycache__' -exec rm -fr {} || true \;

build: clean
python3 setup.py sdist bdist_wheel
Expand All @@ -18,3 +19,6 @@ docs-publish:

test:
tox

update:
pip-compile -U --no-header --no-annotate --strip-extras --resolver backtracking
132 changes: 3 additions & 129 deletions docker/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
# NOTE: the name is used to prefix and identify resources by a tag.
# If changed, existing resources become unmanaged and must be deleted manually.
name: app
enabled: false
dry_run: false
Expand All @@ -10,131 +8,7 @@ max_step_down: 1
scale_down_selection: oldest
cooldown_timeout: 60

policies:
[]

## Query a web endpoint.
## A JSON return o {"metric": <int>} is expected in this case
# - name: my check over web
# target: 5
# source: web
# query: http://localhost:8000/target.json
# config:
# headers:
# Authorization: Bearer xyz
# key: metric

# - name: random one to ten
# target: 5
# source: random
# config:
# start: 1
# stop: 10

# - name: Scaling up at 7 a.m. by factor 3
# source: time
# target: 3
# config:
# start_time: "06:58"
# end_time: "07:00"
# metric: 1

# - name: Scaling down during night by factor 0.1
# source: time
# target: 1
# config:
# start_time: "22:00"
# end_time: "06:59"
# metric: 10

policies: []
cloud:
{}
### Cloudscale.ch
# kind: cloudscale_ch
# launch_config:
# flavor: flex-2
# image: debian-10
# zone: lpg1
# tags:
# project: gemini
# ssh_keys:
# - ssh-ed25519 AAAAC3N
# user_data: |
# #cloud-config
# manage_etc_hosts: true
# package_update: true
# package_upgrade: true
# packages:
# - nginx

### Exoscale
# kind: exoscale
# launch_config:
# service_offering: Micro
# template: Linux Debian 11 (Bullseye) 64-bit
# zone: ch-dk-2
# ssh_key: resmo@diode
# tags:
# project: gemini
# root_disk_size: 20
# user_data: |
# #cloud-config
# manage_etc_hosts: true
# packages:
# - nginx

# ### Hetzner Cloud
# kind: hcloud
# launch_config:
# server_type: cx11
# image: debian-10
# labels:
# project: gemini
# location: fsn1
# ssh_keys:
# - resmo
# user_data: |
# #cloud-config
# manage_etc_hosts: true
# package_update: true
# package_upgrade: true
# packages:
# - nginx

# ### Cloudstack
# kind: cloudstack
# launch_config:
# service_offering: Micro
# template: Linux Debian 10 (Buster) 64-bit
# security_groups:
# - default
# zone: de-muc-1
# ssh_key: rmoser-puzzle
# tags:
# project: gemini
# root_disk_size: 20
# user_data: |
# #cloud-config
# manage_etc_hosts: true
# package_update: true
# package_upgrade: true
# packages:
# - nginx

# ### Digital Ocean
# kind: digitalocean
# launch_config:
# size: s-1vcpu-1gb
# image: debian-10-x64
# region: ams3
# ssh_keys:
# - 'b5:be:e8:...'
# tags:
# - 'project:gemini'
# user_data: |
# #cloud-config
# manage_etc_hosts: true
# package_update: true
# package_upgrade: true
# packages:
# - nginx
kind: unset
launch_config: {}
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"
14 changes: 14 additions & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cloudscale-sdk
cs
hcloud
prometheus-api-client
prometheus-client
pydantic-yaml
pydantic
python-digitalocean
python-dotenv
python-json-logger
PyYAML
requests
schedule
backports.zoneinfo;python_version<"3.9"
37 changes: 35 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,46 @@
backports-zoneinfo==0.2.1 ; python_version < "3.9"
certifi==2022.12.7
charset-normalizer==3.1.0
cloudscale-sdk==0.7.0
contourpy==1.0.7
cs==3.0.0
cycler==0.11.0
dateparser==1.1.8
deprecated==1.2.13
fonttools==4.39.3
hcloud==1.19.0
httmock==1.4.0
idna==3.4
importlib-metadata==6.6.0
importlib-resources==5.12.0
jsonpickle==3.0.1
kiwisolver==1.4.4
matplotlib==3.7.1
numpy==1.24.3
packaging==23.1
pandas==2.0.1
pillow==9.5.0
prometheus-api-client==0.5.3
prometheus-client==0.16.0
pydantic-yaml==0.11.2
pydantic==1.10.7
pydantic-yaml==0.11.2
pyparsing==3.0.9
python-dateutil==2.8.2
python-digitalocean==1.17.0
python-dotenv==1.0.0
python-json-logger==2.0.7
PyYAML==6.0
pytz==2023.3
pytz-deprecation-shim==0.1.0.post0
pyyaml==6.0
regex==2023.5.2
requests==2.29.0
schedule==1.2.0
six==1.16.0
types-deprecated==1.2.9.2
typing-extensions==4.5.0
tzdata==2023.3
tzlocal==4.3
urllib3==1.26.15
wrapt==1.15.0
xdg==6.0.0
zipp==3.15.0
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ ignore = E261,E301,E302,E402,E731
max-line-length = 160

[metadata]
license_file = LICENSE
license_files = LICENSE
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
],
install_requires=install_requires,
tests_require=tests_require,
python_requires=">=3.8",
python_requires=">=3.10",
entry_points={
"console_scripts": [
"scalr-ngine = scalr.app:main",
Expand Down

0 comments on commit 35acc73

Please sign in to comment.