Shimatta Kenkyusho (しまった・研究所) is a Django based web application. It is highly recommended to run it using the supplied docker setup. This removes the need of any special installation on the host system. This guide assumes, that `nginx` is running on the host system and can serve as a reverse proxy and webserver. For easiest download, it is recommended to clone the desired release with `git`
> Note: Shimatta Kenkyusho is currently not stable yet and the newest verison is in the `develop` branch. This will change once actual releases are done and merged to the `master` branch. You will be able to get the latest stable version from the `master` branch or a respective tag. For now, the `develop` is recommended.
Change directory into the `shimatta-kenkyusho` folder cloned by git.
Copy the `example.env` file to `.env` and edit it according to your needs:
The following settings are required to be adapted:
-`DJANGO_STATIC_VOL`: The directory the application will extract its static data into, which needs to be served by your webserver. See the example reverse proxy setup for more details.
-`DJANGO_MEDIA_VOL`: The directory all media files like images uploaded to the application are stored here. This folder must be served by your webserver on the configured media URL.
-`PGDATA_VOL`: The directory, the postgres database will store its files.
-`PORT`: The TCP/IP port that the whole setup will listen on. Use a reverse proxy to forward to this port. Do not directly expose it to the internet!
-`DJANGO_SECRET_KEY`: Provide a secret, and randomly generated key. Do not share this with anybody!
-`DJANGO_ALLOWED_HOST`: Set this to the domain, the application will be reached at. E.g: `lab.example.com`
-`DJANGO_MEDIA_URL`: Set this to the media URL at which your webserver serves the `DJANGO_MEDIA_VOL` diretory. E.g: `media.lab.example.com/` Note the **slash at the end**. It is important.
-`DJANGO_USER_ID`: The user ID to run the application inside the docker container. This is the user id, that is used to write the to `DJANGO_STATIC_VOL` and `DJANGO_MEDIA_VOL`. Make sure the user has access.
-`DJANGO_USER_GID`: The group ID to run the application inside the docker container. This is the group id, that is used to write the to `DJANGO_STATIC_VOL` and `DJANGO_MEDIA_VOL`.
> Note: It is not recommended to run the docker container without a set `DJANGO_USER_ID` and `DJANGO_USER_GID`. It will default to `0 (root)`.
Once the environment is set up, the docker containers can be built and started. Run
```
$ docker compose build
```
This will generate two container images:
1.`shimatta-kenkyusho-shimatta-kenkyusho-web`: The django application
2.`postgres`: A alpine based docker container containing the postgres database.
Start the application as a service with
```
$ docker compose up -d
```
> Note: The initial startup might need a minute because the whole database etc needs to be initialized first.
Use
```
$ docker ps
```
to check if the `shimatta-kenkyusho-shimatta-kenkyusho-db` and the `shimatta-kenkyusho-shimatta-kenkyusho-web` container are running and report a *healthy status*.
When started the for the first time with a fresh database without any superuser configured, a superuser `admin` with password `admin` will be automatically generated.
Use this user to login for the first time. In the django admin panel you can then either change the password of the `admin` user or create a new superuser with your own username and delete the `admin` user.
As long as there is at least one superuser configured, no admin user will be regenerated upon startup.
root /path/to /DJANGO_MEDIA_VOL/; # Adapt this to the volume provided.
}
```
Congratulations. Your shimatta kenkyusho installation is now fully setup.
> Note that, the `compose.yaml` contains a restart-policy. By default the contianers will restart automatically, even after a reboot of the host machine, if the docker service is enabled.