mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-12-13 06:37:46 +00:00
Add cloud deployment script for AWS
This commit is contained in:
parent
b3288613c7
commit
5df069f42a
44
cloud/ubuntu.sh
Executable file
44
cloud/ubuntu.sh
Executable file
@ -0,0 +1,44 @@
|
||||
#! /bin/bash -e
|
||||
# Provision an AWS cloud instance with tutor.
|
||||
# Run with: curl -sSL https://raw.githubusercontent.com/regisb/tutor/cloud/cloud/ubuntu.sh | sudo bash -e
|
||||
|
||||
export USER=ubuntu
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
echo "=============== Installing system dependencies"
|
||||
apt update \
|
||||
&& apt upgrade -y \
|
||||
&& apt install -y \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg-agent \
|
||||
software-properties-common \
|
||||
supervisor
|
||||
|
||||
echo "=============== Installing docker"
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
|
||||
add-apt-repository \
|
||||
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
apt update
|
||||
apt install -y docker-ce docker-ce-cli containerd.io
|
||||
docker run hello-world
|
||||
usermod -aG docker $USER
|
||||
|
||||
echo "=============== Installing docker-compose"
|
||||
curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||
chmod +x /usr/local/bin/docker-compose
|
||||
|
||||
echo "=============== Installing tutor"
|
||||
curl -L "https://github.com/regisb/tutor/releases/download/v3.0.4/tutor-linux" -o /usr/local/bin/tutor
|
||||
chmod +x /usr/local/bin/tutor
|
||||
|
||||
echo "=============== Configuring supervisor"
|
||||
echo "[program:tutor]
|
||||
command=/usr/local/bin/tutor webui start
|
||||
environment=HOME=/home/$USER
|
||||
autorestart=true
|
||||
user=$USER" > /etc/supervisor/conf.d/tutor.conf
|
||||
supervisorctl update
|
@ -40,7 +40,8 @@ def download(namespace, version, image):
|
||||
@click.command(
|
||||
short_help="Build docker images",
|
||||
help=("""Build the docker images necessary for an Open edX platform.
|
||||
The images will be tagged as {namespace}/{image}:{version}."""))
|
||||
The images will be tagged as {namespace}/{image}:{version}.""")
|
||||
)
|
||||
@opts.root
|
||||
@option_namespace
|
||||
@option_version
|
||||
@ -63,6 +64,18 @@ def build(root, namespace, version, image, build_arg):
|
||||
]
|
||||
utils.docker(*command)
|
||||
|
||||
@click.command(
|
||||
short_help="Pull images from hub.docker.com",
|
||||
)
|
||||
@option_namespace
|
||||
@option_version
|
||||
@argument_image
|
||||
def pull(namespace, version, image):
|
||||
for image in image_list(image):
|
||||
tag = get_tag(namespace, image, version)
|
||||
click.echo(fmt.info("Pulling image {}".format(tag)))
|
||||
utils.execute("docker", "pull", tag)
|
||||
|
||||
@click.command(
|
||||
short_help="Push images to hub.docker.com",
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user