Go to file
Elia Bieri 10f34f53d8 Merged in feature/storybook (pull request #49)
Integrate Storybook

* Merged in feature/caprover-deploy (pull request #47)

Feature/caprover deploy

Approved-by: Christian Cueni
* Merge branch 'feature/storybook' of bitbucket.org:iterativ/vbv_lernwelt into feature/storybook

* Add stories

* Add BuenosAires font to storybook

* Mute typecheck error

* Update bitbucket deployment

* Add ItNavigationProgress component

* Update pipelines file

* Update pipelines file

* Merged develop into feature/storybook

Approved-by: Daniel Egger
2023-03-29 13:45:13 +00:00
.git-crypt Add 1 git-crypt collaborator 2022-11-08 17:05:13 +01:00
client Merged in feature/storybook (pull request #49) 2023-03-29 13:45:13 +00:00
compose/django Merged in feature/storybook (pull request #49) 2023-03-29 13:45:13 +00:00
cypress Merged in feature/VBV-260-implement-new-learnpath (pull request #28) 2023-03-02 16:58:16 +00:00
docs Change model name 2023-01-10 08:09:16 +01:00
env Merged in feature/storybook (pull request #49) 2023-03-29 13:45:13 +00:00
env_secrets Merged in feature/notifications (pull request #15) 2023-02-08 11:39:27 +00:00
scripts Add page cache for learningpath pages 2022-07-05 15:44:11 +02:00
server Merged in feature/storybook (pull request #49) 2023-03-29 13:45:13 +00:00
.dockerignore Merged in feature/storybook (pull request #49) 2023-03-29 13:45:13 +00:00
.editorconfig Rename env variable stuff 2022-05-25 18:31:43 +02:00
.gitattributes Add wbt files to git lfs 2022-10-12 17:22:03 +02:00
.gitignore Add package-lock.json to repo to prevent unforeseen dependency issues 2022-11-10 10:34:01 +01:00
.npmrc Merged in feature/storybook (pull request #49) 2023-03-29 13:45:13 +00:00
.pre-commit-config.yaml Initial commit after cookiecutter 2022-02-02 09:10:21 +01:00
.tool-versions VBV-142: move "/media" to "/static/media" 2022-09-09 11:56:49 +02:00
README.md Merged in feature/storybook (pull request #49) 2023-03-29 13:45:13 +00:00
README_generated.md Setup working locally 2022-02-02 09:35:02 +01:00
bitbucket-pipelines.yml Merged in feature/storybook (pull request #49) 2023-03-29 13:45:13 +00:00
caprover_cleanup.py Merged in feature/storybook (pull request #49) 2023-03-29 13:45:13 +00:00
caprover_create_app.py Merged in feature/storybook (pull request #49) 2023-03-29 13:45:13 +00:00
caprover_deploy.sh Merged in feature/storybook (pull request #49) 2023-03-29 13:45:13 +00:00
cypress.config.js Initial currents.dev integration 2022-12-13 10:46:41 +01:00
docker-compose-local.yml Make docker compose work locally 2022-02-02 23:01:22 +01:00
example.env Rename env variable stuff 2022-05-25 18:31:43 +02:00
format_code.sh Refactor media content data models 2022-10-04 14:42:34 +02:00
git-crypt-encrypted-files.txt Fix in itPost 2023-02-14 10:31:36 +01:00
git-pre-commit.sh Refactor media content data models 2022-10-04 14:42:34 +02:00
git-pre-push.sh Add typecheck to pipelines 2022-10-21 16:58:25 +02:00
package-lock.json Merged in feature/storybook (pull request #49) 2023-03-29 13:45:13 +00:00
package.json Change order of npm run command 2023-02-20 11:39:23 +01:00
prepare_server.sh Merged in feature/notifications (pull request #15) 2023-02-08 11:39:27 +00:00
prepare_server_cypress.sh Make use of existing magic env variables for django and psql 2022-11-09 10:54:01 +01:00
requests.http WIP: Setup i18n 2022-10-27 16:09:06 +02:00
trufflehog-allow.json WIP: Add tests 2023-01-10 08:05:02 +01:00
trufflehog-exclude-patterns.txt Merged in feature/storybook (pull request #49) 2023-03-29 13:45:13 +00:00

README.md

VBV Lernwelt

Project setup is based on cookiecutter-django project template.

Run for development

# run vue vite dev server
cd client && npm run dev

# reset db and run django dev server
./prepare_server.sh

Installation

See .tool-versions file for used django and node version

You have to set up at least the following environment variables:

export IT_APP_ENVIRONMENT=development

See .env_secrets/local_daniel.env for more possible environment variables. Especially set correct values for POSTGRES_* and DATABASE_URL

Install git-lfs

brew install git-lfs
git lfs install

Server part

Install python dependencies:

pip install -r server/requirements/requirements-dev.txt

The "prepare_server.sh" script will create the database according to POSTGRES_* environment variables. It will also setup the tables for django and run the django development server.

# will run `migrate` and `runserver` etc...
./prepare_server.sh

# or async server
# uvicorn config.asgi:application --host 0.0.0.0 --reload

Client part

cd client

npm install

# run dev server
npm run dev

General part

Cypress is installed for client and server, so there is this package.json on the project root directory

# in project root directory
npm install

Git hooks

# install pre-push git hook
# add this line to the existing script in .git/hooks/pre-push
./git-pre-push.sh

Actions on Save

You can enable some useful "Actions on Save" in your JetBrains IDE:

Preferences -> Tools -> Actions on Save

  • Reformat Code
  • Optimize Imports
  • Run eslint --fix
  • Run prettier

Translations

We use (vue-i18n)[https://kazupon.github.io/vue-i18n/] for translations and (vue-i18n-extract)[https://github.com/Spittal/vue-i18n-extract] for helper scripts.

# will create a report on command line with missing translations
npm run vue-i18n-extract

# add missing translations to files, see docs for more options
cd client
npx vue-i18n-extract --add

Deployment to CapRover

CapRover Dev (vbv-lernwelt.control.iterativ.ch)

# run deploy script
./caprover_deploy.sh vbv-lernwelt

# of vbv-lernwelt is default value
./caprover_deploy.sh

CapRover Stage (myvbv-stage.iterativ.ch)

./caprover_deploy.sh myvbv-stage

CapRover Prod (myvbv.iterativ.ch)

./caprover_deploy.sh myvbv

CapRover feature branch deployment

You can deploy every feature branch to CapRover directly from Bitbucket Pipelines with a manual step.

When you run caprover_deploy.sh without arguments, it will deploy the current branch

./caprover_deploy.sh

Cleanup caprover feature branch deployments

python caprover_cleanup.py

IntelliJ Configuration

  • In the .idea/vbv_lernwelt.iml file change the module type to "PYTHON_MODULE".
  • Add django facet in "Project Structure".
  • Run configuration with "Python -> server.py" to have async debugging support.

Optional

Install the EnvFile Plugin

Install the tailwind css Plugin from Jetbrains

currents.dev

This project uses currents.dev to run the Cypress tests concurrently.
The following steps were taken to set it up:

  • Create a new project on currents.dev
  • Add the generated projectId to the cypress configuration file
  • Install @currents/cli as a dev dependency
  • Add the following script to the package.json file:
    "cypress:ci": "currents run --parallel --record --key $CURRENTS_KEY",
    
  • Create a new Bitbucket pipelines job that exports the CURRENTS_KEY and runs the cypress:ci script
  • Refactor the pipeline steps so that the dependencies are installed first and then the other steps are run in parallel.
    You can then run multiple instances of the previously created job in parallel.
    See .bitbucket-pipelines.yml for an example.

💡 The number of cypress worker jobs depends on the number of cypress tests. Too many workers for too few tests will result in a lot of idle workers.

Frontend folder structure

There are some rules when it comes to the folder structure of the frontend.

  • Every page should have its own folder in the pages folder.
  • A page component name must have the Page suffix. E.g. MyPage.vue.
  • A page is defined by being a routing target.
  • The components solely being used in a page should be in the same folder as the page.
📦 client
└─ pages
   ├─ AbcPage.vue
   ├─ AbcButton.vue
   └─ AbcListTile.vue