ssh [email protected]
cd ~/docker/kivy-server
git pull
docker-compose build
docker-compose up -dThese are some of the most common tasks that are performed by maintainers.
You can connect directly to the downloads container to maintain
the directory served at https://kivy.org/downloads/.
ssh -p 2458 [email protected]
cd /web/downloadsConnect to the host to manage the server.
Keep the host up to date.
apt-get update
apt-get dist-upgradeThe server repository is located at ~/docker/kivy-server.
Secrets are kept in the .env folder, and they are referenced
by services in docker-compose.yml and certain Dockerfiles.
cd ~/docker/kivy-serverPull changes from GitHub.
git pullImages and the containers created from them can be referenced by their service names.
# list services declared in `docker-compose.yml`
docker-compose config --servicesBuild the images.
# build new/changed images
docker-compose build
# build all images without using the cache
docker-compose build --no-cache
# build a specific image
docker-compose build nginxCreate containers from updated or new images and start all services. Use this command to deploy changes.
docker-compose up -dStop and remove containers and networks.
docker-compose downStart existing containers.
docker-compose start
# start a specific container
docker-compose start nginxStop running containers.
docker-compose stop
# stop a specific container
docker-compose stop nginxInspect the logs.
# list logs for all containers
docker-compose logs
# follow logs for all containers
docker-compose logs -f
# follow logs for a specific container
docker-compose logs -f nginx
# follow logs starting from the last 100 lines
docker-compose logs -f --tail 100 nginxGet a shell in a running container. If bash is not available in the container,
use sh.
docker-compose exec docs bashStart, stop and restart the Docker service.
service docker start
service docker stop
service docker restartAdd access for team member (do the following for both ssh -p 2458 [email protected] and ssh [email protected])
# get public ssh key from them (`cat ~/.ssh/id_rsa.pub`)
# open keys in nano
nano ~/.ssh/authorized_keys
# in nano paste their key in a new line (should be something like `ssh-rsa AAAAB...iSTP username@hostname`)
# save in nano and exitRemove access for team member (do the following for both ssh -p 2458 [email protected] and ssh [email protected])
# open keys in nano
nano ~/.ssh/authorized_keys
# locate line with their key, delete it with ctrl-k
# save and exitAdd ssh key for CI to push to downloads and use it in the CI
On the download server:
# access download server
ssh -p 2458 [email protected]
# generate key for the service (e.g. github)
ssh-keygen -t ed25519 -C "kivy-repo@githubci" -q -N ""
# it prompts where to save it, give it unique name
Enter file in which to save the key (/root/.ssh/id_ed25519): /root/.ssh/id_ed25519_kivy_ghci
# copy the key
cat ~/.ssh/id_ed25519_kivy_ghci.pub
# and add it to the host's authorized_keys using nano
nano ~/.ssh/authorized_keys
# save nano
# copy the private key from terminal
cat ~/.ssh/id_ed25519_kivy_ghciNow, go to repo of interest and paste the private key as a secrent variable (e.g. UBUNTU_UPLOAD_KEY).
In the yml do:
env:
UBUNTU_UPLOAD_KEY: ${{ secrets.UBUNTU_UPLOAD_KEY }}And to use it do:
printf "%s" "$UBUNTU_UPLOAD_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo -e "Host $1\n\tStrictHostKeyChecking no\n" >> ~/.ssh/configInspect disk space usage of the host.
df -hInspect disk space usage of Docker.
# overview
docker system df
# verbose
docker system df -vInspect a folder within a running container.
docker-compose exec downloads bash
# check directory size
du -h -s /web/downloadsCheck out the docs to learn more about the commands listed below.
Remove stopped containers.
docker container pruneRemove images that are not used by existing containers.
docker image prune -aRemove volumes that are not used by existing containers. WARNING! Persistent data is stored in volumes.
docker volume pruneRemove networks that are not used by existing containers.
docker network pruneShortcut for all of the above.
docker system prune --volumes