Changes for deployment

This commit is contained in:
Daniel Egger 2022-06-21 13:39:48 +02:00
parent 3dfb9af7c9
commit 9d768c8205
7 changed files with 40 additions and 2 deletions

View File

@ -47,6 +47,7 @@ cap.create_and_update_app(
'IT_DJANGO_SECRET_KEY': env.str('IT_DJANGO_SECRET_KEY'),
'IT_DJANGO_ADMIN_URL': env.str('IT_DJANGO_ADMIN_URL'),
'IT_DJANGO_ALLOWED_HOSTS': env.str('IT_DJANGO_ALLOWED_HOSTS'),
'IT_DJANGO_DEBUG': 'false',
'IT_SENTRY_DSN': env.str('IT_SENTRY_DSN'),
'IT_APP_ENVIRONMENT': 'caprover',
'POSTGRES_HOST': 'srv-captain--vbv-lernwelt-postgres-db',

View File

@ -1,5 +1,8 @@
#!/bin/bash
# script should fail when any process returns non zero code
set -ev
# create client
npm run build

View File

@ -52,6 +52,7 @@ export function parseLearningSequences (children: CircleChild[]): LearningSequen
});
if (learningUnit && learningSequence) {
// TypeScript does not get it here...
(learningSequence as LearningSequence).learningUnits.push(learningUnit);
result.push(learningSequence);
} else {

View File

@ -10,7 +10,7 @@ import MainNavigationBar from '@/components/MainNavigationBar.vue';</script>
<div class="mt-8 flex flex-col lg:flex-row justify-start gap-4">
<router-link class="link text-xl" to="/styleguide">Styelguide</router-link>
<a class="link text-xl" href="/login/">Login</a>
<router-link class="link text-xl" to="/learningpath/versicherungsvermittlerin">Lernpfad "Versicherungsvermittlerin" (Login benötigt)</router-link>
<!-- <router-link class="link text-xl" to="/learningpath/versicherungsvermittlerin">Lernpfad "Versicherungsvermittlerin" (Login benötigt)</router-link>-->
<router-link class="link text-xl" to="/circle/analyse">Circle "Analyse" (Login benötigt)</router-link>
</div>
</main>

View File

@ -4,8 +4,15 @@ set -o errexit
set -o pipefail
set -o nounset
# TODO remove after stabilisation
python /app/manage.py reset_schema
python /app/manage.py collectstatic --noinput
python /app/manage.py createcachetable
python /app/manage.py migrate
# TODO remove after stabilisation
python /app/manage.py create_default_users
python /app/manage.py create_default_learning_path
/usr/local/bin/gunicorn config.asgi --bind 0.0.0.0:80 --chdir=/app -k uvicorn.workers.UvicornWorker

View File

@ -0,0 +1,26 @@
import djclick as click
from django.conf import settings
from django.db import transaction, connection
def reset_schema(db_config_user):
sql_list = (
'DROP SCHEMA public CASCADE',
f'CREATE SCHEMA public AUTHORIZATION {db_config_user}',
'GRANT ALL ON SCHEMA public TO postgres',
'GRANT ALL ON SCHEMA public TO public',
"COMMENT ON SCHEMA public IS 'standard public schema';",
)
with transaction.atomic():
with connection.cursor() as cursor:
for sql in sql_list:
cursor.execute(sql)
@click.command()
def command():
user = settings.DATABASES['default']['USER']
print(user)
reset_schema(db_config_user=user)

View File

@ -200,7 +200,7 @@ class LearningContent(Page):
return display_title
class Meta:
verbose_name = "Learning Unit"
verbose_name = "Learning Content"
def full_clean(self, *args, **kwargs):
self.slug = find_available_slug(LearningContent, slugify(self.title, allow_unicode=True))