Upload to server - Miol-Mor/battle-game GitHub Wiki
Update project on server
- Get ssh-key from @bronvic
- Login to server
ssh -i <PATH_TO_KEY>/myamazon.pem [email protected]
- Go to the game folder
cd /www/battle-game
- Pull changes (make sure you are on the
master
branch)
git pull
- Remove everything from docker!
docker system prune --all
- Restart containers and run
docker-compose up -d --build
Restart backend
docker-compose restart backend
Upload to server first time
Instruction for uploading from scratch (ubuntu):
- Set up docker the repository
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- Install docker-engine
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
- Install docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
- Add current user to docker group and reboot
sudo usermod -aG docker $USER
sudo reboot
- Create a directory for the project and clone it
sudo mkdir /www
sudo chown -R $USER:$USER /www
git clone https://github.com/Miol-Mor/battle-game.git /www
- Change environment variable for backend with the real one
vim /www/battle-game/frontend/.env
- Build and run
docker-compose --project-directory /www/battle-game build
docker-compose --project-directory /www/battle-game up