Last active
October 15, 2020 13:30
-
-
Save SoftCreatR/a943b7cc3db8f4f46254076b03e6c832 to your computer and use it in GitHub Desktop.
Simple install script for Appwrite Backend Server (https://appwrite.io)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
while [ "$#" -gt 0 ]; do | |
case "$1" in | |
--no-docker) | |
WITH_DOCKER="no" | |
;; | |
--no-docker-compose) | |
WITH_DOCKER_COMPOSE="no" | |
;; | |
--docker-compose-version) | |
DOCKER_COMPOSE_VERSION=$2 | |
;; | |
--appwrite-version) | |
APPWRITE_VERSION=$2 | |
;; | |
--force) | |
FORCE="yes" | |
;; | |
*) ;; | |
esac | |
shift | |
done | |
if [ -z "$WITH_DOCKER" ]; then | |
WITH_DOCKER="yes" | |
fi | |
if [ -z "$WITH_DOCKER_COMPOSE" ]; then | |
WITH_DOCKER_COMPOSE="yes" | |
fi | |
if [ -z "$DOCKER_COMPOSE_VERSION" ]; then | |
DOCKER_COMPOSE_VERSION=1.27.4 | |
fi | |
if [ -z "$APPWRITE_VERSION" ]; then | |
APPWRITE_VERSION=0.6.2 | |
fi | |
HNCTL=$(hostnamectl) | |
# Install deps | |
if [ -z "$FORCE" ]; then | |
if [[ $HNCTL == *"Debian"* ]] || [[ $HNCTL == *"Ubuntu"* ]]; then | |
sudo apt install -y git curl | |
elif [[ $HNCTL == *"Fedora"* ]] || [[ $HNCTL == *"CentOS"* ]] || [[ $HNCTL == *"RHEL"* ]]; then | |
if [[ $HNCTL == *"Fedora"* ]]; then | |
sudo mkdir /sys/fs/cgroup/systemd | |
sudo mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd | |
fi | |
if [ "$(command -v dnf)" ]; then | |
sudo dnf install -y git curl | |
else | |
sudo yum install -y git curl | |
fi | |
else | |
echo "Unknown OS. Please make sure, that the commands 'curl' and 'git' are available and start the installer with --force." | |
exit 1 | |
fi | |
fi | |
# Install Docker, if enabled | |
if [ "$WITH_DOCKER" = "yes" ]; then | |
curl -sSL https://get.docker.com/ | CHANNEL=stable sh && \ | |
sudo systemctl enable docker.service && \ | |
sudo systemctl start docker.service | |
fi | |
# Install docker-compose, if enabled | |
if [ "$WITH_DOCKER_COMPOSE" = "yes" ]; then | |
curl -L https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-"$(uname -s)"-"$(uname -m)" >/usr/local/bin/docker-compose && \ | |
chmod +x /usr/local/bin/docker-compose | |
fi | |
# Start Appwrite installation | |
if [ ! -d /opt/appwrite ]; then | |
cd /opt && \ | |
git clone https://github.com/appwrite/appwrite.git | |
fi | |
cd /opt/appwrite && \ | |
git checkout tags/$APPWRITE_VERSION -b v$APPWRITE_VERSION && \ | |
docker run -it --rm \ | |
--volume /var/run/docker.sock:/var/run/docker.sock \ | |
--volume "$(pwd)"/appwrite:/install/appwrite:rw \ | |
-e version=$APPWRITE_VERSION \ | |
appwrite/install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bash <(wget -qO - git.io/JTORz || curl -sL git.io/JTORz)
Optional parameters:
--no-docker
: Do not install Docker (you may have to do it by yourself)--no-docker-compose
: Do not install docker-compose (you may have to do it by yourself)--docker-compose-version
: Defaults to1.27.4
--appwrite-version
: Git Tag to check out. Defaults to0.6.2