Skip to content

Commit

Permalink
merged from development
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMrSheldon committed Sep 3, 2024
2 parents 707a12e + fb66cc7 commit f5d629c
Show file tree
Hide file tree
Showing 78 changed files with 1,903 additions and 1,099 deletions.
63 changes: 39 additions & 24 deletions Dockerfile.dev → .devcontainer/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,33 @@ RUN apt-get update && apt-get install -y sudo git locales
RUN echo "en_US.UTF-8 UTF-8" | tee -a /etc/locale.gen && locale-gen

########################################################################################################################
# Create User #
# Create Users #
########################################################################################################################
# Change root Password to 1234
RUN echo 'root:1234' | chpasswd
# Create new user: "dev" also with password 1234
RUN useradd -ms /bin/bash dev && \
echo 'dev:1234' | chpasswd && \
RUN <<EOF
# Create docker group for later
addgroup docker

# Change root Password to 1234
echo 'root:1234' | chpasswd

# Create new user: "dev" also with password 1234
useradd -ms /bin/bash dev
echo 'dev:1234' | chpasswd
usermod -aG sudo dev
usermod -aG docker dev
EOF


########################################################################################################################
# Frontend #
########################################################################################################################
USER root

# https://stackoverflow.com/a/47680012
RUN apt-get update && apt-get install -y curl gnupg2 && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list

RUN apt-get update && apt-get install -y npm yarn

RUN <<EOF
apt-get update
apt-get install -y npm
npm install --global yarn
EOF



Expand All @@ -38,24 +43,34 @@ RUN apt-get update && apt-get install -y npm yarn
########################################################################################################################
ENV PIP_BREAK_SYSTEM_PACKAGES 1
USER root
RUN <<EOF
apt-get update && apt-get install -y python3 python3-pip python3-dev pkg-config default-libmysqlclient-dev \
RUN apt-get update && apt-get install -y python3 python3-pip python3-dev pkg-config default-libmysqlclient-dev \
libpcre3-dev
pip3 install black flake8 isort mypy
EOF
COPY application/requirements.txt /tmp/application/requirements.txt
RUN <<EOF
# Create a dummy secret
mkdir -p "/etc/discourse/" && echo "I am so secret" > "/etc/discourse/client-api-key"
# Setup the application
cd /tmp/application
pip3 install -r requirements.txt
COPY <<EOF /etc/discourse/client-api-key
I am so secret
EOF

########################################################################################################################
# Client #
########################################################################################################################
# NOT YET
USER root
RUN <<EOF
# Install Java (some dependencies like python are already installed by the application module)
apt-get update
apt-get install -y openjdk-11-jdk
# Install Docker and set correct permissions to the docker.sock
apt-get install -y curl
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update -y
apt-get install -y docker-ce-cli
touch /var/run/docker.sock
chown root:docker /var/run/docker.sock
EOF



Expand Down
41 changes: 35 additions & 6 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
"dockerComposeFile": [
"../docker-compose.dev.yml",
"./docker-compose.dev.yml",
"docker-compose.yml"
],

Expand All @@ -17,7 +17,7 @@
// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

Expand Down Expand Up @@ -50,7 +50,7 @@
// "shutdownAction": "none",

// Uncomment the next line to run commands after the container is created.
"postCreateCommand": "cd frontend; yarn; cd ../application; make setup; make import-mock-data",
"postCreateCommand": "cd frontend; yarn; cd ../python-client; pip install -e .[test,dev]; cd ../application/; pip install -e .[test,dev]; make setup; make import-mock-data",

// Configure tool-specific properties.
"customizations": {
Expand All @@ -60,6 +60,14 @@
"json.format.keepLines": true,
"livePreview.portNumber": 3080,
"remote.autoForwardPorts": false,
"files.exclude": {
"**/__pycache__": true,
"**/.mypy_cache": true,
"**/.pytest_cache": true,
"**/*.egg-info": true,
"**/node_modules": true,
"application/.data-dumps": true
},
"launch": {
"version": "0.2.0",
"configurations": [
Expand All @@ -68,7 +76,7 @@
"type": "node",
"request": "launch",
"runtimeExecutable": "yarn",
"cwd": "${workspaceFolder}/frontend",
"cwd": "${workspaceFolder:Frontend}/",
"runtimeArgs": [
"dev"
]
Expand All @@ -82,7 +90,26 @@
],
"django": true,
"autoStartBrowser": false,
"program": "${workspaceFolder}/application/src/manage.py"
"program": "${workspaceFolder:Backend}/src/manage.py"
},
{
"name": "TIRA Backend Tests",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder:Backend}/src/manage.py",
"cwd": "${workspaceFolder:Backend}/test",
"args": [ "test", "--failfast", "--settings=settings_test" ],
"django": true,
"env": { "PYTHONPATH": ":../src:.", "DJANGO_SETTINGS_MODULE": "settings_test" },
"justMyCode": false
},
{
"name": "Frontend Tests",
"type": "node",
"request": "launch",
"runtimeExecutable": "yarn",
"args": [ "test" ],
"cwd": "${workspaceFolder:Frontend}"
}
],
"compounds": [
Expand All @@ -109,7 +136,9 @@
"ms-python.isort",
"ms-python.black-formatter",
"ms-python.flake8",
"ms-python.mypy-type-checker"
"ms-python.mypy-type-checker",
"42Crunch.vscode-openapi",
"vuetifyjs.vuetify-vscode"
]
}
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 11 additions & 12 deletions docker-compose.dev.yml → .devcontainer/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.8'
services:
devenv:
build:
Expand All @@ -16,21 +15,21 @@ services:
image: ghcr.io/authelia/authelia
restart: unless-stopped
volumes:
- ./.devfiles/authelia/configuration.dev.yml:/config/configuration.yml
- ./.devfiles/authelia/users-database.yml:/config/users_database.yml
- ./devfiles/authelia/configuration.dev.yml:/config/configuration.yml
- ./devfiles/authelia/users-database.yml:/config/users_database.yml
nginx:
image: lscr.io/linuxserver/nginx
restart: unless-stopped
ports:
- "8080:8080"
- "8081:8081"
- "8082:8082"
#ports:
# - "8080:8080"
# - "8081:8081"
# - "8082:8082"
external_links:
- "auth:auth.tira.local"
- "devenv:www.tira.local"
volumes:
- ./.devfiles/nginx/tira.conf:/config/nginx/site-confs/tira.conf
- ./.devfiles/nginx/tira-backend.conf:/config/nginx/site-confs/tira-backend.conf
- ./.devfiles/nginx/auth.conf:/config/nginx/site-confs/auth.conf
- ./.devfiles/nginx/snippets/:/config/nginx/snippets/
- ./.devfiles/nginx/certs/:/etc/nginx/certs/
- ./devfiles/nginx/tira.conf:/config/nginx/site-confs/tira.conf
- ./devfiles/nginx/tira-backend.conf:/config/nginx/site-confs/tira-backend.conf
- ./devfiles/nginx/auth.conf:/config/nginx/site-confs/auth.conf
- ./devfiles/nginx/snippets/:/config/nginx/snippets/
- ./devfiles/nginx/certs/:/etc/nginx/certs/
3 changes: 1 addition & 2 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.8'
services:
# Update this to the name of the service you want to work with in your docker-compose.yml file
devenv:
Expand All @@ -13,7 +12,7 @@ services:

volumes:
# Update this to wherever you want VS Code to mount the folder of your project
- ..:/workspaces:cached
- ..:/workspaces/tira:cached

# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
# cap_add:
Expand Down
42 changes: 0 additions & 42 deletions .github/workflows/run-all-tests.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/test-python-client-on-many-python-versions.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/test-python-client.yml

This file was deleted.

Loading

0 comments on commit f5d629c

Please sign in to comment.