Files
obsidian-livesync/setup-flyio-on-the-fly-v2.ipynb
T
2025-10-29 17:07:34 -08:00

4.7 KiB

Open In Colab

  • Initial version 7th Feb. 2024
In [ ]:
# Install prerequesties
!curl -L https://fly.io/install.sh | sh
!curl -fsSL https://deno.land/x/install/install.sh | sh
!apt update && apt -y install jq
import os
%env PATH=/root/.fly/bin:/root/.deno/bin/:{os.environ["PATH"]}
!git clone --recursive https://github.com/vrtmrz/obsidian-livesync
In [ ]:
# Login up sign up
!flyctl auth signup

Select a region and execute the block.

In [ ]:
# see https://fly.io/docs/reference/regions/
region = "nrt/Tokyo, Japan" #@param ["jnb/Johannesburg, South Africa","bom/Mumbai, India","sin/Singapore, Singapore","syd/Sydney, Australia","nrt/Tokyo, Japan","ams/Amsterdam, Netherlands","fra/Frankfurt, Germany","lhr/London, United Kingdom","cdg/Paris, France","arn/Stockholm, Sweden","iad/Ashburn, Virginia (US)","ord/Chicago, Illinois (US)","dfw/Dallas, Texas (US)","lax/Los Angeles, California (US)","sjc/San Jose, California (US)","ewr/Secaucus, NJ (US)","yyz/Toronto, Canada","gru/Sao Paulo, Brazil"] {allow-input: true}
%env region={region.split("/")[0]}
#%env appame=
#%env username=
#%env password=
#%env database=
#%env passphrase=

# automatic setup leave it  -->
%cd obsidian-livesync/utils/flyio
!./deploy-server.sh | tee deploy-result.txt

## Show result button
from IPython.display import HTML
last_line=""
with open('deploy-result.txt', 'r') as f:
  last_line = f.readlines()[-1]
  last_line = str.strip(last_line)

if last_line.startswith("obsidian://"):
  result = HTML(f"Copy your setup-URI with this button! -&gt; <button onclick=\"navigator.clipboard.writeText('{last_line}')\">Copy setup uri</button><br>Importing passphrase is displayed one. <br>If you want to synchronise in live mode, please apply a preset after ensuring the imported configuration works.")
else:
  result = "Failed to encrypt the setup URI"
result

If you see the Copy setup URI button, Congratulations! Your CouchDB is ready to use! Please click the button. And open this on Obsidian.

And, you should keep the output to your secret memo.


If you want to delete this CouchDB instance, you can do it by executing next cell.
If your fly.toml has been gone, access https://fly.io/dashboard and check the existing app.

In [ ]:
!./delete-server.sh