Compare commits

...

11 commits

Author SHA1 Message Date
Pablo Ovelleiro Corral 1b7f808804
Add official formatter to flake
Allows running `nix fmt`, which will format using the official style as
agreed upon in nixpkgs
2024-04-28 17:36:45 +02:00
teutat3s f18fee25e4
Merge pull request 'Add .editorconfig file with tabs as indentation' (#172) from feat/add-editorconfig into main
Reviewed-on: pub-solar/infra#172
Reviewed-by: teutat3s <teutat3s@noreply.git.pub.solar>
2024-04-28 15:26:59 +00:00
Hendrik Sokolowski fee6ce74c7
Merge pull request 'docs: add rough documentation about obs-portal' (#173) from feat/obs-portal-nachtigall into main
Reviewed-on: pub-solar/infra#173
Reviewed-by: teutat3s <teutat3s@noreply.git.pub.solar>
2024-04-28 12:13:09 +00:00
Hendrik Sokolowski a278c178b0
docs: obs-portal: add prosaic sugar 2024-04-28 02:03:03 +02:00
Hendrik Sokolowski 75c7e2dcf5
docs: add rough documentation about obs-portal 2024-04-28 01:23:42 +02:00
teutat3s 41798a1cd6
Merge pull request 'obs-portal: init obs-portal on nachtigall' (#115) from feat/obs-portal-nachtigall into main
Reviewed-on: pub-solar/infra#115
Reviewed-by: teutat3s <teutat3s@noreply.git.pub.solar>
2024-04-27 23:14:50 +00:00
Hendrik Sokolowski 10c86c6b20
nachtigall: obs-portal: remove tiles mount 2024-04-28 01:07:49 +02:00
Hendrik Sokolowski 1d6c5003e8
nachtigall: obs-portal: fix dependencies of docker network unit and portal 2024-04-28 01:05:43 +02:00
Hendrik Sokolowski fef1874938
update obs-portal dns target 2024-04-27 22:45:26 +02:00
Hendrik Sokolowski c74394449d
remove git conflict heading 2024-04-27 22:45:21 +02:00
Benjamin Yule Bädorf c49e47dc30
Add .editorconfig file with tabs as indentation
Just use tabs guys
2024-04-27 20:47:07 +02:00
6 changed files with 117 additions and 6 deletions

75
.editorconfig Normal file
View file

@ -0,0 +1,75 @@
# Editor configuration, see http://editorconfig.org
root = true
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = tab
# Ignore diffs/patches
[*.{diff,patch}]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
indent_size = unset
charset = unset
indent_style = unset
indent_size = unset
[{.*,secrets}/**]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
charset = unset
indent_style = unset
indent_size = unset
[*.rom]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
charset = unset
indent_style = unset
indent_size = unset
[*.py]
indent_size = 4
[*.md]
max_line_length = off
trim_trailing_whitespace = false
# Ignore diffs/patches
[*.{diff,patch}]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
indent_size = unset
charset = unset
indent_style = unset
indent_size = unset
[{.*,secrets}/**]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
charset = unset
indent_style = unset
indent_size = unset
[*.rom]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
charset = unset
indent_style = unset
indent_size = unset
[*.py]
indent_size = 4
[*.md]
max_line_length = off
trim_trailing_whitespace = false

32
docs/obs-portal.md Normal file
View file

@ -0,0 +1,32 @@
# OpenBikeSensor Portal
## Docker Containers
* portal
* worker
* db
## Run database migrations
After an upgrade it is sometimes necessary to run database migrations or regenerate tiles.
```
docker exec -ti obs-portal tools/upgrade.py
```
## Dump database
Save database dump to `dump.sql` in the current working directory.
```
docker exec -ti --user postgres obs-portal-db pg_dump obs > dump.sql
```
## Restore database
Load database dump from `dump.sql` file.
`obs` database needs to exist before importing the dump.
```
cat dump.sql | docker exec -ti --user postgres obs-portal-db psql obs
```

View file

@ -86,6 +86,7 @@
inherit username; inherit username;
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib; checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib;
formatter.x86_64-linux = inputs.nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
deploy.nodes = self.lib.deploy.mkDeployNodes self.nixosConfigurations { deploy.nodes = self.lib.deploy.mkDeployNodes self.nixosConfigurations {
nachtigall = { nachtigall = {

View file

@ -59,7 +59,8 @@ in {
in in
{ {
serviceConfig.Type = "oneshot"; serviceConfig.Type = "oneshot";
before = [ "docker-obs-portal.service" ]; before = [ "docker-obs-portal.service" "docker-obs-portal-db.service" "docker-obs-portal-worker.service" ];
requiredBy = [ "docker-obs-portal.service" "docker-obs-portal-db.service" "docker-obs-portal-worker.service" ];
script = '' script = ''
${dockerBin} network inspect obs-portal-net >/dev/null 2>&1 || ${dockerBin} network create obs-portal-net --subnet 172.20.0.0/24 ${dockerBin} network inspect obs-portal-net >/dev/null 2>&1 || ${dockerBin} network create obs-portal-net --subnet 172.20.0.0/24
''; '';
@ -85,7 +86,11 @@ in {
containers."obs-portal" = { containers."obs-portal" = {
image = "git.pub.solar/pub-solar/obs-portal:latest"; image = "git.pub.solar/pub-solar/obs-portal:latest";
autoStart = true; autoStart = true;
ports = [ "localhost:3001:${env.OBS_PORT}" ]; ports = [ "127.0.0.1:3001:${env.OBS_PORT}" ];
dependsOn = [
"obs-portal-db"
"obs-portal-worker"
];
environment = env; environment = env;
environmentFiles = [ config.age.secrets.obs-portal-env.path ]; environmentFiles = [ config.age.secrets.obs-portal-env.path ];
@ -93,7 +98,6 @@ in {
volumes = [ volumes = [
"${configPy}:/opt/obs/api/config.py" "${configPy}:/opt/obs/api/config.py"
"/var/lib/obs-portal${env.OBS_DATA_DIR}:${env.OBS_DATA_DIR}" "/var/lib/obs-portal${env.OBS_DATA_DIR}:${env.OBS_DATA_DIR}"
"/var/lib/obs-portal/tiles/:/tiles"
"/var/lib/obs-portal/pbf/:/pbf" "/var/lib/obs-portal/pbf/:/pbf"
]; ];

View file

@ -1,5 +1,4 @@
let let
<<<<<<< HEAD
admins = import ../logins/admins.nix; admins = import ../logins/admins.nix;
nachtigall-host = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP7G0ufi+MNvaAZLDgpieHrABPGN7e/kD5kMFwSk4ABj root@nachtigall"; nachtigall-host = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP7G0ufi+MNvaAZLDgpieHrABPGN7e/kD5kMFwSk4ABj root@nachtigall";

View file

@ -36,8 +36,8 @@ resource "namecheap_domain_records" "pub-solar" {
} }
record { record {
hostname = "obs-portal" hostname = "obs-portal"
type = "A" type = "CNAME"
address = "80.71.153.210" address = "nachtigall.pub.solar."
} }
record { record {
hostname = "vpn" hostname = "vpn"