From bdc9fe410d5b9cad8e8aad37829a66ed2125d7f2 Mon Sep 17 00:00:00 2001 From: Vadim Troshchinskiy Shmelev Date: Thu, 11 Jan 2024 14:50:33 +0100 Subject: [PATCH 1/3] Demo de contenedor minimo de OGBrowser --- .gitignore | 1 + vagrant/ogbrowser-sway/.init.sh.swp | Bin 0 -> 12288 bytes vagrant/ogbrowser-sway/Vagrantfile | 75 +++++++++++++++++++++++ vagrant/ogbrowser-sway/files/sway/config | 1 + vagrant/ogbrowser-sway/init.sh | 41 +++++++++++++ vagrant/ogbrowser-sway/logind.conf | 44 +++++++++++++ 6 files changed, 162 insertions(+) create mode 100644 vagrant/ogbrowser-sway/.init.sh.swp create mode 100644 vagrant/ogbrowser-sway/Vagrantfile create mode 100644 vagrant/ogbrowser-sway/files/sway/config create mode 100755 vagrant/ogbrowser-sway/init.sh create mode 100644 vagrant/ogbrowser-sway/logind.conf diff --git a/.gitignore b/.gitignore index 8351056..a165d88 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +vagrant/ogbrowser-sway/.vagrant CMakeLists.txt.user* out build diff --git a/vagrant/ogbrowser-sway/.init.sh.swp b/vagrant/ogbrowser-sway/.init.sh.swp new file mode 100644 index 0000000000000000000000000000000000000000..40877e99c74ccacfa346b702ad418771204d5dfc GIT binary patch literal 12288 zcmeI2KaU$l6u{>KUH(D%0xx%IP&D4V04FG1B=I6FalXiR38XUPop<)+c4zl?X6={) zlnx0fNYbZ?l#c+24}b)1J^>vC6$o11&f309?hq*ndX|1#&zpa5eluHGp5gkf?iRe) zS{L+rO^7d^KEj`V7wfP8*%A|_O;*SM<>Ra>_glvLR_M{1x|2J67OJDXKs&N-=AwKw zEc2<~18m@bV89nE;&WQZsrg#ooIh8dd(MmeU;}J`4X^<=zy{a= z8(;%$fDNz#Hoyj6LIX+*(LXK3xigeJ{r|uC{r|^#A$}u%B%Tmo6JHTu5)aP_@qoBb z+#?Q%kBN_nTg2PM8R9hY*I6NcC7u#L6W%@5?MQL8D18jYRfn{sGuonCBRRU%9g#%hA##|R}JRE8FX);sVy zl$8zf`F-g{(wW-FMb;t|z+J^X{w?%b3{ zy3DQ7CI%hUnwsH{IMv2^Srv4>TO)}*oTMr!F|60$rCZ)crQqs=LQ6ZoiS5-eu0-d^ zNZqzshsJGPJ?A}MWmRp&rE1@-of(hZrRQ_J=~&r`Q7r5o#3h7g3& zmbLTX@jY**xqIMclVsC5oSmbYJkx)9K$Zt#l@^Y7i@fyEi{nl|-r2p{-yLjicjC5M z)O6x&-K)L9jed8#-`&04PD(PDsPwt|_xszuU3vrBHn(&wA4`>ZQ@=6jL6Y)|5uLn< Hq>aVjEzO)2 literal 0 HcmV?d00001 diff --git a/vagrant/ogbrowser-sway/Vagrantfile b/vagrant/ogbrowser-sway/Vagrantfile new file mode 100644 index 0000000..0fa208f --- /dev/null +++ b/vagrant/ogbrowser-sway/Vagrantfile @@ -0,0 +1,75 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure("2") do |config| + # The most common configuration options are documented and commented below. + # For a complete reference, please see the online documentation at + # https://docs.vagrantup.com. + + # Every Vagrant development environment requires a box. You can search for + # boxes at https://vagrantcloud.com/search. + config.vm.box = "bento/ubuntu-22.04" + + config.nfs.verify_installed = false + #config.vm.synced_folder '.', '/vagrant', disabled: true + + # Disable automatic box update checking. If you disable this, then + # boxes will only be checked for updates when the user runs + # `vagrant box outdated`. This is not recommended. + # config.vm.box_check_update = false + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. In the example below, + # accessing "localhost:8080" will access port 80 on the guest machine. + # NOTE: This will enable public access to the opened port + # config.vm.network "forwarded_port", guest: 80, host: 8080 + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine and only allow access + # via 127.0.0.1 to disable public access + # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" + + # Create a private network, which allows host-only access to the machine + # using a specific IP. + # config.vm.network "private_network", ip: "192.168.33.10" + + # Create a public network, which generally matched to bridged network. + # Bridged networks make the machine appear as another physical device on + # your network. + # config.vm.network "public_network" + + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + # config.vm.synced_folder "../data", "/vagrant_data" + config.vm.synced_folder '.', '/vagrant', type: 'sshfs' + config.vm.synced_folder "../..", "/vagrant_data", type: 'sshfs' + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + config.vm.provider "libvirt" do |v| + # # Display the VirtualBox GUI when booting the machine + # vb.gui = true + # + # # Customize the amount of memory on the VM: + v.memory = "4096" + end + # + # View the documentation for the provider you are using for more + # information on available options. + + # Enable provisioning with a shell script. Additional provisioners such as + # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the + # documentation for more information about their specific syntax and use. + # config.vm.provision "shell", inline: <<-SHELL + # apt-get update + # apt-get install -y apache2 + # SHELL +end diff --git a/vagrant/ogbrowser-sway/files/sway/config b/vagrant/ogbrowser-sway/files/sway/config new file mode 100644 index 0000000..7ee89b2 --- /dev/null +++ b/vagrant/ogbrowser-sway/files/sway/config @@ -0,0 +1 @@ +exec /usr/bin/OGBrowser https://google.com diff --git a/vagrant/ogbrowser-sway/init.sh b/vagrant/ogbrowser-sway/init.sh new file mode 100755 index 0000000..e61e2d2 --- /dev/null +++ b/vagrant/ogbrowser-sway/init.sh @@ -0,0 +1,41 @@ +#!/bin/bash +set -e +export DEBIAN_FRONTEND=noninteractive +export DEBIAN_PRIORITY=critical +export NEEDRESTART_MODE=a + + +BUILD_DEPENDENCIES="build-essential cmake g++ qt6-base-dev qt6-webengine-dev linguist-qt6 libgl1-mesa-dev qt6-tools-dev qt6-l10n-tools qt6-tools-dev-tools libqt6core5compat6-dev lxqt-build-tools qt6-webengine-dev-tools libqt6webenginecore6-bin" + + +## Initial setup +sudo apt update +sudo apt dist-upgrade -y + + +## Install dependencies and build +sudo apt install -y $BUILD_DEPENDENCIES + +mkdir -p /tmp/build +cd /tmp/build +cmake /vagrant_data/ +make -j2 +sudo make install + + +## Ensure we have the requirements to run the browser +sudo apt install -y sway qt6-wayland kitty-terminfo ncdu libqt6core5compat6 libqt6webenginewidgets6 libqt6webenginecore6-bin + + + +## Remove everything unneeded. +sudo apt -y remove $BUILD_DEPENDENCIES +sudo apt -y autoremove +sudo apt clean all +sudo journalctl --vacuum-size=16M + +## Setup sway + +mkdir -p $HOME/.config/sway +cp -v /vagrant/files/sway/config $HOME/.config/sway + diff --git a/vagrant/ogbrowser-sway/logind.conf b/vagrant/ogbrowser-sway/logind.conf new file mode 100644 index 0000000..ab600bc --- /dev/null +++ b/vagrant/ogbrowser-sway/logind.conf @@ -0,0 +1,44 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 2.1 of the License, or (at your option) +# any later version. +# +# Entries in this file show the compile time defaults. Local configuration +# should be created by either modifying this file, or by creating "drop-ins" in +# the logind.conf.d/ subdirectory. The latter is generally recommended. +# Defaults can be restored by simply deleting this file and all drop-ins. +# +# Use 'systemd-analyze cat-config systemd/logind.conf' to display the full config. +# +# See logind.conf(5) for details. + +[Login] +#NAutoVTs=6 +#ReserveVT=6 +#KillUserProcesses=no +#KillOnlyUsers= +#KillExcludeUsers=root +#InhibitDelayMaxSec=5 +#UserStopDelaySec=10 +#HandlePowerKey=poweroff +#HandleSuspendKey=suspend +#HandleHibernateKey=hibernate +#HandleLidSwitch=suspend +#HandleLidSwitchExternalPower=suspend +#HandleLidSwitchDocked=ignore +#HandleRebootKey=reboot +#PowerKeyIgnoreInhibited=no +#SuspendKeyIgnoreInhibited=no +#HibernateKeyIgnoreInhibited=no +#LidSwitchIgnoreInhibited=yes +#RebootKeyIgnoreInhibited=no +#HoldoffTimeoutSec=30s +#IdleAction=ignore +#IdleActionSec=30min +#RuntimeDirectorySize=10% +#RuntimeDirectoryInodesMax=400k +#RemoveIPC=yes +#InhibitorsMax=8192 +#SessionsMax=8192 From 0cc9c2a91dc66a5a1e29089946d6a3a01934f21b Mon Sep 17 00:00:00 2001 From: Vadim Troshchinskiy Shmelev Date: Fri, 12 Jan 2024 12:25:51 +0100 Subject: [PATCH 2/3] Ejecutar script de init desde vagrant --- vagrant/ogbrowser-sway/Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vagrant/ogbrowser-sway/Vagrantfile b/vagrant/ogbrowser-sway/Vagrantfile index 0fa208f..e314955 100644 --- a/vagrant/ogbrowser-sway/Vagrantfile +++ b/vagrant/ogbrowser-sway/Vagrantfile @@ -68,7 +68,7 @@ Vagrant.configure("2") do |config| # Enable provisioning with a shell script. Additional provisioners such as # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the # documentation for more information about their specific syntax and use. - # config.vm.provision "shell", inline: <<-SHELL + config.vm.provision "shell", path: "init.sh" # apt-get update # apt-get install -y apache2 # SHELL From 8035462c76840c29bdc9a10536071823e0ab44bc Mon Sep 17 00:00:00 2001 From: Natalia Serrano Date: Wed, 17 Jan 2024 15:13:44 +0100 Subject: [PATCH 3/3] Don't remove libqt6webenginecore6-bin, support vbox, install sway config to user's home --- vagrant/ogbrowser-sway/.init.sh.swp | Bin 12288 -> 0 bytes vagrant/ogbrowser-sway/Vagrantfile | 4 ++++ vagrant/ogbrowser-sway/init.sh | 8 ++++---- 3 files changed, 8 insertions(+), 4 deletions(-) delete mode 100644 vagrant/ogbrowser-sway/.init.sh.swp diff --git a/vagrant/ogbrowser-sway/.init.sh.swp b/vagrant/ogbrowser-sway/.init.sh.swp deleted file mode 100644 index 40877e99c74ccacfa346b702ad418771204d5dfc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2KaU$l6u{>KUH(D%0xx%IP&D4V04FG1B=I6FalXiR38XUPop<)+c4zl?X6={) zlnx0fNYbZ?l#c+24}b)1J^>vC6$o11&f309?hq*ndX|1#&zpa5eluHGp5gkf?iRe) zS{L+rO^7d^KEj`V7wfP8*%A|_O;*SM<>Ra>_glvLR_M{1x|2J67OJDXKs&N-=AwKw zEc2<~18m@bV89nE;&WQZsrg#ooIh8dd(MmeU;}J`4X^<=zy{a= z8(;%$fDNz#Hoyj6LIX+*(LXK3xigeJ{r|uC{r|^#A$}u%B%Tmo6JHTu5)aP_@qoBb z+#?Q%kBN_nTg2PM8R9hY*I6NcC7u#L6W%@5?MQL8D18jYRfn{sGuonCBRRU%9g#%hA##|R}JRE8FX);sVy zl$8zf`F-g{(wW-FMb;t|z+J^X{w?%b3{ zy3DQ7CI%hUnwsH{IMv2^Srv4>TO)}*oTMr!F|60$rCZ)crQqs=LQ6ZoiS5-eu0-d^ zNZqzshsJGPJ?A}MWmRp&rE1@-of(hZrRQ_J=~&r`Q7r5o#3h7g3& zmbLTX@jY**xqIMclVsC5oSmbYJkx)9K$Zt#l@^Y7i@fyEi{nl|-r2p{-yLjicjC5M z)O6x&-K)L9jed8#-`&04PD(PDsPwt|_xszuU3vrBHn(&wA4`>ZQ@=6jL6Y)|5uLn< Hq>aVjEzO)2 diff --git a/vagrant/ogbrowser-sway/Vagrantfile b/vagrant/ogbrowser-sway/Vagrantfile index e314955..0a97618 100644 --- a/vagrant/ogbrowser-sway/Vagrantfile +++ b/vagrant/ogbrowser-sway/Vagrantfile @@ -72,4 +72,8 @@ Vagrant.configure("2") do |config| # apt-get update # apt-get install -y apache2 # SHELL + + config.vm.provider "virtualbox" do |v| + v.memory = "4096" + end end diff --git a/vagrant/ogbrowser-sway/init.sh b/vagrant/ogbrowser-sway/init.sh index e61e2d2..18322d5 100755 --- a/vagrant/ogbrowser-sway/init.sh +++ b/vagrant/ogbrowser-sway/init.sh @@ -29,13 +29,13 @@ sudo apt install -y sway qt6-wayland kitty-terminfo ncdu libqt6core5compat6 libq ## Remove everything unneeded. -sudo apt -y remove $BUILD_DEPENDENCIES +sudo apt -y remove $BUILD_DEPENDENCIES libqt6webenginecore6-bin+ sudo apt -y autoremove sudo apt clean all sudo journalctl --vacuum-size=16M ## Setup sway -mkdir -p $HOME/.config/sway -cp -v /vagrant/files/sway/config $HOME/.config/sway - +mkdir -p /home/vagrant/.config/sway +cp -v /vagrant/files/sway/config /home/vagrant/.config/sway +chown -R vagrant:vagrant /home/vagrant/.config