[WIP] First version of script that simplifies launch
This commit is contained in:
parent
4dc5f2c911
commit
74813cead2
@ -16,8 +16,7 @@ ansible-pull \
|
||||
* Launches a new LXD container called **newodoocontainer**, that uses a LXD profile to download
|
||||
and setup Odoo v14.
|
||||
* Creates a DNS alias for **externo.agofer.net** or **externo2.agofer.net**
|
||||
(see role variables in `local.yml` file), called
|
||||
**<newodoocontainer>.agofer.net**.
|
||||
(see role variables in `local.yml` file), called **_newodoocontainer_.agofer.net**.
|
||||
* Registers this container in the existing Nginx Proxy container.
|
||||
* Requests an SSL certificate to _Let's Encrypt_ for the new domain, storing
|
||||
the certificates in the Nginx Proxy container.
|
||||
|
||||
36
launch-odoo14-container.sh
Normal file
36
launch-odoo14-container.sh
Normal file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# Uses ansible-pull from a Python venv to create a LXD container
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
usage ()
|
||||
{
|
||||
echo "Uses ansible-pull from a Python venv to create a LXD container"
|
||||
echo " Usage: $1 <new-container-name>"
|
||||
}
|
||||
|
||||
is_in () {
|
||||
[[ $2 =~ (^|[[:space:]])$1($|[[:space:]]) ]] && return 1 || return 0
|
||||
}
|
||||
|
||||
CONTAINER="$1"
|
||||
|
||||
# Need a container name:
|
||||
if [ -z "$CONTAINER" ]; then
|
||||
usage "$0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Container cannot exist already:
|
||||
ALLCONTAINERS=$(lxc ls -c n --format csv)
|
||||
|
||||
is_in "$CONTAINER" "${ALLCONTAINERS}"
|
||||
container_exists=$?
|
||||
|
||||
if [[ ${container_exists} -eq 0 ]]; then
|
||||
printf 'ERROR: %s\n' "A container with that name exists already" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "Would have launched container"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user