Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • startuplab/courses/tjts5901-continuous-software-engineering/TJTS5901-K23_template
  • planet-of-the-apes/tjts-5901-apeuction
  • uunot-yliopiston-leivissa/tjts-5901-uunot
  • contain-the-cry/tjts-5901-auction-system
  • avengers/avengers
  • cse6/cse-6
  • 13th/13-sins-of-gitlab
  • fast-and-furious/fast-and-furious
  • back-to-the-future/delorean-auction
  • monty-pythons-the-meaning-of-life/the-meaning-of-life
  • team-atlantis/the-empire
  • code-with-the-wind/auction-project
  • the-pirates/the-pirates
  • do-the-right-thing/do-the-right-thing
  • inception/inception
  • the-social-network-syndicate/the-social-auction-network
  • team-the-hunt-for-red-october/tjts-5901-k-23-red-october
  • good-on-paper/good-paper-project
  • desperados/desperados
19 results
Show changes
Commits on Source (216)
Showing with 664 additions and 207 deletions
#!/bin/bash -i
# Copies localhost's ~/.kube/config file into the container and swap out localhost
# for host.docker.internal whenever a new shell starts to keep them in sync.
if [ "$SYNC_LOCALHOST_KUBECONFIG" = "true" ] && [ -d "/usr/local/share/kube-localhost" ]; then
mkdir -p $HOME/.kube
sudo cp -r /usr/local/share/kube-localhost/* $HOME/.kube
sudo chown -R $(id -u) $HOME/.kube
sed -i -e "s/localhost/host.docker.internal/g" $HOME/.kube/config
sed -i -e "s/127.0.0.1/host.docker.internal/g" $HOME/.kube/config
# If .minikube was mounted, set up client cert/key
if [ -d "/usr/local/share/minikube-localhost" ]; then
mkdir -p $HOME/.minikube
if [ -f "/usr/local/share/minikube-localhost/ca.crt" ]; then
sudo cp -r /usr/local/share/minikube-localhost/ca.crt $HOME/.minikube
fi
# Location varies between versions of minikube
if [ -f "/usr/local/share/minikube-localhost/client.crt" ]; then
sudo cp -r /usr/local/share/minikube-localhost/client.crt $HOME/.minikube
sudo cp -r /usr/local/share/minikube-localhost/client.key $HOME/.minikube
elif [ -f "/usr/local/share/minikube-localhost/profiles/minikube/client.crt" ]; then
sudo cp -r /usr/local/share/minikube-localhost/profiles/minikube/client.crt $HOME/.minikube
sudo cp -r /usr/local/share/minikube-localhost/profiles/minikube/client.key $HOME/.minikube
fi
sudo chown -R $(id -u) $HOME/.minikube
# Point .kube/config to the correct locaiton of the certs
sed -i -r "s|(\s*certificate-authority:\s).*|\\1$HOME\/.minikube\/ca.crt|g" $HOME/.kube/config
sed -i -r "s|(\s*client-certificate:\s).*|\\1$HOME\/.minikube\/client.crt|g" $HOME/.kube/config
sed -i -r "s|(\s*client-key:\s).*|\\1$HOME\/.minikube\/client.key|g" $HOME/.kube/config
fi
fi
...@@ -2,34 +2,28 @@ ...@@ -2,34 +2,28 @@
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3 // https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3
{ {
"name": "TJTS5901 Dev Environment", "name": "TJTS5901 Dev Environment",
"build": { // Use docker-compose to setup the container
"dockerfile": "../Dockerfile", // https://code.visualstudio.com/docs/containers/docker-compose
"context": "..", "dockerComposeFile": [
"args": { "../docker-compose.yml"
// Options ],
"NODE_VERSION": "lts/*",
// Setup the port for Flask. We'll use 5001 to avoid conflicts on Macs. "service": "tjts5901",
"PORT": "5001",
"PYTHON_PATH": "/usr/local" // Don't start flask app by default.
} "overrideCommand": true,
},
// Use /app -folder as a workspace folder. Otherwise it will depend on repository name. // Use /app -folder as a workspace folder. Otherwise it will depend on repository name.
"workspaceMount": "source=${localWorkspaceFolder},target=/app,type=bind,consistency=cached",
"workspaceFolder": "/app", "workspaceFolder": "/app",
"mounts": [
// Setup mountpoints for accessing secrets and services in host machine
// Docker-from-Docker, see https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/docker.md
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind",
// Kubernetes, see https://github.com/Microsoft/vscode-dev-containers/tree/main/containers/kubernetes-helm
"source=${env:HOME}${env:USERPROFILE}/.kube,target=/usr/local/share/kube-localhost,type=bind",
"source=${env:HOME}${env:USERPROFILE}/.minikube,target=/usr/local/share/minikube-localhost,type=bind",
// Static volume for vscode extensions
"source=tjts5901-vscode-extensions,target=/home/vscode/.vscode-server/extensions,type=volume"
],
"remoteEnv": { "remoteEnv": {
// If you do not want to sync your host .kube folder with the devcontainer, set this to false.
// https://github.com/Microsoft/vscode-dev-containers/tree/main/containers/kubernetes-helm
"SYNC_LOCALHOST_KUBECONFIG": "true", "SYNC_LOCALHOST_KUBECONFIG": "true",
// Setup flask debug mode to be on in devcontainer
"FLASK_DEBUG": "1",
// Pass in the host directory for Docker mount commands from inside the container
//"HOST_PROJECT_PATH": "${localWorkspaceFolder}"
}, },
// Configure tool-specific properties. // Configure tool-specific properties.
"customizations": { "customizations": {
...@@ -49,38 +43,53 @@ ...@@ -49,38 +43,53 @@
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint", "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
"python.unitTest.pyTestEnabled": true,
"python.unitTest.pyTestArgs": [
"--exitfirst",
"--verbose",
"--color=auto"
],
"[python]": { "[python]": {
"editor.rulers": [120] "editor.rulers": [120]
}, },
// Enable the terminal to be used as the default shell. // Enable the terminal to be used as the default shell.
"terminal.integrated.shellIntegration.enabled": true, "terminal.integrated.shellIntegration.enabled": true,
"gitlab.showPipelineUpdateNotifications": true
}, },
// Add the IDs of extensions you want installed when the container is created. // Add the IDs of extensions you want installed when the container is created.
"extensions": [ "extensions": [
"ms-python.python", "ms-python.python",
"ms-python.vscode-pylance",
"ms-azuretools.vscode-docker", "ms-azuretools.vscode-docker",
"ms-kubernetes-tools.vscode-aks-tools", "redhat.vscode-yaml",
"redhat.vscode-yaml" "GitLab.gitlab-workflow",
"samuelcolvin.jinjahtml"
] ]
} }
}, },
// Use 'forwardPorts' to make a list of ports inside the container available locally. // Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [ 5001 ], // "forwardPorts": [ 5001 ],
// Use 'postCreateCommand' to run commands after the container is created, and install // Uncomment the next line if you want start specific services in your Docker Compose config.
// Additional packages used for development. // "runServices": [],
// "postCreateCommand": "pip install -r requirements-dev.txt",
// Use 'postCreateCommand' to run commands after the container is created.
// Here we install kube sync support
"postCreateCommand": "/bin/sh .devcontainer/post-create.sh",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode", "remoteUser": "vscode",
"features": { "features": {
"docker-from-docker": "latest", "docker-from-docker": "latest",
"kubectl-helm-minikube": "1.23", "kubectl-helm-minikube": {
"version": "1.24",
"minikube": "none",
},
// "terraform": "latest", // "terraform": "latest",
"azure-cli": "latest" "azure-cli": {
"version": "lts"
}
} }
} }
#!/bin/sh
# This file is ran after devcontainer is created.
# Copy kube config to the container
echo "source $PWD/.devcontainer/copy-kube-config.sh" | tee -a $HOME/.bashrc $HOME/.zshrc >> /dev/null
...@@ -159,6 +159,12 @@ cython_debug/ ...@@ -159,6 +159,12 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
_docs/ # vs code personal workspace file
.vscode/settings.json
_docs/
.env .env
.DS_Store
# Ignore certificates
azure-sp.pem
## Use docker image as a base image. ## Stage names in the pipeline.
image: docker:stable
stages: stages:
- build - build
- test
- staging
- smoketest
- deploy - deploy
## Setup cache path for PIP packages.
## See: https://docs.gitlab.com/ee/ci/caching/#cache-python-dependencies
cache:
paths:
- .cache/pip
variables: variables:
## Setup image name -variable. Change this if you wish, but watch out ## Name for the generated image. Change this if you wish, but watch out
## for special characters! ## for special characters and spaces!
DOCKER_IMAGE_NAME: tjts5901 DOCKER_IMAGE_NAME: ${DOCKER_REGISTRY}/tjts5901
DOCKER_TAG: ${CI_COMMIT_REF_SLUG}
## (Optional) More verbose output from pipeline
## (Optional) More verbose output from pipeline. Enabling it might reveal secrets.
#CI_DEBUG_TRACE: "true" #CI_DEBUG_TRACE: "true"
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" include:
- template: Jobs/SAST.gitlab-ci.yml
## Build docker image ## Use buildkit to build the container.
## Buildkit: https://github.com/moby/buildkit
## Example gitlab-ci buildkit template: https://gitlab.com/txlab/ci-templates
build: build:
stage: build stage: build
image:
name: moby/buildkit:v0.10.6-rootless
entrypoint: [ "sh", "-c" ]
variables:
BUILDKITD_FLAGS: --oci-worker-no-process-sandbox
before_script:
## Make some checks that Docker credentials are configured.
- test -z "${DOCKER_REGISTRY}" && (echo "Missing required variable DOCKER_REGISTRY. See 'Pipeline setup.md'"; exit 1)
- test -z "${DOCKER_AUTH_CONFIG}" && (echo "Missing required variable DOCKER_AUTH_CONFIG. See 'Pipeline setup.md'"; exit 1)
- test -z "${DOCKER_IMAGE_NAME}" && (echo "Missing image name variable."; exit 1)
## Save docker login credentials from gitlab into a place where buildkit is looking for them.
- mkdir -p ${HOME}/.docker && echo "${DOCKER_AUTH_CONFIG}" > "${HOME}/.docker/config.json"
## Simple check that the registry exists in login information
- grep "\\b${DOCKER_REGISTRY}\\b" "${HOME}/.docker/config.json" || (echo "Could not find docker registry in docker login information. Check DOCKER_AUTH_CONFIG"; exit 1)
script: script:
## Build a new image, pulling the latest base, and tag it. # Build the image, and push it to registry.
## If --pull is ommited, base from local is used. - |
- docker build --pull -t $DOCKER_IMAGE_NAME . buildctl-daemonless.sh build --progress=plain \
--frontend=dockerfile.v0 \
--local context=. \
--local dockerfile=. \
--opt build-arg:CI_COMMIT_SHA=${CI_COMMIT_SHA} \
--output type=image,name=${DOCKER_IMAGE_NAME}:${DOCKER_TAG},push=true
## Build course documentation. You might not need this stage.
pages:
stage: build
## Use build from previous stage as base image. sast:
dependencies: ## Static Application Security Test
- build ## You can override the included template(s) by including variable overrides
image: $DOCKER_IMAGE_NAME ## SAST customization:
## https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
stage: test
## Run the tests. If any of the tests fails, pipeline is rejected.
test:
## Optional: include stage and environment name
stage: test
image: ${DOCKER_IMAGE_NAME}:${DOCKER_TAG}
variables:
## Setup variable pointin to mongo service
## Notice: the `mongo` address might not work.
MONGO_URL: mongodb://mongo/tjts5901-test
## When job is started, also start these things
services:
- name: mongo:4.2 # update to reflect same version used on production
alias: mongo
script: script:
## Install `mkdocs` and generate HTML documentation. - pip install --disable-pip-version-check -e /app[test]
- pip install --disable-pip-version-check mkdocs mkdocs-material ## Run tests with coverage reporting
- mkdocs build -f docs/mkdocs.yml - coverage run -m pytest
## Run basic reporting for badge
- coverage report
## Generate detailed report for gitlab annotations.
- coverage xml -o coverage.xml
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts: artifacts:
## Artifacts are sent to gitlab, and accessible from there. reports:
paths: coverage_report:
- _docs/ coverage_format: cobertura
path: coverage.xml
## Job to setup new staging job.
deploy to staging:
stage: staging
## Only run this stage when main branch receives changes.
only:
- main
## Use microsoft provided azure cli image, that contains az cli.
image: mcr.microsoft.com/azure-cli
## Setup the environment variables. The can be accessed through the gitlab
## Deployments -> Environments. Generates url based on the app and branch name.
environment:
name: $CI_JOB_STAGE
url: https://${AZURE_APP_NAME}-${CI_ENVIRONMENT_SLUG}.azurewebsites.net
before_script:
## Make sanity check that gitlab variables stage is done.
- test -z "${AZURE_SP_NAME}" && (echo "Missing required variable AZURE_SP_NAME. See 'Staging.md'"; exit 1)
- test -f "${AZURE_SP_CERT}" || ( echo "AZURE_SP_CERT (${AZURE_SP_CERT}) file is missing!"; exit 1)
- test -z "${AZURE_APP_NAME}" && (echo "Missing required variable AZURE_APP_NAME. See 'Staging.md'"; exit 1)
- test -z "${AZURE_RESOURCE_GROUP}" && (echo "Missing required variable DOCKER_AUTH_CONFIG. See 'Staging.md'"; exit 1)
## Login into azure
- az login --service-principal -u "${AZURE_SP_NAME}" -p "${AZURE_SP_CERT}" --tenant "jyu.onmicrosoft.com"
script:
## Create staging slot and copy settings from production
- |
az webapp deployment slot create -n "$AZURE_APP_NAME" -g "$AZURE_RESOURCE_GROUP" \
--slot "$CI_ENVIRONMENT_SLUG" --configuration-source "$AZURE_APP_NAME"
rules: ## TODO: Create a snapshot of database, and use it.
## Setup rule so this job is only run on "main" branch
- if: $CI_COMMIT_BRANCH == "main"
## Mark this stage as an "production" environment. ## If you need to change settings see: https://docs.microsoft.com/en-us/cli/azure/webapp/config/appsettings
environment: production
## Push image to container registry ## Change container tag to reflect branch we're running on
push-image: - |
az webapp config container set -n "$AZURE_APP_NAME" -g "$AZURE_RESOURCE_GROUP" \
--docker-custom-image-name "${DOCKER_IMAGE_NAME}:${DOCKER_TAG}" -s "$CI_ENVIRONMENT_SLUG"
## In case slot already existed, restart the slot
- az webapp restart -n "$AZURE_APP_NAME" -g "$AZURE_RESOURCE_GROUP" -s "$CI_ENVIRONMENT_SLUG"
## Restart is not immediate, it takes a sec or two, depending on container changes.
- sleep 20
## Store server info as artifact for prosperity
- curl "$CI_ENVIRONMENT_URL/server-info" -o server-info.json
artifacts:
paths:
- server-info.json
## Run smoketest to check that staging app is responding as expected.
staging smoketest:
stage: smoketest
image: ${DOCKER_IMAGE_NAME}:${DOCKER_TAG}
environment:
name: staging
url: https://${AZURE_APP_NAME}-${CI_ENVIRONMENT_SLUG}.azurewebsites.net
only:
- main
script:
- pip install --disable-pip-version-check -e .[test]
## Environment url can be inherited from CI_ENVIROMNENT_URL, which is one defined
## in the `environment.url:`. Using it here explicitly.
- echo "Testing againsta deployment address ${CI_ENVIROMNENT_URL}"
- pytest -v --environment-url="${CI_ENVIROMNENT_URL}" tests/test_smoke.py
## Push latest image into registry with the `latest` tag.
docker tag latest:
stage: deploy stage: deploy
dependencies:
- build
image: docker:stable
before_script: environment:
## Make some checks that Docker credentials are configured. name: production
- test -z "$DOCKER_REGISTRY" && (echo "Missing required variable DOCKER_REGISTRY. See 'Pipeline setup.md'"; exit 1)
- test -z "$DOCKER_AUTH_CONFIG" && (echo "Missing required variable DOCKER_AUTH_CONFIG. See 'Pipeline setup.md'"; exit 1)
image: docker:20.10.23
only:
- main
script: script:
## Tag the build image for registry, and push it. ## Copy credentials to container
- docker tag "$DOCKER_IMAGE_NAME" "$DOCKER_REGISTRY:$DOCKER_IMAGE_NAME" - mkdir -p ${HOME}/.docker && echo "${DOCKER_AUTH_CONFIG}" > "${HOME}/.docker/config.json"
- docker push "$DOCKER_REGISTRY:$DOCKER_IMAGE_NAME" ## Add the `latest` tag to the image we have build.
- docker buildx imagetools create ${DOCKER_IMAGE_NAME}:${DOCKER_TAG} --tag ${DOCKER_IMAGE_NAME}:latest
## Swap the production and staging slots around.
staging to production:
stage: deploy
## Only run this stage when main branch receives changes.
only:
- main
## Use microsoft provided azure cli image, that contains az cli.
image: mcr.microsoft.com/azure-cli
environment:
name: production
url: https://${AZURE_APP_NAME}.azurewebsites.net/
before_script:
## Login into azure
- az login --service-principal -u "${AZURE_SP_NAME}" -p "${AZURE_SP_CERT}" --tenant "jyu.onmicrosoft.com"
script:
## Swap production and staging slots.
- az webapp deployment slot swap -g "$AZURE_RESOURCE_GROUP" -n "$AZURE_APP_NAME" -s staging --target-slot production
## Summary
Briefly describe the issue and its impact on the project concisely.
## Steps to Reproduce
1. List the steps to reproduce the issue
2. Provide any relevant details such as browser, device, version, etc.
## Expected Outcome
What should happen after following the steps?
## Actual Outcome
What actually happens after following the steps?
## Additional Context
- Include any relevant screenshots, logs, or code snippets
- Indicate if the issue occurs only in certain conditions, environments, or browsers
## Possible fixes
If you are familiar with the issue and in a position to help, it would be appreciated!
/label ~bug
### As a ...
(user role)
### I want to ...
(goal)
### So that ...
(benefit)
### I know I'm done when ...
(the thing does thang)
/label ~"User Story"
[submodule "docs/tjts5901"] [submodule "docs/tjts5901"]
path = docs/tjts5901 path = docs/tjts5901
url = git@gitlab.jyu.fi:startuplab/courses/tjts5901-continuous-software-engineering/docs.git url = https://gitlab.jyu.fi/startuplab/courses/tjts5901-continuous-software-engineering/docs.git
{ {
"recommendations": [ "recommendations": [
"ms-vscode-remote.remote-containers", "ms-vscode-remote.remote-containers",
"ms-azuretools.vscode-docker",
"GitLab.gitlab-workflow"
] ]
} }
\ No newline at end of file
...@@ -10,37 +10,15 @@ ...@@ -10,37 +10,15 @@
"request": "launch", "request": "launch",
"module": "flask", "module": "flask",
"env": { "env": {
"FLASK_APP": "tjts5901.app",
"FLASK_DEBUG": "1" "FLASK_DEBUG": "1"
}, },
"args": [ "args": [
"run", "run",
"--no-debugger", "--no-debugger",
"--no-reload", "--no-reload",
"--port=5001",
], ],
"jinja": true, "jinja": true,
"justMyCode": true "justMyCode": true
}, },
{
"name": "Build and Debug Container",
"type": "docker",
"request": "launch",
"preLaunchTask": "Docker-run: Debug Flask App",
"python": {
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/app"
}
],
"projectType": "flask"
},
"dockerServerReadyAction": {
"action": "openExternally",
"pattern": "Running on (http?://\\S+|[0-9]+)",
"uriFormat": "%s://localhost:%s/"
}
}
] ]
} }
\ No newline at end of file
{
"terminal.integrated.shellIntegration.enabled": true,
"grammarly.files.include": [
"**/readme.md",
"**/README.md",
"**/*.txt",
"*.md"
],
"grammarly.selectors": [
{
"language": "markdown",
"scheme": "file"
}
]
}
{ {
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"type": "docker-build", "label": "Build Documentation",
"label": "Docker Build", "type": "shell",
"platform": "python", "command": "pip install .[docs] && mkdocs build -f docs/mkdocs.yml",
"dockerBuild": { "problemMatcher": []
"tag": "tjts5901:latest",
"dockerfile": "${workspaceFolder}/Dockerfile",
"context": "${workspaceFolder}",
"pull": true
},
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
} }
},
{
"type": "docker-run",
"label": "Docker-run: Debug Flask App",
"dependsOn": [ "docker-build" ],
"dockerRun": {
"containerName": "tjts5901",
"image": "tjts5901:latest",
"env": {
"FLASK_APP": "tjts5901.app",
"FLASK_DEBUG": "1"
},
"volumes": [{
"containerPath": "/app",
"localPath": "${workspaceFolder}"
}],
"ports": [{
"containerPort": 5001,
"hostPort": 5001
}]
},
"python": {
"args": ["run", "--host", "0.0.0.0", "--port", "5001"],
"module": "flask"
}
}
] ]
} }
\ No newline at end of file
# TJTS5901 Code of Conduct
## Equality and Diversity
Our multicultural and international community, which respects each individual,
is our richness and a source of inspiration. A non-discriminating place for
working and learning supports the development and success of the members of our
university community. JYU takes care of the quality and availability of
guidance as well as the accessibility of education. We behave appropriately,
are appreciative and support each other also in challenging situations. We do
not tolerate any inappropriate treatment, harassment, discrimination or
bullying.
We promote equality and non-discrimination in our university community in
accordance with the strategy and legislation as well as the aims set jointly
with the university community. The aims and development measures are described
in strategy development programmes and the
[Equality Plan for 2019–2021][equality plan].
[equality plan]: https://uno.jyu.fi/fi/ohjeet/yliopisto-tyonantajana/tyosuojelu-ja-tasa-arvo/jyu-equality-plan-2019-2021.pdf
## Promoting appropriate conduct in our community
Our university community does not accept any inappropriate treatment, bullying,
nor sexual or other harassment toward the staff or students. We will intervene
in and sort out any problematic situations of this kind.
## What is inappropriate behaviour
Inappropriate treatment refers to generally unacceptable demeanour toward
another person. It may occur, for example, as continuous and unjustified
criticism toward one’s work, negative or harmful gossip, exclusion from the
work community or repeated improper behaviour such as taunting or yelling.
Sexual harassment is most strikingly inappropriate behaviour. It is undesirable,
one-sided sexually-tinged behaviour, which the other person finds unpleasant and
insulting. Sexual harassment may be verbal or physical. Sexual attention turns
into harassment if it is continued although the other person expresses that the
behaviour is undesirable.
## Dealing with inappropriate treatment and harassment cases
If someone experiences inappropriate treatment or feels being harassed, the
person must express it to the other party. If the misbehaviour continues, the
issue must be reported to the immediate supervisor and the head of the unit.
If the harassing person is a supervisor, the matter must be reported to the
person’s supervisor. Supervisors and/or heads of units are obliged to do their
best to stop the misbehaviour.
It is essential that the unit management takes responsibility for solving the
situation. If a harassed person finds it difficult to bring out the matter with
the harasser or a supervisor, especially in case of sexual or gender-based
harassment, he/she can contact any of the contact persons listed at the end of
this brochure. Discussion with a contact person helps to sort out and solve the
situation. The discussions are always confidential.
## Contact persons
### Students
Student Union’s harassment contact persons:
* Juulia Saukkonen <hairinta.nainen@jyy.fi>,
* Teemu Rahikka <hairinta.mies@jyy.fi>,
* General <hairinta@jyy.fi>
University wellbeing advisers:
* Your unit’s student welfare advisor (goodie)
IT-Department:
* Niina Ormshaw <goodie-it@jyu.fi>
* Eeva, Juuli, Tiina, Ville <hyvis-it@jyu.fi>
* Welfare coordinator
Hanna Ahola, 040 8054352, <hanna.r.ahola@jyu.fi>
### Staff
* Equality contact person, Occupational Safety Officer, HR Specialist
Piia Löppönen, 0400 247 689, <piia.lopponen@jyu.fi>
* Occupational safety representative
Heli Niskanen, 040 805 3402, <heli.m.niskanen@jyu.fi>
* Occupational safety representative
Jorma Lind, 0400 247428, <jorma.lind@norssi.jyu.fi>
## Attribution
This covenant is adopted from [University of Jyväskylä Code of Conduct][code of conduct].
[code of conduct]: https://www.jyu.fi/en/university/organisation-and-managementregulations-and-principles/code-of-conduct]
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster ## Template project uses python image provided by Microsoft. It contains additional tools for
ARG VARIANT="3.7-bullseye" ## development, such as pylint, flake8, etc.
## If team elects to use different image, this file should be updated accordingly. Example for
## using official node: `FROM node:14-bullseye`
## You can find devcontainer templates for other languages here:
## https://github.com/microsoft/vscode-dev-containers/tree/main/containers
# Use microsoft provided python image, as it contains allready necessary tools. It's build on top of the official python image. ## It would be smart to separate development stuff from production stuff, but for now
FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT} ## this is enough (fore-shadowing).
## How to create deriative/multi-stage image: https://docs.docker.com/build/building/multi-stage/
FROM mcr.microsoft.com/vscode/devcontainers/python:3.10-bullseye
# Turns off buffering for easier container logging ## [Optional] Look into using jemalloc with python for more efficient memory management
## Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1
# Copy app to workspace folder, and install requirements ## Set static working directory. By default, it is set to /workspaces/<project-name> by
## vscode.
WORKDIR /app WORKDIR /app
## Declare default flask app as environment variable
## https://flask.palletsprojects.com/en/2.2.x/cli/
ARG FLASK_APP=tjts5901.app:flask_app
ENV FLASK_APP=${FLASK_APP}
## Setup the default port for flask to listen on
ARG FLASK_RUN_PORT=5001
ENV FLASK_RUN_PORT=${FLASK_RUN_PORT}
## Run Flask app when container started, and listen all the interfaces
## Note: CMD doesn't run command in build, but defines an starting command
## when container is started (or arguments for ENTRYPOINT).
#CMD flask run --host=0.0.0.0 # --port=${FLASK_RUN_PORT} --app=${FLASK_APP}
CMD gunicorn --bind "0.0.0.0:${FLASK_RUN_PORT}" "${FLASK_APP}"
## Examples for other commands:
## Run nothing, so that the container can be used as a base image
#CMD ["bash", "-c", "sleep infinity"]
## Run Flask app using Gunicorn, which unlike Flask, doesn't complain about being development thing.
## Install requirements using pip. This is done before copying the app, so that
## requirements layer is cached. This way, if app code changes, only app code is
## copied, and requirements are not re-installed.
COPY requirements.txt /tmp/pip-tmp/
RUN pip --disable-pip-version-check install -r /tmp/pip-tmp/requirements.txt && \
rm -rf /tmp/pip-tmp
## Copy app to WORKDIR folder
COPY . . COPY . .
RUN pip --disable-pip-version-check --no-cache-dir install -r requirements.txt
# Install self as editable module. In a long run it would be recommeded ## Compile translations before installing app. This is done to make sure that
# to remove `COPY` and only install module. ## translations are compiled before app is installed.
RUN pybabel compile -f -d src/tjts5901/translations/
## Install self as editable (`-e`) module. In a long run it would be recommeded
## to remove `COPY` and only install app as a package.
RUN pip --disable-pip-version-check install -v -e . RUN pip --disable-pip-version-check install -v -e .
# Create vscode extension folder, and change ownership of it. ## If defined, copy commit id to app environment. This is used to identify
## which version of the app is running.
ARG CI_COMMIT_SHA
ENV CI_COMMIT_SHA=${CI_COMMIT_SHA}
## Download the currency exchange rates from European Central Bank
RUN flask update-currency-rates
## Save build date and time
RUN echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> /app/.env
## To prevent vscode constantly re-installing extensions, we need to create a folder for it.
## In devcontainer.json, we mount volume to this folder so that extensions are not lost.
## Create vscode extension folder, and change ownership of it.
ARG USERNAME=vscode ARG USERNAME=vscode
RUN test ! -z "{$USERNAME}" && mkdir -p /home/${USERNAME}/.vscode-server/extensions && \ RUN test ! -z "${USERNAME}" && mkdir -p /home/${USERNAME}/.vscode-server/extensions && \
chown -R $USERNAME /home/$USERNAME/.vscode-server chown -R $USERNAME /home/$USERNAME/.vscode-server
# [Optional] Uncomment this section to install additional OS packages. ## [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here> # && apt-get -y install --no-install-recommends <your-package-list-here>
# [Optional] Uncomment this line to install global node packages. ## [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1 # RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
# Declare default flask app as environment variable
ARG FLASK_APP=tjts5901.app
ENV FLASK_APP=${FLASK_APP}
# Setup the default port for flask to listen on
ARG PORT=5001
ENV PORT=${PORT}
EXPOSE ${PORT}
# Run Flask app, and listen all the interfaces
CMD flask run --host=0.0.0.0 --port="${PORT}"
# Run nothing, so that the container can be used as a base image
# CMD ["bash", "-c", "sleep infinity"]
# Run Flask app using Gunicorn, which unlike Flask, doesn't complain about being development thing.
#CMD ["gunicorn", "--bind", "0.0.0.0:${PORT}", "tjts5901.app:app"]
# TJTS5901 Course Template Project # TJTS5901 Course Template Project
This is the template for 2023 TJTS5901 Continuous Software Engineering -course. Project template for 2023 TJTS5901 Continuous Software Engineering -course.
Sisu: <https://sisu.jyu.fi/student/courseunit/otm-38b7f26b-1cf9-4d2d-a29b-e1dcb5c87f00> - Sisu: <https://sisu.jyu.fi/student/courseunit/otm-38b7f26b-1cf9-4d2d-a29b-e1dcb5c87f00>
Moodle: <https://moodle.jyu.fi/course/view.php?id=20888> - Moodle: <https://moodle.jyu.fi/course/view.php?id=20888>
To get started with the project, see [`week_1.md`](./week_1.md)
The application is deployed at <https://tjts5901-app.azurewebsites.net>
## Start the app
Repository provides an `docker-compose` file to start the app. Edit `docker-compose.yml` to uncomment the ports, and run:
```sh
docker-compose up --build tjts5901
```
App can be also started from `Dockerfile`, with flask debug turned on, and current folder in editable mode. It has the benefit of automatically reflecting code changes in the app.
```sh
docker build -t tjts5901 .
docker run -it -p 5001:5001 -e "FLASK_DEBUG=1" -v "${PWD}:/app" tjts5901
```
Please see the `docs/tjts5901` folder for more complete documentation.
## Reporting issues and bugs
To report bugs, please use [the project "issues" form](https://gitlab.jyu.fi/startuplab/courses/tjts5901-continuous-software-engineering/TJTS5901-K23_template/-/issues/new?issuable_template=Default)
[python: **.py]
[jinja2: **/templates/**.html]
apiVersion: v1
kind: Service
metadata:
name: tjts5901-service
spec:
selector:
app: tjts5901-app
ports:
- protocol: "TCP"
port: 80
targetPort: 5001
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: tjts5901-app
spec:
selector:
matchLabels:
app: tjts5901-app
replicas: 2
template:
metadata:
labels:
app: tjts5901-app
spec:
containers:
- name: tjts5901-app
image: tjts5901k23.azurecr.io/tjts5901
imagePullPolicy: Always
ports:
- containerPort: 5001
# Defines the application's Docker image and additional services
# https://docs.docker.com/compose/compose-file/
# To run using docker-compose, use the command:
# docker-compose up --build tjts5901
version: '3'
services:
tjts5901:
build:
context: .
dockerfile: Dockerfile
working_dir: /app
# Ports to expose to the host. Uncomment if running outside of vscode.
# ports:
# - 5001:5001
# Volumes to mount from the host.
volumes:
# Mount local source folder into container
- .:/app
# Add volume for vscode extensions
- tjts5901-vscode-extensions:/home/vscode/.vscode-server/extensions
# mountpoints for kubernetes syncing.
- ${HOME}/.kube:/usr/local/share/kube-localhost:cached
- ${HOME}/.minikube:/usr/local/share/minikube-localhost:cached
environment:
#FLASK_APP: tjt5901:app
FLASK_DEBUG: 1
#FLASK_RUN_PORT: 5001
## Don't restart container if it exits. Useful for debugging, not for production.
restart: 'no'
## Start a mongodb container and link it to the app container
depends_on:
- mongodb
# MongoDB container
mongodb:
image: mongo:4.2
restart: unless-stopped
ports:
- 27017:27017
volumes:
tjts5901-vscode-extensions:
"""
Hack to get the hosted gitlab magiclink extension to work with mkdocs.
See: https://github.com/facelessuser/pymdown-extensions/issues/933
"""
import pymdownx.magiclink
base_url = "https://gitlab.jyu.fi"
pymdownx.magiclink.PROVIDER_INFO["gitlab"].update({
"url": base_url,
"issue": "%s/{}/{}/issues/{}" % base_url,
"pull": "%s/{}/{}/merge_requests/{}" % base_url,
"commit": "%s/{}/{}/commit/{}" % base_url,
"compare": "%s/{}/{}/compare/{}...{}" % base_url,
})
def define_env(env):
pass
...@@ -2,47 +2,88 @@ ...@@ -2,47 +2,88 @@
## ==================== ## ====================
## ##
## If you wish to build documentation, run: ## If you wish to build documentation, run:
## $ pip install mkdocs mkdocs-material ## $ pip install -r docs/requirements.txt
## $ mkdocs build -f docs/mkdocs.yml ## $ mkdocs build -f docs/mkdocs.yml
site_name: JYU TJTS5901 Course Documentation site_name: JYU TJTS5901 Course Documentation
site_author: University of Jyväskylä / StartupLab
copyright: © Copyright 2023 - <a href="https://www.jyu.fi">University of Jyväskylä</a> - This work is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International</a>.
theme: theme:
name: material name: material
features: features:
- navigation.sections - navigation.sections
- content.code.copy
- toc.follow - toc.follow
font:
text: lato - content.code.copy
- content.code.annotate
- content.action.edit
- content.action.view
logo: https://gitlab.jyu.fi/uploads/-/system/appearance/header_logo/1/jyu-logo3.png logo: https://gitlab.jyu.fi/uploads/-/system/appearance/header_logo/1/jyu-logo3.png
icon:
repo: material/file-document
extra_css:
- jyu-stylesheet.css
repo_url: https://gitlab.jyu.fi/startuplab/courses/tjts5901-continuous-software-engineering/TJTS5901-K23_template repo_url: https://gitlab.jyu.fi/startuplab/courses/tjts5901-continuous-software-engineering/docs
repo_name: tjts5901-continuous-software-engineering/TJTS5901-K23_template edit_uri: -/edit/main/
#edit_uri: -/edit/main/ repo_name: tjts5901-continuous-software-engineering/docs
docs_dir: tjts5901 docs_dir: tjts5901
site_dir: ../_docs site_dir: ../_docs
markdown_extensions: markdown_extensions:
- admonition - admonition
- footnotes - footnotes
- toc
- pymdownx.highlight: - pymdownx.highlight:
anchor_linenums: true anchor_linenums: true
- pymdownx.inlinehilite - pymdownx.inlinehilite
- pymdownx.snippets - pymdownx.snippets
- sane_lists
- pymdownx.superfences: - pymdownx.superfences:
custom_fences: custom_fences:
- name: mermaid - name: mermaid
class: mermaid class: mermaid
format: !!python/name:pymdownx.superfences.fence_code_format format: !!python/name:pymdownx.superfences.fence_code_format
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
- pymdownx.magiclink:
user: startuplab/courses/tjts5901-continuous-software-engineering
repo: TJTS5901-K23_template
provider: gitlab
repo_url_shortener: true
repo_url_shorthand: true
plugins:
- offline
- search
- git-revision-date-localized:
type: date
fallback_to_build_date: true
- macros:
module_name: macros
# Change to something else
j2_variable_start_string: "{j2{"
j2_variable_end_string: "}j2}"
extra: extra:
social: social:
- icon: fontawesome/brands/gitlab - icon: fontawesome/brands/gitlab
link: https://gitlab.jyu.fi/startuplab/courses/tjts5901-continuous-software-engineering/TJTS5901-K23_template link: https://gitlab.jyu.fi/startuplab/courses/tjts5901-continuous-software-engineering/TJTS5901-K23_template
name: Template repository
- icon: fontawesome/solid/graduation-cap - icon: fontawesome/solid/graduation-cap
link: https://moodle.jyu.fi/course/view.php?id=20888 link: https://moodle.jyu.fi/course/view.php?id=20888
name: Moodle
- icon: fontawesome/solid/fire - icon: fontawesome/solid/fire
link: https://sisu.jyu.fi/student/courseunit/otm-38b7f26b-1cf9-4d2d-a29b-e1dcb5c87f00 link: https://sisu.jyu.fi/student/courseunit/otm-38b7f26b-1cf9-4d2d-a29b-e1dcb5c87f00
text: Sisu
plugins: - icon: fontawesome/brands/discord
- offline link: https://discord.gg/QfbAjzxJYd
\ No newline at end of file - icon: simple/zoom
link: https://jyufi.zoom.us/j/64685455360