code: func (m *Main) Promote() error {
  	m.mu.Lock()
  	defer m.mu.Unlock()
  
  	m.logger.Printf("attempting promotion")
  
  	// Request the leader joins us to the cluster.
  	m.logger.Println("requesting leader join us to cluster")
  	targetLogIndex, err := discoverd.DefaultClient.RaftAddPeer(m.advertiseAddr)
  	if err != nil {
  		m.logger.Println("error requesting leader to join us to cluster:", err)
  		return err
  	}
  
  	// Open the store.
  	if m.store == nil {
  		if err := m.openStore(); err != nil {
  			return err
  		}
  
  		// Wait for leadership.
  		if err := m.waitForLeader(60 * time.Second); err != nil {
  			return err
  		}
  
  		// Wait for store to catchup
  		for m.store.LastIndex() < targetLogIndex.LastIndex {
  			m.logger.Println("Waiting for store to catchup, current:", m.store.LastIndex(), "target:", targetLogIndex.LastIndex)
  			time.Sleep(100 * time.Millisecond)
  		}
  	}
  
  	// Update the DNS server to use the local store.
  	if m.dnsServer != nil {
  		m.dnsServer.SetStore(m.store)
  	}
  
  	// Update the HTTP server to use the local store.
  	m.handler.Store = m.store
  	m.handler.Proxy.Store(false)
  
  	m.logger.Println("promoted successfully")
  	return nil
  }
docs: // Join the consensus set, promoting ourselves from proxy to raft node.