diff --git a/.github/workflows/ci-run-tests.yml b/.github/workflows/ci-run-tests.yml index 4b93c480..0b74b313 100644 --- a/.github/workflows/ci-run-tests.yml +++ b/.github/workflows/ci-run-tests.yml @@ -27,5 +27,8 @@ jobs: - name: Start database run: docker run --name=database -e POSTGRES_DB=app -e POSTGRES_PASSWORD=password -d postgres:14.6 + - name: Start memcached + run: docker run --name=memcached -d memcached:latest + - name: Run tests - run: docker run -i --rm --name=app-test -u root --link=database -e DATABASE_URL="postgres://postgres:password@database/app" -e APP_SECRET_KEY=xxxx -e ENVIRONMENT=test app-test + run: docker run -i --rm --name=app-test -u root --link=database --link=memcached -e DATABASE_URL="postgres://postgres:password@database/app" -e APP_SECRET_KEY=xxxx -e ENVIRONMENT=test app-test diff --git a/docker-compose.yml b/docker-compose.yml index 350bca2d..f5baf1e5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,7 @@ services: - docker/dev.env depends_on: - database + - memcached frontend: restart: on-failure @@ -34,3 +35,7 @@ services: POSTGRES_DB: "app" POSTGRES_USER: "postgres" POSTGRES_PASSWORD: "password" + + memcached: + image: memcached:latest + hostname: memcached diff --git a/docker/init-test.sh b/docker/init-test.sh index 35b581db..3473b653 100755 --- a/docker/init-test.sh +++ b/docker/init-test.sh @@ -2,6 +2,6 @@ python /app/manage.py migrate --no-input python /app/manage.py createcachetable -python /app/manage.py collectstatic -python /app/manage.py test +python /app/manage.py collectstatic --no-input +python /app/manage.py test --no-input python /app/manage.py makemigrations --check --dry-run --no-input diff --git a/ietf/settings/base.py b/ietf/settings/base.py index f0da61f9..2c271d25 100644 --- a/ietf/settings/base.py +++ b/ietf/settings/base.py @@ -173,8 +173,12 @@ CACHES = { "default": { - "BACKEND": "django.core.cache.backends.db.DatabaseCache", - "LOCATION": "cache_table", + "BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache", + "LOCATION": "memcached:11211", + }, + "sessions": { + "BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache", + "LOCATION": "memcached:11211", }, "dummy": {"BACKEND": "django.core.cache.backends.dummy.DummyCache"}, } @@ -244,4 +248,4 @@ "home.IABHomePage", ] -NOTE_WELL_REPO = "https://raw.githubusercontent.com/ietf/note-well/main/note-well.md" \ No newline at end of file +NOTE_WELL_REPO = "https://raw.githubusercontent.com/ietf/note-well/main/note-well.md" diff --git a/requirements.txt b/requirements.txt index 6f224c53..669a6b15 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,6 +15,7 @@ tqdm>=3.7.0 wagtail-markdown Pygments wagtail-orderable +pymemcache # env var configuration typed-environment-configuration>=0.1.3,<0.2