Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,8 @@ By default, the backup will take place at midnight every day.
* `az_container`: Defaults to `AZURE_STORAGE_CONTAINER`, required.
* `az_blob_object`: Object to restore DB from. Defaults to `AZURE_STORAGE_BLOB_OBJECT`, required.

- `drop`: Drops Elasticsearch and PostgreSQL DB
* Runs `drop:elastic` and `drop:db` via environmental configuration

- `drop:elastic`: Deletes all elastic indices tables
* `host`: Defaults to `ES_HOST` || `"localhost"`
* `port`: Defaults to `ES_PORT` || `9200`
- `drop`: Drops the PostgreSQL DB
* Runs `drop:db` via environmental configuration

- `drop:db`: Drops all PostgreSQL DB tables
* `db`: Defaults `PG_DB` || `"postgres"`
Expand Down
3 changes: 0 additions & 3 deletions src/constants.cr
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ module PlaceOS

# Resource configurations

ES_HOST = ENV["ES_HOST"]? || "localhost"
ES_PORT = ENV["ES_PORT"]?.try &.to_i || 9200

PG_DB = ENV["PG_DB"]? || "postgres"
PG_HOST = ENV["PG_HOST"]? || "localhost"
PG_PORT = ENV["PG_PORT"]?.try &.to_i || 5432
Expand Down
11 changes: 2 additions & 9 deletions src/sam.cr
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,11 @@ namespace "migrate" do
end
end

desc "Drops Elasticsearch and PostgreSQL DB"
task "drop", %w[drop:db drop:elastic] do
desc "Drops the PostgreSQL DB"
task "drop", %w[drop:db] do
end

namespace "drop" do
desc "Deletes all elastic indices tables"
task "elastic" do |_, args|
host = (args["host"]? || PlaceOS::ES_HOST).to_s
port = (args["port"]? || PlaceOS::ES_PORT).to_i
PlaceOS::Tasks.drop_elastic_indices(host, port)
end

desc "Drops all PostgreSQL DB tables"
task "db" do |_, args|
arguments = {
Expand Down
10 changes: 0 additions & 10 deletions src/tasks/database.cr
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,6 @@ module PlaceOS::Tasks::Database
PgORM::Database.exec_sql(sql)
end

def drop_elastic_indices(elastic_host : String, elastic_port : Int32)
uri = URI.new(
host: elastic_host,
port: elastic_port,
path: "/_all",
scheme: "http"
)
HTTP::Client.delete(uri)
end

def migrate_rethink_to_pg(
path : String,
pg_host : String,
Expand Down
Loading