Skip to content

Commit

Permalink
minor fixups of podman-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Spooren committed May 31, 2023
1 parent 3e9cece commit 29cf9de
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion asu/asu.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def store_path(path="index.html"):

from . import metrics

redis_client = get_redis_client(app.config["REDIS_URL"])
redis_client = get_redis_client(app.config)

app.config["REGISTRY"].register(metrics.BuildCollector(redis_client))

Expand Down
6 changes: 3 additions & 3 deletions asu/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
import json
import logging
import struct
from os import getenv
from pathlib import Path
from re import match
from shutil import unpack_archive
from tempfile import NamedTemporaryFile

import nacl.signing
import redis
import requests
from podman import PodmanClient

import redis


def get_redis_client(config):
return redis.from_url(config["REDIS_URL"])
return redis.from_url(getenv("REDIS_URL") or config["REDIS_URL"])


def is_modified(config, url: str) -> bool:
Expand Down
24 changes: 13 additions & 11 deletions podman-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,47 @@ volumes:
redis:
services:
server:
image: "aparcar/asu:latest"
image: "localhost/aparcar/asu:latest"
build:
context: ./
dockerfile: Containerfile
environment:
- REDIS_HOST=redis
- REDIS_URL=redis://redis/
volumes:
- "./asu-service/public/:/app/public/"
- "./asu-service/public/:/app/public/:rw"
ports:
- "127.0.0.1:8000:8000"
depends_on:
- redis

worker:
image: "aparcar/asu:latest"
image: "localhost/aparcar/asu:latest"
build:
context: ./
dockerfile: Containerfile
command: rqworker --url "redis://redis"
environment:
- CONTAINER_HOST=unix:///tmp/socket/podman.sock
- REDIS_URL=redis://redis/
volumes:
- ./asu-service/public/:/app/public/
- podman-sock:/tmp/socket/
- ./asu-service/public/:/app/public/:rw
- podman-sock:/tmp/socket/:rw
depends_on:
- redis
- podman

worker2:
image: "aparcar/asu:latest"
image: "localhost/aparcar/asu:latest"
build:
context: ./
dockerfile: Containerfile
command: rqworker --url "redis://redis"
environment:
- CONTAINER_HOST=unix:///tmp/socket/podman.sock
- REDIS_URL=redis://redis/
volumes:
- ./asu-service/public/:/app/public/
- podman-sock:/tmp/socket/
- ./asu-service/public/:/app/public/:rw
- podman-sock:/tmp/socket/:rw
depends_on:
- redis
- podman
Expand All @@ -55,9 +57,9 @@ services:
command: sh -c "mkdir -p /tmp/socket && podman system service --time=0 unix:///tmp/socket/podman.sock"

redis:
image: "redis:alpine"
image: "docker.io/redis:alpine"
volumes:
- redis:/data/
- redis:/data/:rw

# Podman may not allow ports 1024, consider using an external web server
# webserver:
Expand Down
3 changes: 0 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def test_path():

@pytest.fixture
def app(mocked_redis, test_path):

registry = prometheus_client.CollectorRegistry(auto_describe=True)

mock_app = create_app(
Expand Down Expand Up @@ -164,7 +163,6 @@ def app(mocked_redis, test_path):

@pytest.fixture
def app_using_branches_yml(mocked_redis, test_path):

registry = prometheus_client.CollectorRegistry(auto_describe=True)

mock_app = create_app(
Expand All @@ -185,7 +183,6 @@ def app_using_branches_yml(mocked_redis, test_path):

@pytest.fixture
def app_using_default_branches(mocked_redis, test_path):

registry = prometheus_client.CollectorRegistry(auto_describe=True)

mock_app = create_app(
Expand Down

0 comments on commit 29cf9de

Please sign in to comment.