Files
obsidian-livesync/setup-flyio-on-the-fly-v2.ipynb
T
vorotamoroz a9745e850e Improved:
- The passphrase of the Setup URI is now automatically generated. (#426)
2024-07-01 11:05:33 +01:00

5.2 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 ["ams/Amsterdam, Netherlands","arn/Stockholm, Sweden","atl/Atlanta, Georgia (US)","bog/Bogotá, Colombia","bos/Boston, Massachusetts (US)","cdg/Paris, France","den/Denver, Colorado (US)","dfw/Dallas, Texas (US)","ewr/Secaucus, NJ (US)","eze/Ezeiza, Argentina","gdl/Guadalajara, Mexico","gig/Rio de Janeiro, Brazil","gru/Sao Paulo, Brazil","hkg/Hong Kong, Hong Kong","iad/Ashburn, Virginia (US)","jnb/Johannesburg, South Africa","lax/Los Angeles, California (US)","lhr/London, United Kingdom","mad/Madrid, Spain","mia/Miami, Florida (US)","nrt/Tokyo, Japan","ord/Chicago, Illinois (US)","otp/Bucharest, Romania","phx/Phoenix, Arizona (US)","qro/Querétaro, Mexico","scl/Santiago, Chile","sea/Seattle, Washington (US)","sin/Singapore, Singapore","sjc/San Jose, California (US)","syd/Sydney, Australia","waw/Warsaw, Poland","yul/Montreal, Canada","yyz/Toronto, Canada" ] {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