-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #361 from fablabbcn/mqtt-task-shared-subscription
MQTT subscription
- Loading branch information
Showing
20 changed files
with
147 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -620,4 +620,4 @@ RUBY VERSION | |
ruby 3.0.6p216 | ||
|
||
BUNDLED WITH | ||
2.5.20 | ||
2.5.21 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
services: | ||
mqtt-task: | ||
build: ../ | ||
env_file: ../.env | ||
command: ./mqtt_subscriber.sh | ||
restart: always | ||
volumes: | ||
- "../log:/app/log" | ||
logging: | ||
driver: "json-file" | ||
options: | ||
max-size: "100m" | ||
environment: | ||
db_pool_size: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
services: | ||
mqtt-task: | ||
build: ../ | ||
env_file: ../.env | ||
command: bundle exec rake mqtt:sub | ||
restart: always | ||
volumes: | ||
- "../log:/app/log" | ||
logging: | ||
driver: "json-file" | ||
options: | ||
max-size: "100m" | ||
environment: | ||
db_pool_size: 5 | ||
mqtt-task-main-1: | ||
extends: | ||
file: mqtt-task-common.yml | ||
service: mqtt-task | ||
environment: | ||
MQTT_CLIENT_ID: smartcitizen-api-staging-main-1 | ||
MQTT_CLEAN_SESSION: false | ||
mqtt-task-main-2: | ||
extends: | ||
file: mqtt-task-common.yml | ||
service: mqtt-task | ||
environment: | ||
MQTT_CLIENT_ID: smartcitizen-api-staging-main-2 | ||
MQTT_CLEAN_SESSION: false | ||
mqtt-task-secondary: | ||
extends: | ||
file: mqtt-task-common.yml | ||
service: mqtt-task | ||
environment: | ||
MQTT_CLIENT_ID: "smartcitizen-api-staging-secondary" | ||
MQTT_CLEAN_SESSION: true | ||
deploy: | ||
mode: replicated | ||
replicas: 2 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ services: | |
command: bundle exec rake telnet:push | ||
restart: always | ||
environment: | ||
db_pool_size: 5 | ||
db_pool_size: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class UniqueIndexOnComponents < ActiveRecord::Migration[6.1] | ||
def up | ||
remove_index :components, [:device_id, :sensor_id] | ||
add_index :components, [:device_id, :sensor_id], unique: true | ||
execute %{ | ||
ALTER TABLE components ADD CONSTRAINT unique_sensor_for_device UNIQUE (device_id, sensor_id) | ||
} | ||
execute %{ | ||
ALTER TABLE components ADD CONSTRAINT unique_key_for_device UNIQUE (device_id, key) | ||
} | ||
end | ||
|
||
def down | ||
execute %{ | ||
ALTER TABLE components DROP CONSTRAINT IF EXISTS unique_key_for_device | ||
} | ||
execute %{ | ||
ALTER TABLE components DROP CONSTRAINT IF EXISTS unique_sensor_for_device | ||
} | ||
remove_index :components, [:device_id, :sensor_id], unique: true | ||
add_index :components, [:device_id, :sensor_id] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
bundle exec rake mqtt:sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters