manage.py changed to lf; FTs tweaked to accomodate WSL2 ansible deployment

This commit is contained in:
Disco DeDisco
2026-01-13 20:58:05 -05:00
parent d942839308
commit 4b137db317
21 changed files with 881 additions and 848 deletions

View File

@@ -15,6 +15,6 @@ RUN python manage.py collectstatic
ENV DJANGO_DEBUG_FALSE=1 ENV DJANGO_DEBUG_FALSE=1
RUN adduser --uid 1234 nonroot RUN adduser --uid 1234 nonroot
USER nonroot
USER nonroot
CMD ["gunicorn", "--bind", ":8888", "core.wsgi:application"] CMD ["gunicorn", "--bind", ":8888", "core.wsgi:application"]

View File

@@ -24,7 +24,7 @@
source: build source: build
state: present state: present
build: build:
path: .. path: /mnt/d/cosmovault/latticework/oreilly/percival/python-tdd
platform: linux/amd64 platform: linux/amd64
force_source: true force_source: true
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@@ -49,9 +49,41 @@
force_source: true force_source: true
state: present state: present
- name: Ensure .secret-key files exists
# the intention is that this only happens once per server
ansible.builtin.copy:
dest: ~/.secret-key
content: "{{ lookup('password', '/dev/null length=32 chars=ascii_letters') }}"
mode: 0600
force: false # do not recreate file if it already exists
- name: Read secret key back from file
ansible.builtin.slurp:
src: ~/.secret-key
register: secret_key
- name: Ensure db.sqlite3 file exists outside container
ansible.builtin.file:
path: "{{ ansible_env.HOME }}/db.sqlite3"
state: touch
owner: 1234 # so nonroot user can access it in container
become: true # needed for ownership change
- name: Run container - name: Run container
community.docker.docker_container: community.docker.docker_container:
name: gamearray name: gamearray
image: gamearray image: gamearray
state: started state: started
recreate: true recreate: true
env:
DJANGO_DEBUG_FALSE: "1"
DJANGO_SECRET_KEY: "{{ secret_key.content | b64decode }}"
DJANGO_ALLOWED_HOST: "staging.earthmanrpg.me,104.131.184.0,localhost"
DJANGO_DB_PATH: "/home/nonroot/db.sqlite3"
ports:
80:8888 # container port 80 (standard http port) maps to server port 8888 (arbitrary internal port)
- name: Run migration inside container
community.docker.docker_container_exec:
container: gamearray
command: ./manage.py migrate

View File

@@ -25,7 +25,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
if 'DJANGO_DEBUG_FALSE' in os.environ: if 'DJANGO_DEBUG_FALSE' in os.environ:
DEBUG = False DEBUG = False
SECRET_KEY = os.environ['DJANGO_SECRET_KEY'] SECRET_KEY = os.environ['DJANGO_SECRET_KEY']
ALLOWED_HOSTS = [os.environ['DJANGO_ALLOWED_HOST']] ALLOWED_HOSTS = [host.strip() for host in os.environ['DJANGO_ALLOWED_HOST'].split(',')]
db_path = os.environ['DJANGO_DB_PATH'] db_path = os.environ['DJANGO_DB_PATH']
else: else:
DEBUG = True DEBUG = True

View File

@@ -87,7 +87,8 @@ class NewVisitorTest(StaticLiveServerTestCase):
def test_layout_and_styling(self): def test_layout_and_styling(self):
self.browser.get(self.live_server_url) self.browser.get(self.live_server_url)
self.browser.set_window_size(1024, 768) self.browser.set_window_size(1200, 768) # may have to switch back to 1024
print("Viewport width:", self.browser.execute_script("return window.innerWidth"))
inputbox = self.browser.find_element(By.ID, 'id-new-item') inputbox = self.browser.find_element(By.ID, 'id-new-item')
self.assertAlmostEqual( self.assertAlmostEqual(