kapsikkum-unmanic – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | # Unmanic development |
2 | |||
3 | The development environment can be configured in 2 ways: |
||
4 | |||
5 | 1. Using Docker |
||
6 | |||
7 | 2. As a Pip develop installation |
||
8 | |||
9 | |||
10 | Depending on what you are trying to develop, one way may work better than the other. |
||
11 | |||
12 | Regardless of the method you use, you will need to pull in the frontend component and build it. |
||
13 | |||
14 | |||
15 | |||
16 | ## Dev env |
||
17 | |||
18 | ### Option 1: Docker |
||
19 | |||
20 | Docker is by far the simplest way to develop. You can either pull the latest Docker image, or build |
||
21 | the docker image by following the [Docker documentation](../docker/README.md) |
||
22 | |||
23 | Once you have a Docker image, you can run it using the scripts in the `../devops/` directory. |
||
24 | |||
25 | Examples: |
||
26 | ``` |
||
27 | # Enable VAAPI |
||
28 | devops/run_docker.sh --debug --hw=vaapi --cpus=1 |
||
29 | |||
30 | # Enable NVIDIA |
||
31 | devops/run_docker.sh --debug --hw=nvidia --cpus=1 |
||
32 | |||
33 | # Standard dev env |
||
34 | devops/run_docker.sh --debug |
||
35 | ``` |
||
36 | |||
37 | The following folders are generated in the Docker environment: |
||
38 | |||
39 | - `/dev_environment/config` - Contains the containers mutable config data |
||
40 | - `/dev_environment/library` - A library in which media files can be placed for testing |
||
41 | - `/dev_environment/cache` - The temporary location used by ffmpeg for converting file formats |
||
42 | |||
43 | ### Option 2: Pip |
||
44 | |||
45 | You can also just install the module natively in your home directory in "develop" mode. |
||
46 | |||
47 | Start by creating a venv. |
||
48 | ``` |
||
49 | python3 -m venv venv |
||
50 | echo 'export HOME_DIR=$(readlink -e ${VIRTUAL_ENV}/../)/dev_environment' >> ./venv/bin/activate |
||
51 | source ./venv/bin/activate |
||
52 | ``` |
||
53 | |||
54 | Then install the dependencies into that venv |
||
55 | ``` |
||
56 | python3 -m pip install --upgrade pip |
||
57 | python3 -m pip install --upgrade -r ./requirements.txt -r ./requirements-dev.txt |
||
58 | ``` |
||
59 | |||
60 | Then install the module: |
||
61 | |||
62 | ``` |
||
63 | python3 -m pip install --editable . |
||
64 | ``` |
||
65 | |||
66 | This creates an egg symlink to the project directory for development. |
||
67 | |||
68 | To later uninstall the development symlink: |
||
69 | |||
70 | ``` |
||
71 | python3 -m pip uninstall unmanic |
||
72 | ``` |
||
73 | |||
74 | You should now be able to run unmanic from the commandline: |
||
75 | ``` |
||
76 | # In develop mode this should return "UNKNOWN" |
||
77 | unmanic --version |
||
78 | ``` |
||
79 | |||
80 | |||
81 | |||
82 | ## Building the Frontend |
||
83 | |||
84 | The Unmanic frontend UI exists in a submodule. |
||
85 | |||
86 | Start by pulling the latest changes |
||
87 | |||
88 | ``` |
||
89 | git submodule update --init --recursive |
||
90 | ``` |
||
91 | |||
92 | Once you have done this, run the frontend_install.sh script. |
||
93 | |||
94 | ``` |
||
95 | devops/frontend_install.sh |
||
96 | ``` |
||
97 | |||
98 | This will install the NPM modules and build the frontend package. The end result will be located in `unmanic/webserver/public` |
||
99 | |||
100 | |||
101 | |||
102 | ## Database upgrades |
||
103 | |||
104 | This project uses Peewee migrations for managing the sqlite database. |
||
105 | `devops/migrations.sh` provides a small wrapper for the cli tool. To get started, run: |
||
106 | ``` |
||
107 | devops/migrations.sh --help |
||
108 | ``` |