6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-12 14:17:46 +00:00

Fix file permissions in aws instance

Env folders were being created for user root.
This commit is contained in:
Régis Behmo 2019-03-10 18:13:02 +01:00
parent 9d7a67bb69
commit 5938933dbb

View File

@ -1,14 +1,14 @@
#! /bin/bash -e #! /bin/bash -e
# Provision an AWS cloud instance with tutor. # Provision an AWS cloud instance with tutor.
# Run with: curl -sSL https://raw.githubusercontent.com/regisb/tutor/master/cloud/aws.sh | sudo bash -e # Run with: curl -sSL https://raw.githubusercontent.com/regisb/tutor/master/cloud/aws.sh | bash -e
export TUTOR_USER="$SUDO_USER" export TUTOR_USER="$USER"
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
echo "=============== Installing system dependencies" echo "=============== Installing system dependencies"
apt update \ sudo apt update \
&& apt upgrade -y \ && sudo apt upgrade -y \
&& apt install -y \ && sudo apt install -y \
apt-transport-https \ apt-transport-https \
ca-certificates \ ca-certificates \
curl \ curl \
@ -17,23 +17,23 @@ apt update \
supervisor supervisor
echo "=============== Installing docker" echo "=============== Installing docker"
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository \ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \ $(lsb_release -cs) \
stable" stable"
apt update sudo apt update
apt install -y docker-ce docker-ce-cli containerd.io sudo apt install -y docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $TUTOR_USER
docker run hello-world docker run hello-world
usermod -aG docker $TUTOR_USER
echo "=============== Installing docker-compose" 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 sudo 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 sudo chmod +x /usr/local/bin/docker-compose
echo "=============== Installing tutor" echo "=============== Installing tutor"
curl -L "https://github.com/regisb/tutor/releases/download/latest/tutor-$(uname -s)_$(uname -m)" -o /usr/local/bin/tutor sudo curl -L "https://github.com/regisb/tutor/releases/download/latest/tutor-$(uname -s)_$(uname -m)" -o /usr/local/bin/tutor
chmod +x /usr/local/bin/tutor sudo chmod +x /usr/local/bin/tutor
echo "=============== Building docker images" echo "=============== Building docker images"
tutor images env tutor images env
@ -47,5 +47,5 @@ echo "[program:tutor]
command=/usr/local/bin/tutor webui start command=/usr/local/bin/tutor webui start
environment=HOME=/home/$TUTOR_USER environment=HOME=/home/$TUTOR_USER
autorestart=true autorestart=true
user=$TUTOR_USER" > /etc/supervisor/conf.d/tutor.conf user=$TUTOR_USER" | sudo tee /etc/supervisor/conf.d/tutor.conf
supervisorctl update sudo supervisorctl update