├── HOWTOS └── HOSTING.md └── README.md /HOWTOS/HOSTING.md: -------------------------------------------------------------------------------- 1 | # Set-up a server for hosting a swupd 3rd-party repository 2 | 3 | ## Table of contents 4 | 1. [Introduction](#introduction) 5 | 2. [Requirements](#requirements) 6 | 3. [Install NGINX](#nginx) 7 | 4. [Configure NGINX](#nginx-config) 8 | 1. [Traefik](#traefik) 9 | 5. [Upload content](#content) 10 | 11 | ## Introduction 12 | This guide is meant for anyone wondering how to host a 3d-party repository to be consumed by swupd in Clear Linux. This guide will however not go into very much detail as there are a million ways to do most of the steps in this process. You will also not learn how to create the content (packages and bundles) to be hosted on your server. With this warning out of the way we can continue. 13 | 14 | ## Requirements 15 | Hosting a 3rd-party repository doesn't require a lot of a server, the 2 things it does require is a lot of disk space and a lot of bandwidth. The exact amount of these 2 depends on the situation, but generally the more packages you host the more disk space is required. As for the needed amount of bandwidth this depends on the amount of up- and downloads. Furthermore you should be able to host files in a plain directory, this can be done on any NGINX or Apache server. I use a VPS for hosting my repository but it should work on a shared hosting package as well. For the rest of this guide I assume a VPS set-up. If you are running on a shared host you need to figure out how to enable indexing on the folder you want to use for hosting the repository, after doing so you can continue to [Upload content](#content). 16 | 17 | ## Install NGINX 18 | In order for swupd to be able to use a repository it needs to have access to the files in a folder hosted on an https(s) accessible server, for this you need to install NGINX on your VPS the exact steps are different for every Linux distribution but an example can be found [here](https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-18-04). 19 | 20 | ## Configure NGINX 21 | As explained in the tutorial we need to create a new (sub)domain in our NGINX installation, I used the following configuration for my subdomain. 22 | 23 | ``` 24 | server { 25 | listen 80; 26 | server_name subdomain.domain.tld; 27 | root /usr/share/nginx/html; 28 | autoindex on; 29 | disable_symlinks off; 30 | } 31 | ``` 32 | 33 | In the above config file you should change your root to the folder where you will store the content generated by swupd. You should also change your server name to the one you configured. The autoindex option is required to enable a simple folder view and to allow swupd to easily access the folder. I have also enabled symlinks as my root folder is a simple symlink to another folder. If your root is the actual folder where the content is stored then feel free to omit it. 34 | 35 | I used port 80 since my installation is behind a Traefik installation that takes care of enabling https on my server. It is not required to serve the content over https, but it is recommended, if you do not enable https you need to add your repository to swupd with the --allow-insecure-http flag e.g. 36 | 37 | ``` 38 | sudo swupd 3rd-party add my-3rd-party-repo \ 39 | http://clear.greginator.xyz --allow-insecure-http 40 | ``` 41 | 42 | ### Traefik 43 | For more information on how to install and use Traefik click [here](https://medium.com/@containeroo/traefik-2-0-docker-a-simple-step-by-step-guide-e0be0c17cfa5). 44 | 45 | Example docker-compose file for serving NGINX over Traefik: 46 | ``` 47 | version: '3' 48 | 49 | services: 50 | nginx: 51 | restart: always 52 | image: nginx:alpine 53 | container_name: cdn 54 | restart: unless-stopped 55 | security_opt: 56 | - no-new-privileges:true 57 | networks: 58 | - proxy 59 | volumes: 60 | - ./config/nginx:/etc/nginx/conf.d 61 | - ./static:/usr/share/nginx/html 62 | labels: 63 | - "traefik.enable=true" 64 | - "traefik.http.routers.cdn.entrypoints=http" 65 | - "traefik.http.routers.cdn.rule=Host(`sudomain.domain.com`)" 66 | - "traefik.http.middlewares.cdn-https-redirect.redirectscheme.scheme=https" 67 | - "traefik.http.routers.cdn.middlewares=cdn-https-redirect" 68 | - "traefik.http.routers.cdn-secure.entrypoints=https" 69 | - "traefik.http.routers.cdn-secure.rule=Host(`sudomain.domain.com`)" 70 | - "traefik.http.routers.cdn-secure.tls=true" 71 | - "traefik.http.routers.cdn-secure.tls.certresolver=http" 72 | - "traefik.http.routers.cdn-secure.service=cdn" 73 | - "traefik.http.services.cdn.loadbalancer.server.port=80" 74 | - "traefik.docker.network=proxy" 75 | 76 | networks: 77 | proxy: 78 | external: true 79 | ``` 80 | 81 | ## Upload content 82 | When you have created your own bundles using mixer you will have a folder named update in your mixer workspace. 83 | This folder contains a subfolder named www which contents are the files you have to upload to the server. 84 | Again there are a ton of ways to upload this folder to the correct folder on the server, but I used scp since I think it is easy to use and I have SSH access to my VPS. 85 | 86 | An example command to upload the contents of update/www/ to the server: 87 | ``` 88 | scp -r update/www/* user@server_ip:/path/to/folder/on/server 89 | ``` 90 | 91 | When our upload is finished the content should be accessible on your own server, and it should look like the structure of [https://cdn.download.clearlinux.org/](https://cdn.download.clearlinux.org/). 92 | 93 | Now you have a fully functional 3rd-party repository available to be used by swupd. 94 | 95 | --- 96 | 97 | ## Extra references 98 | * [Official swupd 3rd-party documentation](https://docs.01.org/clearlinux/latest/guides/clear/swupd-3rd-party.html) 99 | * [Initial server setup with Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-18-04) 100 | * [Docker installation](https://docs.docker.com/engine/install/) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Table of contents 2 | 1. [Adding the repo](#setup) 3 | 2. [Available Packages](#packages) 4 | 3. [Important information](#important) 5 | 1. [Updating from a version before 17-04-2020](#breaking-update) 6 | 2. [Fixes for some issues still existing with swupd 3rd-party](#fixes) 7 | 4. [Extra packages (manual installation)](#extras) 8 | 5. [Changelog](#changelog) 9 | 10 | # Adding the repo 11 | 12 | In order to use the repository, we first have to enable it with: 13 | 14 | ``` 15 | sudo swupd 3rd-party add greginator https://clear.greginator.xyz/ 16 | ``` 17 | 18 | do not change the name greginator to anything else, it is the name that will be used for the repository on your own machine and it will mean that all content of the repository will be placed under /opt/3rd-party/bundles/greginator. This is needed for some .desktop files as they are hardcoded to this path 19 | 20 | In order to list all available bundles from 3rd-party repos: 21 | 22 | ``` 23 | sudo swupd 3rd-party bundle-list -a 24 | ``` 25 | 26 | # Available Packages 27 | 28 | * FFmpeg 29 | 30 | ``` 31 | sudo swupd 3rd-party bundle-add ffmpeg 32 | ``` 33 | 34 | * Flameshot 35 | 36 | ``` 37 | sudo swupd 3rd-party bundle-add flameshot 38 | ``` 39 | 40 | * Google Chrome Stable 41 | 42 | ``` 43 | sudo swupd 3rd-party bundle-add google-chrome-stable 44 | ``` 45 | 46 | * Skype 47 | 48 | ``` 49 | sudo swupd 3rd-party bundle-add skypeforlinux 50 | ``` 51 | 52 | * Teams 53 | 54 | ``` 55 | sudo swupd 3rd-party bundle-add teams 56 | ``` 57 | 58 | * Visual Studio Code 59 | 60 | ``` 61 | sudo swupd 3rd-party bundle-add code 62 | ``` 63 | 64 | * Zoom 65 | 66 | ``` 67 | sudo swupd 3rd-party bundle-add zoom 68 | ``` 69 | 70 | * Transmission 71 | 72 | ``` 73 | sudo swupd 3rd-party bundle-add transmission 74 | ``` 75 | 76 | # Important information 77 | 78 | ## Updating from a version before 17-04-2020 79 | Since I messed up my installation and had to remove the mixer folder I now have new private keys for the repository, this means that you have to remove and add the repository again. (Note that in the first command you should replace greginator with the name you gave the repository on your device). 80 | 81 | ``` 82 | sudo swupd 3rd-party remove greginator 83 | sudo swupd 3rd-party add greginator https://clear.greginator.xyz/ 84 | ``` 85 | 86 | Now reinstall all the software that you want, your config files will still work so you don't have to reconfigure things like VS Code. 87 | 88 | ## Fixes for some issues still existing with swupd 3rd-party: 89 | 90 | ### .desktop files 91 | 92 | Currently swupd 3rd-party doesn't export .desktop files, I have patched them manually to use the /opt/3rd-party path but you still have to copy them to your applications folder. 93 | 94 | ``` 95 | cp -R /opt/3rd-party/bundles/greginator/usr/share/applications/* $HOME/.local/share/applications 96 | ``` 97 | 98 | 99 | ### VS Code filesystem watches 100 | 101 | We need to allow VS Code to watch larger filesystems for changes, the default is too small 102 | 103 | ``` 104 | sudo mkdir -p /etc/sysctl.d 105 | echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system 106 | ``` 107 | 108 | ### Codecs 109 | 110 | We need to add out codecs to the LD_LIBRARY_PATH, for this a few different things need to be done due to incompatibility between the configs for wayland, x11 and some quirck in firefox. 111 | 112 | #### LD 113 | 114 | ``` 115 | sudo tee -a /etc/ld.so.conf << EOF 116 | /opt/3rd-party/bundles/greginator/usr/lib64 117 | /opt/3rd-party/bundles/greginator/usr/lib32 118 | EOF 119 | sudo ldconfig 120 | ``` 121 | 122 | #### x11 123 | 124 | ``` 125 | sudo tee -a /etc/profile << EOF 126 | if [[ \$UID -ge 1000 && -d /opt/3rd-party/bundles/greginator/usr/lib64 && -z \$(echo \$LD_LIBRARY_PATH | grep -o /opt/3rd-party/bundles/greginator/usr/lib64) ]] 127 | then 128 | export LD_LIBRARY_PATH="/opt/3rd-party/bundles/greginator/usr/lib64:/opt/3rd-party/bundles/greginator/usr/lib32:\${LD_LIBRARY_PATH}" 129 | fi 130 | EOF 131 | ``` 132 | 133 | #### Wayland 134 | 135 | ``` 136 | sudo mkdir -p /etc/environment.d/ 137 | echo LD_LIBRARY_PATH=/opt/3rd-party/bundles/greginator/usr/lib64:/opt/3rd-party/bundles/greginator/usr/lib32 | sudo tee /etc/environment.d/10-codecs.conf 138 | ``` 139 | 140 | #### Firefox 141 | 142 | ``` 143 | echo "export LD_LIBRARY_PATH=/opt/3rd-party/bundles/greginator/usr/lib64:/opt/3rd-party/bundles/greginator/usr/lib32" >> ${HOME}/.config/firefox.conf 144 | ``` 145 | 146 | # Extra packages (manual installation) 147 | 148 | #### QTStyleplugins 149 | 150 | The QTSyleplugins package provides some files for QT5 in order to be able to theme bettter, most importantly it includes the ability for QT to use the GTK2 theme making it possible to have a uniform look for QT applications in GNOME. 151 | 152 | ``` 153 | sudo swupd bundle-add wget os-clr-on-clr qt5ct 154 | wget https://github.com/clearlinux-pkgs-3rd-party/qtstyleplugins/releases/download/v1.0/qtstyleplugins-lib-1-2.x86_64.rpm -O qtstyleplugins-lib-1-2.x86_64.rpm 155 | rpm2cpio qtstyleplugins-lib-1-2.x86_64.rpm | (cd /; sudo cpio -i -d -u 2> /dev/null); 156 | echo QT_QPA_PLATFORMTHEME=qt5ct | sudo tee /etc/environment.d/20-QT.conf 157 | ``` 158 | 159 | Now open qt5ct and set the style to gtk2, standard dialogs to GTK2, while you're at it you might want to change the icon theme and fonts as well. 160 | 161 | 162 | # Changelog 163 | 164 | * 10-05-2020 165 | * Removed transmission (it kept crashing when encryption was enabled due to using the unsupported and unsecure rc4), use qBittorrent instead 166 | * Added megasync (still hacky and not source built) 167 | * Updated chrome, vscode, skype, teams and zoom 168 | * Added libsnappy to ffmpeg-libs 169 | * Added gst-libav to ffmpeg-libs 170 | * Added platform-tools (adb & fastboot and such) 171 | * Added repo (for downloading android source code) 172 | 173 | * 17-04-2020 174 | * Removed iio-sensor-proxy since it is available in the official repositories 175 | * Added transmission (gtk version) 176 | * Updated chrome, vscode, skype, teams and flameshot 177 | * QTStyleplugins is available for manual installation 178 | --------------------------------------------------------------------------------