Compare commits

..

No commits in common. "dcfb45475afa5bc370952cf6d09a1871973f689c" and "638fbedc0aa2f0ee87eeb28c6d0a7e3251d1d4a0" have entirely different histories.

7 changed files with 3 additions and 28 deletions

View file

@ -159,11 +159,9 @@ 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_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` | `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_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_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 | | `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_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!). 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!).
@ -184,11 +182,9 @@ services:
- SYNC_SCHEDULE=0 21 * * 5 - SYNC_SCHEDULE=0 21 * * 5
- SYNC_DELAY=true - SYNC_DELAY=true
- SYNC_DELAY_MAX_SECONDS=21600 - SYNC_DELAY_MAX_SECONDS=21600
- SYNC_MAX_KBPS=0
- TLS_NAME=library.lab.bowdre.net - TLS_NAME=library.lab.bowdre.net
- TLS_CUSTOM_CERT=true - TLS_CUSTOM_CERT=true
- LIBRARY_NAME=Library - LIBRARY_NAME=Library
- LIBRARY_BROWSE=true
ports: ports:
- "80:80/tcp" - "80:80/tcp"
- "443:443/tcp" - "443:443/tcp"
@ -265,7 +261,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 0 21 * * 5 /syncer/sync.sh delay > /proc/self/fd/1 2>/proc/self/fd/2
``` ```
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: Open a web browser to `http(s)://[TLS_NAME or IP]/lib.json` and you can see the top-level library item:
```json ```json
{ {
"vcspVersion": "2", "vcspVersion": "2",
@ -286,20 +282,5 @@ Open a web browser to `http://$DOCKER_HOST_IP/lib.json`/`https://$TLS_NAME/lib.j
} }
``` ```
Or hit the site root if `LIBRARY_BROWSE` is enabled:
![Directory browsing](res/browse.png)
### Subscribed library ### Subscribed library
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. The final piece of this puzzle to create a content library inside of vSphere subscribed to the client library that was just created.
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,10 +32,6 @@ EOF
fi fi
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..." echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Starting caddy..."
/usr/sbin/caddy start -config /etc/caddy/Caddyfile /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!" echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Sync sync starts NOW!"
# sync # sync
/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 /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
# generate content library manifest # generate content library manifest
echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Generating content library manifest..." echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Generating content library manifest..."

View file

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB