# Tagesschule elementa

ssh tagesschule@docker.mprofiag.de
sudo ./docker-update.sh

## Docker

1. Copy environment files `.env*.example` to `.env*` and make the configuration changes.
Configure database user and ports for docker.
    - HTTP_PORT=8009 [.env] ...
          
      
2. Main app has several mountpoints / volumes. Point them into the appropriate location on 
your filesystem  
    - ./docker/static_collected 
    - ./docker/data/media
    - ./docker/data
    
3. To start

        docker-compose up
          
4. Restore DB   

        docker exec -i tagesschule_db_1 pg_restore -U django --no-owner -d db < 41ebf901-4607-4653-9b00-54a42d877b38.dump       

3. Migrate

        docker-compose exec web manage.py migrate

5. Add admin user

In docker container `docker-compose exec web bash` run

    python manage.py shell
    
In that shell create admin user (https://stackoverflow.com/questions/18503770/how-to-create-user-from-django-shell)     

    user@host> manage.py shell
    >>> from django.contrib.auth.models import User
    >>> user=User.objects.create_user('foo', password='bar')
    >>> user.is_superuser=True
    >>> user.is_staff=True
    >>> user.save()

