Skip to content

Commit

Permalink
Merge pull request #176 from json-scada/master
Browse files Browse the repository at this point in the history
Fix syntax error in dev.nix file.
  • Loading branch information
riclolsen authored Dec 1, 2024
2 parents 397d6f3 + ad27e31 commit ddb9525
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
1 change: 0 additions & 1 deletion .idx/dev.nix
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
mongoimport --db json_scada --collection realtimeData --type json --file ~/json-scada/demo-docker/mongo_seed/files/demo_data.json &&
mongoimport --db json_scada --collection processInstances --type json --file ~/json-scada/demo-docker/mongo_seed/files/demo_process_instances.json &&
mongoimport --db json_scada --collection users --type json --file ~/json-scada/demo-docker/mongo_seed/files/demo_users.json &&
mongosh json_scada --eval \"db.realtimeData.updateMany({_id:{$gt:0}},{$set:{dbId:'demo'}})\"
";
init-postgresql = "
mkdir -p ~/postgres &&
Expand Down
36 changes: 22 additions & 14 deletions platform-nix-idx/dev.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
channel = "stable-23.11"; # or "unstable"

# Use https://search.nixos.org/packages to find packages
packages = [
packages = [
pkgs.postgresql_15_jit
pkgs.postgresql15Packages.timescaledb
pkgs.postgresql15Packages.timescaledb_toolkit
pkgs.util-linux.bin
pkgs.dotnet-sdk_8
pkgs.vscode-extensions.ms-dotnettools.csharp
Expand All @@ -30,14 +33,14 @@
# pkgs.nodePackages.nodemon
];

services.postgres = {
extensions = [
"timescaledb"
"timescaledb_toolkit"
];
enable = true;
};
# services.mongodb.enable = true;
#services.postgres = {
# extensions = [
# "timescaledb"
# "timescaledb_toolkit"
# "pgvector"
# ];
# enable = true;
#};
services.docker.enable = true;

# Sets environment variables in the workspace
Expand Down Expand Up @@ -70,8 +73,6 @@
workspace = {
# Runs when a workspace is first created
onCreate = {
# Example: install JS dependencies from NPM
# npm-install = "npm install";
init-mongodb = "
mkdir -p ~/mongodb/var/lib/mongo/ &&
mkdir -p ~/mongodb/var/log/mongodb/ &&
Expand All @@ -83,11 +84,17 @@
mongoimport --db json_scada --collection realtimeData --type json --file ~/json-scada/demo-docker/mongo_seed/files/demo_data.json &&
mongoimport --db json_scada --collection processInstances --type json --file ~/json-scada/demo-docker/mongo_seed/files/demo_process_instances.json &&
mongoimport --db json_scada --collection users --type json --file ~/json-scada/demo-docker/mongo_seed/files/demo_users.json &&
mongosh json_scada --eval \"db.realtimeData.updateMany({_id:{\$gt:0}},{\$set:{dbId:'demo'}})\" &&
";
init-postgresql = "
mkdir -p ~/postgres &&
initdb -D ~/postgres &&
cp ~/json-scada/platform-nix-idx/postgresql.conf ~/postgres/postgresql.conf &&
cp ~/json-scada/platform-nix-idx/pg_hba.conf ~/postgres/pg_hba.conf &&
/usr/bin/pg_ctl -D /home/user/postgres start &&
/usr/bin/createuser -h localhost -s postgres &&
psql -U postgres -w -h localhost -f ~/json-scada/sql/create_tables.sql template1 &&
psql -U postgres -w -h localhost -f ~/json-scada/sql/metabaseappdb.sql metabaseappdb &&
psql -U postgres -w -h localhost -f ~/json-scada/sql/grafanaappdb.sql grafanaappdb &&
psql -U postgres -w -h localhost -d json_scada -c \"CREATE EXTENSION timescaledb_toolkit;\"
psql -U postgres -w -h localhost -f ~/json-scada/sql/grafanaappdb.sql grafanaappdb
";
build-jsonscada = "cd ~/json-scada/platform-linux && ./build.sh";
};
Expand All @@ -96,6 +103,7 @@
# Example: start a background task to watch and re-build backend code
# watch-backend = "npm run watch-backend";
start-mongodb = "/usr/bin/mongod -f ~/json-scada/platform-nix-idx/mongod.conf";
start-supervisor = "(supervisord -c ~/json-scada/platform-nix-idx/supervisord.conf &)";
};
};
};
Expand Down

0 comments on commit ddb9525

Please sign in to comment.