Compare commits

...

3 commits

7 changed files with 28 additions and 3 deletions

View file

@ -159,9 +159,11 @@ Some decisions need to be made on the client side, and most of those will be exp
| `SYNC_SCHEDULE` | (`0 21 * * 5`) | `cron`-formatted schedule for when the client should initiate a sync (example syncs at 9PM on Friday night) |
| `SYNC_DELAY` | `true` (`false`) | if true, sleeps a random number of seconds before begining the sync |
| `SYNC_DELAY_MAX_SECONDS` | (`21600`) | maximum seconds to sleep (example will be delayed up to 6 hours) |
| `SYNC_MAX_BW` | `1.5m` (`0`) | `rsync` bandwidth limit; `1.5m` caps at 1.5MB/s, `0` is unlimited |
| `TLS_NAME` | `library.bowdre.net` | if set, the FQDN used for the client's web server; if not set, the library will be served strictly over HTTP |
| `TLS_CUSTOM_CERT` | `true` (`false`) | if `true`, the web server will expect to find a custom certificate *and private key* in the `./data/certs` volume |
| `LIBRARY_NAME` | (`Library`) | this name will show up in the generated Content Library JSON, but not anywhere else |
| `LIBRARY_BROWSE` | `true` (`false`) | enable directory browsing on the web server; otherwise you'll need to know the exact path of the item you're after |
Introducing a random sync delay might be useful if you have a bunch of remote sites and don't want them to attempt to sync all at once, but you're too lazy to manually customize the schedule for each one of them (no judgment!).
@ -182,9 +184,11 @@ services:
- SYNC_SCHEDULE=0 21 * * 5
- SYNC_DELAY=true
- SYNC_DELAY_MAX_SECONDS=21600
- SYNC_MAX_KBPS=0
- TLS_NAME=library.lab.bowdre.net
- TLS_CUSTOM_CERT=true
- LIBRARY_NAME=Library
- LIBRARY_BROWSE=true
ports:
- "80:80/tcp"
- "443:443/tcp"
@ -261,7 +265,7 @@ The startup tasks are complete once you see the messaging about starting `cron`.
0 21 * * 5 /syncer/sync.sh delay > /proc/self/fd/1 2>/proc/self/fd/2
```
Open a web browser to `http(s)://[TLS_NAME or IP]/lib.json` and you can see the top-level library item:
Open a web browser to `http://$DOCKER_HOST_IP/lib.json`/`https://$TLS_NAME/lib.json` and you can see the top-level library item:
```json
{
"vcspVersion": "2",
@ -282,5 +286,20 @@ Open a web browser to `http(s)://[TLS_NAME or IP]/lib.json` and you can see the
}
```
Or hit the site root if `LIBRARY_BROWSE` is enabled:
![Directory browsing](res/browse.png)
### Subscribed library
The final piece of this puzzle to create a content library inside of vSphere subscribed to the client library that was just created.
The final piece of this puzzle to create a content library inside of vSphere to subscribe to the `library-syncer-client` library. This will (finally) make those templates available to deploy directly in vSphere.
1. Log into the vSphere Client and navigate to **Menu > Content Libraries**.
2. Click **Create**, give your new library a good name, and click **Next**.
3. Click the button to make this a **Subscribed Content Library**, and enter the URL of the `library-syncer-client` library. The URL should end with `/lib.json`.
![Library URL](res/library-url.png)
4. Select the option to download content immediately. At this point, content will just be transferred within a local site so bandwidth shouldn't be a concern. Click **Next**.
5. From this point, it's creating a library as usual. Click **Next** again unless you want to set a specific security policy, then select the datastore where the vSphere copy of the templates should be stored, then finally hit **Finish** to complete.
You can then view the new library in vSphere and see that the template(s) have synced successfully:
![Synced library](res/synced-library.png)
Success!

View file

@ -32,6 +32,10 @@ EOF
fi
fi
if [ "$LIBRARY_BROWSE" == "true" ]; then
sed -i 's/file_server/file_server browse/' /etc/caddy/Caddyfile
fi
echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Starting caddy..."
/usr/sbin/caddy start -config /etc/caddy/Caddyfile

View file

@ -10,7 +10,7 @@ fi
echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Sync sync starts NOW!"
# sync
/usr/bin/rsync -e "ssh -l syncer -p ${SYNC_PORT:-2222} -i /syncer/.ssh/id_syncer -o StrictHostKeyChecking=no" -av --exclude '*.json' $SYNC_PEER:/ /syncer/library
/usr/bin/rsync --bwlimit=${SYNC_MAX_BW:-0} -e "ssh -l syncer -p ${SYNC_PORT:-2222} -i /syncer/.ssh/id_syncer -o StrictHostKeyChecking=no" -av --exclude '*.json' $SYNC_PEER:/ /syncer/library
# generate content library manifest
echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Generating content library manifest..."

View file

@ -11,9 +11,11 @@ services:
- SYNC_SCHEDULE=0 21 * * 5
- SYNC_DELAY=true
- SYNC_DELAY_MAX_SECONDS=21600
- SYNC_MAX_KBPS=0
- TLS_NAME=library.lab.bowdre.net
- TLS_CUSTOM_CERT=true
- LIBRARY_NAME=Library
- LIBRARY_BROWSE=true
ports:
- "80:80/tcp"
- "443:443/tcp"

BIN
res/browse.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

BIN
res/library-url.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
res/synced-library.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB