GithubHelp home page GithubHelp logo

isabella232 / kivy-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kivy/kivy-server

0.0 0.0 0.0 103 KB

Docker configuration for the Kivy server

License: MIT License

Shell 55.77% PHP 13.55% Dockerfile 30.68%

kivy-server's Introduction

Kivy Server

Quickly deploy changes

Make sure to also configure Matomo, if the piwik container has changed.

ssh [email protected]
cd ~/docker/kivy-server
git pull
docker-compose build
docker-compose up -d

Usage

These 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/downloads

Connect to the host to manage the server.

Keep the host up to date.

apt-get update
apt-get dist-upgrade

The 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-server

Pull changes from GitHub.

git pull

Images and the containers created from them can be referenced by their service names.

# list services declared in `docker-compose.yml`
docker-compose config --services

Build 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 nginx

Create containers from updated or new images and start all services. Use this command to deploy changes.

docker-compose up -d

Stop and remove containers and networks.

docker-compose down

Start existing containers.

docker-compose start
# start a specific container
docker-compose start nginx

Stop running containers.

docker-compose stop
# stop a specific container
docker-compose stop nginx

Inspect 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 nginx

Get a shell in a running container. If bash is not available in the container, use sh.

docker-compose exec docs bash

Start, stop and restart the Docker service.

service docker start
service docker stop
service docker restart

Add 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 exit

Remove 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 exit

Add 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_ghci

Now, 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/config

Configure Matomo

The piwik container needs manual configuration whenever it is recreated. If Matomo is not configured, visitor logs will not be kept. Visit https://pw.kivy.org after the container has started and follow the installation steps.

These are the two installation steps that require further action, besides clicking Next.

Database Setup:

  • Database Server: piwik_mysql
  • Login: root
  • Password: see the MYSQL_ROOT_PASSWORD variable in .env/envfile/piwik-mysql
  • Database Name: piwik
  • Table Prefix: piwik_

Creating the Tables:

Make sure to reuse the existing tables, otherwise they will be overwritten.

The installation is completed when you are redirected to the authentication form.

Troubleshoot low disk space

Inspect disk space usage of the host.

df -h

Inspect disk space usage of Docker.

# overview
docker system df
# verbose
docker system df -v

Inspect a folder within a running container.

docker-compose exec downloads bash
# check directory size
du -h -s /web/downloads

Clear Docker data

Check out the docs to learn more about the commands listed below.

Remove stopped containers.

docker container prune

Remove images that are not used by existing containers.

docker image prune -a

Remove volumes that are not used by existing containers. WARNING! Persistent data is stored in volumes.

docker volume prune

Remove networks that are not used by existing containers.

docker network prune

Shortcut for all of the above.

docker system prune --volumes

kivy-server's People

Contributors

dessant avatar keyweeusr avatar matham avatar tshirtman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.