Compare commits

..

No commits in common. "9e72b5891722515c412978f70c7a65102dc72104" and "b51f00e49972deb83b33aa46497480d160951862" have entirely different histories.

2 changed files with 2 additions and 17 deletions

View File

@ -10,20 +10,12 @@ NATS_VERSION := 2.12.0-alpine3.22
dockerize-db:
docker rm -f $(DB_NAME)
docker run --name $(DB_NAME) -e POSTGRES_PASSWORD=secret -e POSTGRES_USER=developer -e POSTGRES_DB=$(DB_NAME) -p 5432:5432 -d timescale/timescaledb-ha:$(TIMESCALE_VERSION)
sleep 10
make migrateup
.PHONY: dockerize-nats
# Remove and create a NATS server.
dockerize-nats:
docker rm -f $(NATS_NAME)
docker run --name $(NATS_NAME) -p 4222:4222 -d nats:$(NATS_VERSION)
sleep 5
.PHONY: migrateup
# Migrate all schemas, triggers and data located in database/migrations.
migrateup:
go run -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest -path app/database -database "postgresql://developer:secret@localhost:5432/$(DB_NAME)?sslmode=disable" -verbose up
.PHONY: run
# Start app in development environment
@ -33,11 +25,4 @@ run:
.PHONY: run-prod
run-prod:
# Start app in production environment
go run ./app/. -env=prod
.PHONY: lazy-start
lazy-start:
# Install dependencies, tools, dockerize containers, run tests and run app.
make dockerize-db
make dockerize-nats
make run-prod
go run ./app/. -env=prod

View File

@ -25,7 +25,7 @@ create index idx_sensors_sensor_id on sensors (sensor_id);
create table registry
(
sensor_id varchar(255) not null references sensors (sensor_id),
sensor_id int not null references sensors (id),
value float not null,
created_at timestamp not null default now()