diff --git a/.env.sample b/.env.sample index c1e3bf1aa..c5ea5bcf7 100644 --- a/.env.sample +++ b/.env.sample @@ -57,7 +57,7 @@ NOSTR_PRIVATE_KEY= # static things NEXTAUTH_URL=http://localhost:3000/api/auth -SELF_URL=http://localhost:3000 +SELF_URL=http://app:3000 PUBLIC_URL=http://localhost:3000 LND_CONNECT_ADDRESS=03cc1d0932bb99b0697f5b5e5961b83ab7fd66f1efc4c9f5c7bad66c1bcbe78f02@xhlmkj7mfrl6ejnczfwl2vqik3xim6wzmurc2vlyfoqw2sasaocgpuad.onion:9735 NEXTAUTH_SECRET=3_0W_PhDRZVanbeJsZZGIEljexkKoGbL6qGIqSwTjjI diff --git a/docker-compose.yml b/docker-compose.yml index 350261834..07635ff3b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,6 +31,7 @@ services: - ./:/app links: - db + - opensearch worker: container_name: worker build: ./worker @@ -47,6 +48,8 @@ services: - ./:/app links: - db + - app + - opensearch entrypoint: ["/bin/sh", "-c"] command: - node worker/index.js @@ -71,41 +74,42 @@ services: image: opensearchproject/opensearch:latest container_name: opensearch environment: - - cluster.name=opensearch-cluster - - node.name=opensearch - - discovery.seed_hosts=opensearch - - cluster.initial_cluster_manager_nodes=opensearch - - bootstrap.memory_lock=true + - discovery.type=single-node - plugins.security.disabled=true - - action.auto_create_index=true - - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" - ulimits: - memlock: - soft: -1 - hard: -1 - nofile: - soft: 65536 - hard: 65536 - volumes: - - opensearch-data:/usr/share/opensearch/data - - ./opensearch:/sn ports: - 9200:9200 # REST API - 9600:9600 # Performance Analyzer - entrypoint: ["/bin/sh", "-c"] - command: - - /sn/init-shim.sh - dashboards: - profiles: - - aux - build: ./opensearch/dashboards - container_name: dashboards + volumes: + - os:/usr/share/opensearch/data + - ./:/app + command: > + bash -c ' + set -m + /usr/share/opensearch/opensearch-docker-entrypoint.sh & + until curl -sS "http://localhost:9200/_cat/health?h=status" -ku admin:admin | grep -q "green\|yellow"; do + echo "Waiting for OpenSearch to start..." + sleep 1 + done + echo "OpenSearch started." + curl -X PUT "http://localhost:9200/item" -ku admin:admin + echo "OpenSearch index created." + fg + ' + os-dashboard: + image: opensearchproject/opensearch-dashboards:latest + container_name: os-dashboard + environment: + - opensearch.ssl.verificationMode=none + - server.ssl.enabled=false + - plugins.security.disabled=true + - DISABLE_SECURITY_DASHBOARDS_PLUGIN=true + - OPENSEARCH_HOSTS=http://opensearch:9200 ports: - 5601:5601 expose: - "5601" - environment: - OPENSEARCH_HOSTS: '["http://opensearch:9200"]' + links: + - opensearch volumes: db: - opensearch-data: + os: diff --git a/opensearch/dashboards/Dockerfile b/opensearch/dashboards/Dockerfile deleted file mode 100644 index 37639a686..000000000 --- a/opensearch/dashboards/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM opensearchproject/opensearch-dashboards:latest -RUN /usr/share/opensearch-dashboards/bin/opensearch-dashboards-plugin remove securityDashboards -COPY --chown=opensearch-dashboards:opensearch-dashboards ./opensearch_dashboards.yml /usr/share/opensearch-dashboards/config/ \ No newline at end of file diff --git a/opensearch/dashboards/opensearch_dashboards.yml b/opensearch/dashboards/opensearch_dashboards.yml deleted file mode 100644 index c9ff12c29..000000000 --- a/opensearch/dashboards/opensearch_dashboards.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -server.host: "0.0.0.0" \ No newline at end of file diff --git a/opensearch/first-time-check.sh b/opensearch/first-time-check.sh deleted file mode 100644 index 3330185c7..000000000 --- a/opensearch/first-time-check.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# wait for opensearch API to come online -sleep 10 -while ! (echo > /dev/tcp/127.0.0.1/9200) >/dev/null 2>&1; do - sleep 1 -done - -# check if index is missing -ERR_RESP=`curl http://localhost:9200/item 2>/dev/null |grep index_not_found_exception` -if [ "$ERR_RESP" != "" ]; then - echo "$0: first-time run detected: creating index and mappings" - set -x - - curl 2>/dev/null -X PUT -H "Content-Type: application/json" http://localhost:9200/item \ - --data "{}" - - curl 2>/dev/null -X PUT -H "Content-Type: application/json" http://localhost:9200/item/_mapping \ - --data "{\"properties\":{\"wvotes\":{\"type\":\"integer\"}}}" - - curl 2>/dev/null -X PUT -H "Content-Type: application/json" http://localhost:9200/item/_mapping \ - --data "{\"properties\":{\"sats\":{\"type\":\"integer\"}}}" - - set +x - echo "$0: one-time initialization done" -else - echo "$0: indices and mappings detected: first-time check done" -fi - - diff --git a/opensearch/init-shim.sh b/opensearch/init-shim.sh deleted file mode 100644 index 5e4b00bdf..000000000 --- a/opensearch/init-shim.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -/sn/first-time-check.sh & -source /usr/share/opensearch/opensearch-docker-entrypoint.sh diff --git a/worker/search.js b/worker/search.js index eff068e4d..c92937f58 100644 --- a/worker/search.js +++ b/worker/search.js @@ -77,6 +77,7 @@ async function _indexItem (item) { export function indexItem ({ apollo }) { return async function ({ data: { id } }) { + console.log('indexing item, fetching ...', id) // 1. grab item from database // could use apollo to avoid duping logic // when grabbing sats and user name, etc