xcad 5 luni în urmă
părinte
comite
6633c99394
5 a modificat fișierele cu 69 adăugiri și 6 ștergeri
  1. 3 0
      .gitignore
  2. 0 0
      add_frontmatter.py
  3. 14 6
      library/compose/nginx/compose.yaml
  4. 29 0
      pyproject.toml
  5. 23 0
      setup.cfg

+ 3 - 0
.gitignore

@@ -17,3 +17,6 @@
 **/*.pyd
 **/*.pyd
 **/.venv
 **/.venv
 **/venv/
 **/venv/
+
+# Packaging
+*.egg-info/

+ 0 - 0
add_frontmatter.py


+ 14 - 6
library/compose/nginx/compose.yaml

@@ -18,18 +18,26 @@ services:
     {% if swarm %}
     {% if swarm %}
     deploy:
     deploy:
       replicas: {{ swarm_replicas | default(1) }}
       replicas: {{ swarm_replicas | default(1) }}
-      restart_policy:
-        condition: on-failure
+      {% if traefik %}
+      labels:
+        - traefik.enable={{ traefik_enable | default(true) }}
+        - traefik.http.services.{{ container_name }}.loadbalancer.server.port=80
+        - traefik.http.routers.{{ container_name }}.entrypoints=websecure
+        - traefik.http.routers.{{ container_name }}.rule=Host(`{{ traefik_host | default('example.com') }}`)
+        - traefik.http.routers.{{ container_name }}.tls={{ traefik_tls | default(true) }}
+        - traefik.http.routers.{{ container_name }}.tls.certresolver={{ traefik_certresolver }}
+        - traefik.http.routers.{{ container_name }}.service={{ container_name }}
+      {% endif %}
     {% endif %}
     {% endif %}
     {% if not traefik %}
     {% if not traefik %}
     ports:
     ports:
       - "{{ service_port['http'] | default(8080) }}:80"
       - "{{ service_port['http'] | default(8080) }}:80"
       - "{{ service_port['https'] | default(8443) }}:443"
       - "{{ service_port['https'] | default(8443) }}:443"
     {% endif %}
     {% endif %}
-    volumes:
-      - ./config/default.conf:/etc/nginx/conf.d/default.conf:ro
-      - ./data:/usr/share/nginx/html:ro
-    {% if traefik %}
+    # volumes:
+    #   - ./config/default.conf:/etc/nginx/conf.d/default.conf:ro
+    #   - ./data:/usr/share/nginx/html:ro
+    {% if traefik and not swarm %}
     labels:
     labels:
       - traefik.enable={{ traefik_enable | default(true) }}
       - traefik.enable={{ traefik_enable | default(true) }}
       - traefik.http.services.{{ container_name }}.loadbalancer.server.port=80
       - traefik.http.services.{{ container_name }}.loadbalancer.server.port=80

+ 29 - 0
pyproject.toml

@@ -0,0 +1,29 @@
+[build-system]
+requires = ["setuptools>=61.0", "wheel"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "boilerplates"
+version = "1.0.0"
+description = "CLI tool for managing infrastructure boilerplates"
+readme = "README.md"
+requires-python = ">=3.9"
+license = {text = "MIT"}
+authors = [ {name = "Christian Lempa"} ]
+keywords = ["boilerplates", "cli", "infrastructure"]
+classifiers = [
+    "Programming Language :: Python :: 3",
+    "License :: OSI Approved :: MIT License",
+    "Operating System :: OS Independent",
+]
+
+dependencies = [
+    "typer[all]>=0.9.0",
+    "rich>=13.0.0",
+    "PyYAML>=6.0",
+    "python-frontmatter>=1.0.0",
+    "Jinja2>=3.0",
+]
+
+[project.scripts]
+boilerplate = "cli.__main__:main"

+ 23 - 0
setup.cfg

@@ -0,0 +1,23 @@
+[metadata]
+name = boilerplates
+version = 1.0.0
+description = CLI tool for managing infrastructure boilerplates
+long_description = file: README.md
+license_file = LICENSE
+author = Christian Lempa
+author_email =
+python_requires = >=3.9
+
+[options]
+packages = find:
+include_package_data = True
+install_requires =
+    typer[all]>=0.9.0
+    rich>=13.0.0
+    PyYAML>=6.0
+    python-frontmatter>=1.0.0
+    Jinja2>=3.0
+
+[options.entry_points]
+console_scripts =
+    boilerplate = cli.__main__:main