diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 1db6755..6bdc116 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -13,6 +13,7 @@ jobs: - '3.9' - '3.10' - '3.11' + - '3.12' name: create and save container runs-on: ubuntu-20.04 steps: diff --git a/.github/workflows/latest.yml b/.github/workflows/latest.yml index c493d66..58b90c5 100644 --- a/.github/workflows/latest.yml +++ b/.github/workflows/latest.yml @@ -13,6 +13,7 @@ jobs: - '3.9' - '3.10' - '3.11' + - '3.12' name: create and save container runs-on: ubuntu-20.04 steps: @@ -40,6 +41,6 @@ jobs: password: ${{ secrets.GHCR_TOKEN }} - run: docker pull ghcr.io/micro-fan/python:latest || true - run: > - PY_VERSION=python3.11 + PY_VERSION=python3.12 TAG_NAME=latest make push_ghcr_image diff --git a/Dockerfile.base_python b/Dockerfile.base_python index c35aca4..9d47927 100644 --- a/Dockerfile.base_python +++ b/Dockerfile.base_python @@ -6,7 +6,6 @@ RUN echo '30 Jun 2023' ENV LANG C.UTF-8 ENV LANGUAGE C.UTF-8 ENV LC_ALL C.UTF-8 -ENV SUPERVISOR_CONFIG supervisor-app.conf ENV LOG_DIR /var/log/fan_logs ENV PYTHONPATH=. ARG PY_VERSION=python3.9 @@ -18,10 +17,4 @@ ENV LOGSTASH_HOST localhost ARG BUILD_HELM=1 COPY base_python/*.sh ./ RUN ./install_basic_packages.sh -RUN ./install_helm_packages.sh - -COPY base_python/bootstrap/ /bootstrap -WORKDIR /bootstrap -RUN ./prepare_environment.py - -CMD /bootstrap_env/bin/python /bootstrap/bootstrap.py +RUN ./install_helm_packages.sh \ No newline at end of file diff --git a/README.md b/README.md index 830814b..cf6ce51 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,6 @@ ENV PGPORT=5432 ENV PGDATABASE=web_database ENV CONTAINER_TYPE=web ENV LOG_DIR=/var/log/web_logs -ENV SUPERVISOR_CONFIG=infra/web/supervisor-app.conf ENV PYTHONPATH=/home/code/backend:$PYTHONPATH ADD backend/requirements.txt /home/code/backend/requirements.txt diff --git a/base_python/bootstrap/bootstrap.py b/base_python/bootstrap/bootstrap.py deleted file mode 100755 index fa6b111..0000000 --- a/base_python/bootstrap/bootstrap.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/bootstrap_env/bin/python -import os -import shutil -import subprocess - -from fan_tools.python import rel_path - - -def run(cmd): - return subprocess.run(cmd, shell=True, check=True) - - -def supervisor_link(local_path): - base_name = os.path.basename(local_path) - dst = f'/etc/supervisor/conf.d/{base_name}' - shutil.copy(local_path, dst) - - -def main(): - log_dir = os.environ['LOG_DIR'] - if not os.path.exists(log_dir): - os.mkdir(log_dir) - SUPERVISOR_CONFIG = os.environ.get('SUPERVISOR_CONFIG') - supervisor_link(SUPERVISOR_CONFIG) - supervisor_link(rel_path('supervisor-bootstrap.conf')) - run('supervisord -n') - - -if __name__ == '__main__': - main() diff --git a/base_python/bootstrap/prepare_environment.py b/base_python/bootstrap/prepare_environment.py deleted file mode 100755 index 79cb3fc..0000000 --- a/base_python/bootstrap/prepare_environment.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python3 -import os -import shutil -import subprocess - -env = '/bootstrap_env' -pip = f'{env}/bin/pip' -python = f'{env}/bin/python' - - -def run(cmd): - return subprocess.run(cmd, shell=True, check=True) - - -def py_run(cmd): - run(f'{python} {cmd}') - - -def main(): - run(f'python3 -m venv {env}') - run(f'{pip} install wheel') - run(f'{pip} install -r requirements.txt') - os.makedirs('/etc/supervisor/conf.d/', exist_ok=True) - os.makedirs('/var/log/supervisor/', exist_ok=True) - shutil.copy('/bootstrap/supervisord.conf', '/etc/supervisor/supervisord.conf') - - -if __name__ == '__main__': - main() diff --git a/base_python/bootstrap/requirements.txt b/base_python/bootstrap/requirements.txt deleted file mode 100644 index ab1ead2..0000000 --- a/base_python/bootstrap/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -fan_tools>=3.0,<4.0 diff --git a/base_python/bootstrap/supervisor-bootstrap.conf b/base_python/bootstrap/supervisor-bootstrap.conf deleted file mode 100644 index e69de29..0000000 diff --git a/base_python/bootstrap/supervisord.conf b/base_python/bootstrap/supervisord.conf deleted file mode 100644 index afead15..0000000 --- a/base_python/bootstrap/supervisord.conf +++ /dev/null @@ -1,28 +0,0 @@ -; supervisor config file - -[unix_http_server] -file=/var/run/supervisor.sock ; (the path to the socket file) -chmod=0700 ; sockef file mode (default 0700) - -[supervisord] -logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) -pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) -childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) - -; the below section must remain in the config file for RPC -; (supervisorctl/web interface) to work, additional interfaces may be -; added by defining them in separate rpcinterface: sections -[rpcinterface:supervisor] -supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface - -[supervisorctl] -serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket - -; The [include] section can just contain the "files" setting. This -; setting can list multiple files (separated by whitespace or -; newlines). It can also contain wildcards. The filenames are -; interpreted as relative to this file. Included files *cannot* -; include files themselves. - -[include] -files = /etc/supervisor/conf.d/*.conf diff --git a/base_python/install_basic_packages.sh b/base_python/install_basic_packages.sh index 3923054..f2b3845 100755 --- a/base_python/install_basic_packages.sh +++ b/base_python/install_basic_packages.sh @@ -43,15 +43,15 @@ apt -y install ${PY_VERSION} ${PY_VERSION}-venv ${PY_VERSION}-dev update-alternatives --install /usr/bin/python python /usr/bin/${PY_VERSION} 1 update-alternatives --install /usr/bin/python3 python3 /usr/bin/${PY_VERSION} 1 -curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py -${PY_VERSION} get-pip.py - -python3 -m pip install -U setuptools wheel supervisor -python3 -m pip install pillow uwsgi psycopg2-binary fan-tools==3.* awscli~=1.27.164 docker-compose +python3 -m ensurepip +python3 -m pip uninstall --root-user-action=ignore -y six +python3 -m pip install --root-user-action=ignore fan-tools==3.* awscli>=1.27.164 six cd /usr/local/bin/ -KUBE_RELEASE=v1.26.6 +COMPOSE_VERSION=v2.29.1 +curl -SL https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose +KUBE_RELEASE=v1.29.7 curl -LO "https://dl.k8s.io/release/${KUBE_RELEASE}/bin/linux/amd64/kubectl" curl -LO https://github.com/ahmetb/kubectx/releases/download/v0.9.5/kubens curl -LO https://github.com/ahmetb/kubectx/releases/download/v0.9.5/kubectx