mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2024-12-12 09:04:06 +02:00
151 lines
5.2 KiB
Plaintext
151 lines
5.2 KiB
Plaintext
{
|
|
"nbformat": 4,
|
|
"nbformat_minor": 0,
|
|
"metadata": {
|
|
"colab": {
|
|
"provenance": [],
|
|
"private_outputs": true,
|
|
"authorship_tag": "ABX9TyMexQ5pErH5LBG2tENtEVWf",
|
|
"include_colab_link": true
|
|
},
|
|
"kernelspec": {
|
|
"name": "python3",
|
|
"display_name": "Python 3"
|
|
},
|
|
"language_info": {
|
|
"name": "python"
|
|
}
|
|
},
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"id": "view-in-github",
|
|
"colab_type": "text"
|
|
},
|
|
"source": [
|
|
"<a href=\"https://colab.research.google.com/gist/vrtmrz/9402b101746e08e969b1a4f5f0deb465/setup-flyio-on-the-fly-v2.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"- Initial version 7th Feb. 2024"
|
|
],
|
|
"metadata": {
|
|
"id": "AzLlAcLFRO5A"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"id": "z1x8DQpa9opC"
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Install prerequesties\n",
|
|
"!curl -L https://fly.io/install.sh | sh\n",
|
|
"!curl -fsSL https://deno.land/x/install/install.sh | sh\n",
|
|
"!apt update && apt -y install jq\n",
|
|
"import os\n",
|
|
"%env PATH=/root/.fly/bin:/root/.deno/bin/:{os.environ[\"PATH\"]}\n",
|
|
"!git clone --recursive https://github.com/vrtmrz/obsidian-livesync"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"source": [
|
|
"# Login up sign up\n",
|
|
"!flyctl auth signup"
|
|
],
|
|
"metadata": {
|
|
"id": "mGN08BaFDviy"
|
|
},
|
|
"execution_count": null,
|
|
"outputs": []
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"Select a region and execute the block."
|
|
],
|
|
"metadata": {
|
|
"id": "BBFTFOP6vA8m"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"source": [
|
|
"# see https://fly.io/docs/reference/regions/\n",
|
|
"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}\n",
|
|
"%env region={region.split(\"/\")[0]}\n",
|
|
"#%env appame=\n",
|
|
"#%env username=\n",
|
|
"#%env password=\n",
|
|
"#%env database=\n",
|
|
"#%env passphrase=\n",
|
|
"\n",
|
|
"# automatic setup leave it -->\n",
|
|
"%cd obsidian-livesync/utils/flyio\n",
|
|
"!./deploy-server.sh | tee deploy-result.txt\n",
|
|
"\n",
|
|
"## Show result button\n",
|
|
"from IPython.display import HTML\n",
|
|
"last_line=\"\"\n",
|
|
"with open('deploy-result.txt', 'r') as f:\n",
|
|
" last_line = f.readlines()[-1]\n",
|
|
" last_line = str.strip(last_line)\n",
|
|
"\n",
|
|
"if last_line.startswith(\"obsidian://\"):\n",
|
|
" result = HTML(f\"Copy your setup-URI with this button! -> <button onclick=\\\"navigator.clipboard.writeText('{last_line}')\\\">Copy setup uri</button><br>Importing passphrase is `welcome`. <br>If you want to synchronise in live mode, please apply a preset after ensuring the imported configuration works.\")\n",
|
|
"else:\n",
|
|
" result = \"Failed to encrypt the setup URI\"\n",
|
|
"result"
|
|
],
|
|
"metadata": {
|
|
"id": "TNl0A603EF9E"
|
|
},
|
|
"execution_count": null,
|
|
"outputs": []
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"If you see the `Copy setup URI` button, Congratulations! Your CouchDB is ready to use! Please click the button. And open this on Obsidian.\n",
|
|
"\n",
|
|
"And, you should keep the output to your secret memo.\n",
|
|
"\n"
|
|
],
|
|
"metadata": {
|
|
"id": "oeIzExnEKhFp"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"\n",
|
|
"\n",
|
|
"---\n",
|
|
"\n",
|
|
"\n",
|
|
"If you want to delete this CouchDB instance, you can do it by executing next cell. \n",
|
|
"If your fly.toml has been gone, access https://fly.io/dashboard and check the existing app."
|
|
],
|
|
"metadata": {
|
|
"id": "sdQrqOjERN3K"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"source": [
|
|
"!./delete-server.sh"
|
|
],
|
|
"metadata": {
|
|
"id": "7JMSkNvVIIfg"
|
|
},
|
|
"execution_count": null,
|
|
"outputs": []
|
|
}
|
|
]
|
|
} |