Skip to content

Commit b56d168

Browse files
authored
Merge pull request #21 from midarrlabs/feature/refactor-integrations
Feature/refactor integrations
2 parents 0174576 + 13e7426 commit b56d168

File tree

54 files changed

+519
-1181
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+519
-1181
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/feature.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Feature
2+
3+
on:
4+
push:
5+
branches: [ 'feature/**' ]
6+
7+
jobs:
8+
test:
9+
name: Test
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out code
13+
uses: actions/checkout@v2
14+
15+
- name: Up services
16+
run: docker compose up -d
17+
18+
- name: Run tests
19+
run: docker run --network=midarr-server_default --env DB_USERNAME=my_user --env DB_PASSWORD=my_password --env DB_DATABASE=my_database --env DB_HOSTNAME=postgresql --env TEST_DB_HOSTNAME=test-postgresql --mount type=bind,src=${GITHUB_WORKSPACE}/fixtures/movies,dst=/movies --mount type=bind,src=${GITHUB_WORKSPACE}/fixtures/shows,dst=/shows midarr-server_midarr:latest mix test

.github/workflows/master.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ jobs:
99
name: Test
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Check out code
13-
uses: actions/checkout@v2
12+
- name: Check out code
13+
uses: actions/checkout@v2
14+
15+
- name: Up services
16+
run: docker compose up -d
1417

15-
- name: Run tests
16-
run: docker compose up test
18+
- name: Run tests
19+
run: docker run --network=midarr-server_default --env DB_USERNAME=my_user --env DB_PASSWORD=my_password --env DB_DATABASE=my_database --env DB_HOSTNAME=postgresql --env TEST_DB_HOSTNAME=test-postgresql --mount type=bind,src=${GITHUB_WORKSPACE}/fixtures/movies,dst=/movies --mount type=bind,src=${GITHUB_WORKSPACE}/fixtures/shows,dst=/shows midarr-server_midarr:latest mix test
1720

1821
release:
1922
needs: test

README.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,19 @@ services:
8181
- DB_PASSWORD=my_password
8282
- DB_DATABASE=my_database
8383
- DB_HOSTNAME=postgresql
84+
85+
# Initialise admin account
8486
8587
- SETUP_ADMIN_NAME=admin
8688
- SETUP_ADMIN_PASSWORD=passwordpassword # min length 12
89+
90+
# Radarr integration
91+
- RADARR_BASE_URL=radarr:7878
92+
- RADARR_API_KEY=someApiKey
93+
94+
# Sonarr integration
95+
- SONARR_BASE_URL=sonarr:8989
96+
- SONARR_API_KEY=someApiKey
8797
depends_on:
8898
postgresql:
8999
condition: service_healthy
@@ -113,7 +123,7 @@ volumes:
113123
```
114124
This is so `Midarr` has the same reference to your media library as your integrations, and can serve them.
115125

116-
#### Setup
126+
#### Initialise admin account
117127

118128
An admin account will be initialised for you on server startup, provided you have these `environment` variables configured:
119129

@@ -125,6 +135,24 @@ environment:
125135
```
126136
Login with these credentials, and access the `Settings` page to configure your server.
127137

138+
#### Radarr integration
139+
140+
```yaml
141+
environment:
142+
- RADARR_BASE_URL=radarr:7878
143+
- RADARR_API_KEY=someApiKey
144+
```
145+
Provide these environment variables to integrate your Radarr instance.
146+
147+
#### Sonarr integration
148+
149+
```yaml
150+
environment:
151+
- SONARR_BASE_URL=sonarr:8989
152+
- SONARR_API_KEY=someApiKey
153+
```
154+
Provide these environment variables to integrate your Sonarr instance.
155+
128156
## Video support
129157

130158
* Video H.264
@@ -133,13 +161,13 @@ Login with these credentials, and access the `Settings` page to configure your s
133161

134162
## Contributing
135163

136-
Thank you for your contributions! Big or small - we welcome all!
164+
Thank you for all your contributions! Big or small - all is welcome!
137165

138166
## License
139167

140168
`Midarr` is open-sourced software licensed under the [MIT license](LICENSE).
141169

142-
## Screenshots
170+
## Preview
143171

144172
![Preview](docs/online.png)
145173
![Preview](docs/series.png)

config/dev.exs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,9 @@ config :phoenix, :stacktrace_depth, 20
7272

7373
# Initialize plugs at runtime for faster development compilation
7474
config :phoenix, :plug_init_mode, :runtime
75+
76+
config :media_server,
77+
movies_base_url: System.get_env("RADARR_BASE_URL"),
78+
movies_api_key: System.get_env("RADARR_API_KEY"),
79+
series_base_url: System.get_env("SONARR_BASE_URL"),
80+
series_api_key: System.get_env("SONARR_API_KEY")

config/test.exs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ config :media_server, MediaServer.Repo,
1212
username: System.get_env("DB_USERNAME"),
1313
password: System.get_env("DB_PASSWORD"),
1414
database: System.get_env("DB_DATABASE"),
15-
hostname: System.get_env("DB_HOSTNAME"),
15+
hostname: System.get_env("TEST_DB_HOSTNAME"),
1616
pool_size: 10,
1717
pool: Ecto.Adapters.SQL.Sandbox
1818

@@ -31,3 +31,9 @@ config :logger, level: :warn
3131

3232
# Initialize plugs at runtime for faster test compilation
3333
config :phoenix, :plug_init_mode, :runtime
34+
35+
config :media_server,
36+
movies_base_url: "radarr:7878",
37+
movies_api_key: "d031e8c9b9df4b2fab311d1c3b3fa2c5",
38+
series_base_url: "sonarr:8989",
39+
series_api_key: "1accda4476394bfcaddefe8c4fd77d4a"

docker-compose.yml

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
version: "3.4"
22

33
services:
4-
web:
4+
5+
midarr:
6+
container_name: midarr
57
build: .
68
ports:
79
- 4000:4000
@@ -14,32 +16,54 @@ services:
1416
- DB_PASSWORD=my_password
1517
- DB_DATABASE=my_database
1618
- DB_HOSTNAME=postgresql
19+
20+
- SETUP_ADMIN_NAME=admin
21+
- SETUP_ADMIN_PASSWORD=passwordpassword
22+
- TEST_DB_HOSTNAME=test-postgresql
23+
- RADARR_BASE_URL=radarr:7878
24+
- RADARR_API_KEY=d031e8c9b9df4b2fab311d1c3b3fa2c5
25+
- SONARR_BASE_URL=sonarr:8989
26+
- SONARR_API_KEY=1accda4476394bfcaddefe8c4fd77d4a
1727
depends_on:
1828
postgresql:
1929
condition: service_healthy
30+
test-postgresql:
31+
condition: service_healthy
2032
radarr:
2133
condition: service_healthy
2234
sonarr:
2335
condition: service_healthy
24-
command: bash -c "mix ecto.migrate && mix phx.server"
36+
command: bash -c "mix ecto.migrate && mix run priv/repo/seeds.exs && mix phx.server"
2537

2638
postgresql:
27-
image: bitnami/postgresql:14
39+
container_name: postgresql
40+
image: postgres
2841
ports:
2942
- 5432:5432
3043
environment:
31-
- POSTGRESQL_USERNAME=my_user
32-
- POSTGRESQL_PASSWORD=my_password
33-
- POSTGRESQL_DATABASE=my_database
44+
- POSTGRES_USER=my_user
45+
- POSTGRES_PASSWORD=my_password
46+
- POSTGRES_DB=my_database
47+
healthcheck:
48+
test: "exit 0"
49+
50+
test-postgresql:
51+
container_name: test-postgresql
52+
image: postgres
53+
environment:
54+
- POSTGRES_USER=my_user
55+
- POSTGRES_PASSWORD=my_password
56+
- POSTGRES_DB=my_database
3457
healthcheck:
3558
test: "exit 0"
3659

3760
radarr:
38-
image: lscr.io/linuxserver/radarr
61+
container_name: radarr
62+
image: linuxserver/radarr:3.2.2
3963
ports:
4064
- 7878:7878
4165
volumes:
42-
- ./fixtures/radarr:/config
66+
- ./fixtures/radarr/config.xml:/config/config.xml
4367
- ./fixtures/movies:/movies
4468
environment:
4569
- PUID=1000
@@ -48,33 +72,15 @@ services:
4872
test: "exit 0"
4973

5074
sonarr:
51-
image: lscr.io/linuxserver/sonarr
75+
container_name: sonarr
76+
image: linuxserver/sonarr:3.0.6
5277
ports:
5378
- 8989:8989
5479
volumes:
55-
- ./fixtures/sonarr:/config
80+
- ./fixtures/sonarr/config.xml:/config/config.xml
5681
- ./fixtures/shows:/shows
5782
environment:
5883
- PUID=1000
5984
- PGID=1000
6085
healthcheck:
61-
test: "exit 0"
62-
63-
test:
64-
build: .
65-
volumes:
66-
- ./fixtures/movies:/movies
67-
- ./fixtures/shows:/shows
68-
environment:
69-
- DB_USERNAME=my_user
70-
- DB_PASSWORD=my_password
71-
- DB_DATABASE=my_database
72-
- DB_HOSTNAME=postgresql
73-
depends_on:
74-
postgresql:
75-
condition: service_healthy
76-
radarr:
77-
condition: service_healthy
78-
sonarr:
79-
condition: service_healthy
80-
command: bash -c "mix ecto.migrate && mix test"
86+
test: "exit 0"
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)