anyproto / any-sync-dockercompose

docker-compose for testing any-sync
MIT License
234 stars 29 forks source link

Can't show or set limits in admin page #48

Closed StefanFabian closed 1 month ago

StefanFabian commented 1 month ago

Have you read a contributing guide?

Current Behavior

When showing or setting a limit it times out. When setting it also outputs the following error message:

error   failed update file limit mongodb, url='mongodb://mongo-1:27001/?replicaSet=rs0', db='coordinator', collection='fileLimit', error='No replica set members found yet, Timeout: 30s, Topology Description: <TopologyDescription id: XXXXX, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('mongo-1', 27001) server_type: Unknown, rtt: None>]>' 

Expected Behavior

Trying to show or set a limit for a user should show/set the limit.

Steps To Reproduce

  1. Use override prod and changed EXTERNAL_LISTEN_HOSTS
  2. make start

Environment

- OS: Ubuntu 20.04
- Version: main (07.05.2024)

Anything else?

No response

fb929 commented 1 month ago

cat you show output for this command?

docker compose exec mongo-1 mongosh --port 27001 --eval 'rs.status()'
StefanFabian commented 1 month ago

Sure :+1:

Current Mongosh Log ID: 663a3c6b0675b053462b638e
Connecting to:      mongodb://127.0.0.1:27001/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.0.1
Using MongoDB:      7.0.2
Using Mongosh:      2.0.1

For mongosh info see: https://docs.mongodb.com/mongodb-shell/

To help improve our products, anonymous usage data is collected and sent to MongoDB periodically (https://www.mongodb.com/legal/privacy-policy).
You can opt-out by running the disableTelemetry() command.

------
   The server generated these startup warnings when booting
   2024-05-07T10:47:56.610+00:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem
   2024-05-07T10:47:57.140+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
   2024-05-07T10:47:57.140+00:00: vm.max_map_count is too low
------

{
  set: 'rs0',
  date: ISODate("2024-05-07T14:36:27.477Z"),
  myState: 1,
  term: Long("1"),
  syncSourceHost: '',
  syncSourceId: -1,
  heartbeatIntervalMillis: Long("2000"),
  majorityVoteCount: 1,
  writeMajorityCount: 1,
  votingMembersCount: 1,
  writableVotingMembersCount: 1,
  optimes: {
    lastCommittedOpTime: { ts: Timestamp({ t: 1715092577, i: 1 }), t: Long("1") },
    lastCommittedWallTime: ISODate("2024-05-07T14:36:17.578Z"),
    readConcernMajorityOpTime: { ts: Timestamp({ t: 1715092577, i: 1 }), t: Long("1") },
    appliedOpTime: { ts: Timestamp({ t: 1715092577, i: 1 }), t: Long("1") },
    durableOpTime: { ts: Timestamp({ t: 1715092577, i: 1 }), t: Long("1") },
    lastAppliedWallTime: ISODate("2024-05-07T14:36:17.578Z"),
    lastDurableWallTime: ISODate("2024-05-07T14:36:17.578Z")
  },
  lastStableRecoveryTimestamp: Timestamp({ t: 1715092567, i: 1 }),
  electionCandidateMetrics: {
    lastElectionReason: 'electionTimeout',
    lastElectionDate: ISODate("2024-05-07T10:48:07.078Z"),
    electionTerm: Long("1"),
    lastCommittedOpTimeAtElection: { ts: Timestamp({ t: 1715078887, i: 1 }), t: Long("-1") },
    lastSeenOpTimeAtElection: { ts: Timestamp({ t: 1715078887, i: 1 }), t: Long("-1") },
    numVotesNeeded: 1,
    priorityAtElection: 1,
    electionTimeoutMillis: Long("10000"),
    newTermStartDate: ISODate("2024-05-07T10:48:07.093Z"),
    wMajorityWriteAvailabilityDate: ISODate("2024-05-07T10:48:07.103Z")
  },
  members: [
    {
      _id: 0,
      name: 'mongo-1:27001',
      health: 1,
      state: 1,
      stateStr: 'PRIMARY',
      uptime: 13711,
      optime: { ts: Timestamp({ t: 1715092577, i: 1 }), t: Long("1") },
      optimeDate: ISODate("2024-05-07T14:36:17.000Z"),
      lastAppliedWallTime: ISODate("2024-05-07T14:36:17.578Z"),
      lastDurableWallTime: ISODate("2024-05-07T14:36:17.578Z"),
      syncSourceHost: '',
      syncSourceId: -1,
      infoMessage: '',
      electionTime: Timestamp({ t: 1715078887, i: 2 }),
      electionDate: ISODate("2024-05-07T10:48:07.000Z"),
      configVersion: 1,
      configTerm: 1,
      self: true,
      lastHeartbeatMessage: ''
    }
  ],
  ok: 1,
  '$clusterTime': {
    clusterTime: Timestamp({ t: 1715092577, i: 1 }),
    signature: {
      hash: Binary.createFromBase64("AAAAAAAAAAAAAAAAAAAAAAAAAAA=", 0),
      keyId: Long("0")
    }
  },
  operationTime: Timestamp({ t: 1715092577, i: 1 })
}
fb929 commented 1 month ago

Based on the status, everything should be working fine, try restarting the any-sync-admin container. Also, I must warn you that any-sync-admin is already deprecated and may not function correctly. We will remove it from the docker-compose deployment soon. A more appropriate approach would be to adjust the default limit in the filenode and coordinator configs via the .env.override file.

donjiang1223 commented 1 month ago

Currently, not only is any-sync-admin unusable, but its memory usage is also abnormally high. 截圖 2024-05-14 15 46 34

Are there any ways to restrict users from joining now? Or methods to manage users?

StefanFabian commented 1 month ago

A method to restrict users or password-protect the server is definitely needed.

fb929 commented 1 month ago

No admin panel - no problems! =) https://github.com/anyproto/any-sync-dockercompose/pull/56