mirror of
https://codeberg.org/vlw/dotfiles.git
synced 2025-11-05 01:12:42 +01:00
wip: 2025-10-04T21:28:52+0000 (1759613332)
This commit is contained in:
parent
0d0c0adaa7
commit
67cabd038e
2 changed files with 119 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -14,6 +14,7 @@
|
|||
!.bash_aliases
|
||||
!.bash_profile
|
||||
!.local/bin/
|
||||
!.local/bin/vlw_install_programs
|
||||
!.local/bin/code_server_export_extensions
|
||||
!.local/share/
|
||||
!.local/share/code-server/
|
||||
|
|
|
|||
118
.local/bin/vlw_install_programs
Executable file
118
.local/bin/vlw_install_programs
Executable file
|
|
@ -0,0 +1,118 @@
|
|||
#!/bin/bash
|
||||
|
||||
install_packages() {
|
||||
local PACKAGES=(
|
||||
"jq"
|
||||
"git"
|
||||
"curl"
|
||||
)
|
||||
|
||||
# Create a string with the package names separated by spaces
|
||||
local package_list="${PACKAGES[*]}"
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y $package_list
|
||||
}
|
||||
|
||||
install_mariadb() {
|
||||
local PACKAGES=(
|
||||
"mysql-client"
|
||||
"mariadb-server"
|
||||
)
|
||||
|
||||
sudo apt install $PACKAGES[*]
|
||||
|
||||
# Create a database user for the webserver
|
||||
sudo mysql -u root -e "CREATE USER 'www-data'@'localhost' IDENTIFIED WITH unix_socket; GRANT ALL PRIVILEGES ON *.* TO 'www-data'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES;"
|
||||
}
|
||||
|
||||
install_webserver() {
|
||||
local WWW_PATH="/var/www"
|
||||
local PATH_NGINX="/etc/nginx"
|
||||
local PACKAGES=(
|
||||
"nginx"
|
||||
"composer"
|
||||
)
|
||||
|
||||
sudo apt install $PACKAGES[*]
|
||||
|
||||
sudo mkdir $WWW_PATH/fw
|
||||
sudo mkdir $WWW_PATH/tools
|
||||
sudo mkdir $WWW_PATH/sites
|
||||
|
||||
sudo rm -r $WWW_PATH/default
|
||||
sudo rm $PATH_NGINX/sites-enabled/default
|
||||
|
||||
# Download default configs
|
||||
sudo curl -o $PATH_NGINX/snippets https://git.vlw.se/config/nginx/raw/branch/master/snippets/ssl.conf
|
||||
sudo curl -o $PATH_NGINX/sites-available https://git.vlw.se/config/nginx/raw/branch/master/dev/sites-available/80.conf
|
||||
sudo curl -o $PATH_NGINX/sites-available https://git.vlw.se/config/nginx/raw/branch/master/dev/sites-available/443.conf
|
||||
|
||||
# Download and install Vegvisir
|
||||
cd $WWW_PATH/fw
|
||||
git clone git@codeberg.org:vegvisir/vegvisir
|
||||
|
||||
cd $WWW_PATH/fw/vegvisir
|
||||
composer install
|
||||
|
||||
cp -p .env.example.ini .env.ini
|
||||
|
||||
# Download and install Reflect
|
||||
cd $WWW_PATH/fw
|
||||
git clone git@codeberg.org:reflect/reflect
|
||||
|
||||
cd $WWW_PATH/fw/reflect
|
||||
composer install
|
||||
|
||||
cp -p .env.example.ini .env.ini
|
||||
|
||||
sudo chown :www-data -R $WWW_PATH
|
||||
}
|
||||
|
||||
install_php_fpm() {
|
||||
local PHP_VERSION="8.4"
|
||||
local PHP_INI_PATH="/etc/php/$PHP_VERSION/fpm/php.ini"
|
||||
local PACKAGES=(
|
||||
"lsb-release"
|
||||
"ca-certificates"
|
||||
|
||||
"php$PHP_VERSION-fpm"
|
||||
"php$PHP_VERSION-mysql"
|
||||
"php$PHP_VERSION-xdebug"
|
||||
"php$PHP_VERSION-mbstring"
|
||||
)
|
||||
|
||||
# https://packages.sury.org/php/README.txt
|
||||
sudo curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
|
||||
sudo dpkg -i /tmp/debsuryorg-archive-keyring.deb
|
||||
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
|
||||
|
||||
# Install packages
|
||||
sudo apt update
|
||||
sudo apt install $PACKAGES[*]
|
||||
|
||||
# Make a backup of the php.ini file
|
||||
sudo cp -p "$PHP_INI_PATH" "$PHP_INI_PATH~"
|
||||
# Use sed to replace the zend_extension line
|
||||
sudo sed -i 's/^zend_extension=.*/zend_extension=xdebug/' "$PHP_INI_PATH"
|
||||
|
||||
sudo systemctl restart php$PHP_VERSION-fpm
|
||||
}
|
||||
|
||||
install_code_server() {
|
||||
local EXTENSIONS_FILE="$HOME/.local/share/code-server/User/extensions.json"
|
||||
|
||||
# https://coder.com/docs/code-server/install
|
||||
curl -fsSL https://code-server.dev/install.sh | sh
|
||||
|
||||
# Install extensions
|
||||
jq -r '.[]' $EXTENSIONS_FILE | while IFS= read -r extension; do
|
||||
code-server --install-extension $extension
|
||||
done
|
||||
}
|
||||
|
||||
install_packages
|
||||
|
||||
install_php_fpm
|
||||
install_webserver
|
||||
#install_code_server
|
||||
Loading…
Add table
Reference in a new issue