Skip to content

Commit

Permalink
Update vagrantfile (i'm still not sure it works)
Browse files Browse the repository at this point in the history
  • Loading branch information
celestora committed Apr 10, 2022
1 parent 595a7ba commit a8815a2
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 33 deletions.
16 changes: 11 additions & 5 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "freebsd/FreeBSD-12.1-STABLE"
config.vm.box = "freebsd/FreeBSD-13.1-RC2"
config.vm.box_version = "2022.04.07"

config.vm.network "forwarded_port", guest: 80, host: 4000

config.vm.synced_folder ".", "/.ovk_release"

config.vm.provider "virtualbox" do |vb|
vb.gui = true
vb.memory = "1024"
vb.cpus = 4
vb.memory = "1568"
end

config.vm.provider "vmware_workstation" do |vwx|
vwx.gui = true
vwx.vmx["memsize"] = "1568"
vwx.vmx["numvcpus"] = "4"
end

config.vm.provision "shell", inline: "/bin/tcsh /.ovk_release/install/automated/freebsd-12/install"
config.vm.provision "shell", inline: "/bin/tcsh /.ovk_release/install/automated/freebsd-13/install"
end
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/tcsh

##########################################################################################################\
# OpenVK AutoInstallation Script for FreeBSD 12 # /( )` #
# OpenVK AutoInstallation Script for FreeBSD 13 # /( )` #
# ------------------------------------------------------------- # \ \___ / | #
# # /- _ `-/ ' #
# This script installs OpenVK on an empty FreeBSD 12 box. # (/\/ \ \ /\ #
# This script installs OpenVK on an empty FreeBSD 13 box. # (/\/ \ \ /\ #
# Copyright (c) 2020 OpenVK contributors # / / | ` \ #

This comment has been minimized.

Copy link
@veselcraft

veselcraft Apr 10, 2022

Member

а копирайт обновить

This comment has been minimized.

Copy link
@itsv1eds

itsv1eds Apr 11, 2022

а копирайт обновить

завтра

# ------------------------------------------------------------- # O O ) / | #
# # `-^--'`< ' #
Expand All @@ -27,28 +27,27 @@ if ($? == 1) then
endif

set osVer = `freebsd-version -r`
if ($osVer !~ "12.*") then
echo "Fatal Error: This installation supports only FreeBSD 12, but you have FreeBSD $osVer installed."
if ($osVer !~ "13.*") then
echo "Fatal Error: This installation supports only FreeBSD 13, but you have FreeBSD $osVer installed."
exit 201
endif

# Update system
pkg update
pkg upgrade
cd /tmp
mkdir ovkinstall
cd ovkinstall

# Install required packages
yes | pkg install git php74 mod_php74 php74-gd php74-mbstring php74-iconv php74-json php74-sodium php74-calendar php74-curl php74-brotli php74-zip php74-openssl php74-ctype php74-dom php74-fileinfo php74-PDO php74-pdo_mysql php74-sqlite3 php74-pdo_sqlite php74-sockets php74-tokenizer php74-opcache php74-posix php74-pecl-yaml php74-phar php74-filter php74-zlib php74-session php74-simplexml node www/npm mysql80-server mysql80-client ffmpeg
rehash

# Install programming languages and Git
yes | pkg install git
yes | pkg install php74
yes | pkg install mod_php74 # will also install Apache2.4
yes | pkg install php74-gd php74-mbstring php74-iconv php74-json php74-sodium php74-calendar php74-curl php74-brotli php74-zip php74-openssl php74-ctype php74-dom php74-fileinfo php74-PDO php74-pdo_mysql php74-sqlite3 php74-pdo_sqlite php74-sockets php74-tokenizer php74-opcache php74-posix php74-pecl-yaml php74-phar php74-filter php74-zlib php74-session
# Install package managers
npm i -g yarn
curl -LO https://getcomposer.org/installer
php ./installer --install-dir=/bin --filename=composer --preview
rm -f ./installer
yes | pkg install node npm
npm i -g yarn
rehash

# Download OVK distro
cd /tmp
git clone https://github.com/openvk/openvk.git

# Install chandler
Expand All @@ -58,7 +57,7 @@ git clone https://github.com/openvk/chandler.git

cd chandler
yes | composer install
cp /tmp/openvk/install/automated/common/chandler.yml /opt/chandler/chandler.yml
cp /tmp/ovkinstall/openvk/install/automated/common/chandler.yml /opt/chandler/chandler.yml
chown -R www: .
chmod -R 777 .

Expand All @@ -75,7 +74,7 @@ cd /opt/chandler
ln -s /opt/chandler/extensions/available/commitcaptcha /opt/chandler/extensions/enabled/commitcaptcha

# Install OpenVK
cp -r /tmp/openvk /opt/chandler/extensions/available/openvk
cp -r /tmp/ovkinstall/openvk /opt/chandler/extensions/available/openvk
ln -s /opt/chandler/extensions/available/openvk /opt/chandler/extensions/enabled/openvk

cd ./extensions/available/openvk
Expand All @@ -84,36 +83,46 @@ yes | composer install
cd Web/static/js
yarn install

cp /tmp/openvk/install/automated/common/openvk.yml /opt/chandler/extensions/available/openvk/openvk.yml
cp /tmp/ovkinstall/openvk/install/automated/common/openvk.template.yml /opt/chandler/extensions/available/openvk/openvk.yml

cd ../../../
chown -R www: .
chmod -R 777 .

# Install MySQL
yes | pkg install mariadb105-server mariadb105-client
# Setup databases
sysrc mysql_enable="yes"
service mysql-server start
nohup /usr/local/libexec/mariadbd >& /dev/null & # service mysql-server start doesn't work
sleep 15

# Mount databases
cd /opt/chandler
mysql < /tmp/openvk/install/automated/common/mk_db.sql
mysql < /tmp/ovkinstall/openvk/install/automated/common/mk_db.sql
mysql -p'justMonika' openvk < install/init-db.sql
mysql -p'justMonika' openvk < /tmp/openvk/install/init-static-db.sql
mysql -p'justMonika' openvk-eventdb < /tmp/openvk/install/init-event-db.sql
mysql -p'justMonika' openvk < /tmp/ovkinstall/openvk/install/init-static-db.sql
mysql -p'justMonika' openvk-eventdb < /tmp/ovkinstall/openvk/install/init-event-db.sql

cd /tmp/ovkinstall/openvk/install/sqls
foreach migration (*.sql)
mysql -p'justMonika' openvk < $migration
end

# Change database settings
echo "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'justMonika'; FLUSH PRIVILEGES;" | mysql -p'justMonika';

sed -i'' -e 's:/var/run/mysql/mysql.sock:/tmp/mysql.sock:' /opt/chandler/chandler.yml
sed -i'' -e 's:/var/run/mysql/mysql.sock:/tmp/mysql.sock:' /opt/chandler/extensions/available/openvk/openvk.yml

# Alias folders
rm -rf /usr/local/www/apache24/data
ln -s /opt/chandler/htdocs /usr/local/www/apache24/data

# Configure Apache
cp /tmp/openvk/install/automated/common/httpd.conf /usr/local/etc/apache24/httpd.conf
cp /tmp/openvk/install/automated/common/httpd-php.conf /usr/local/etc/apache24/Includes/php.conf
cp /tmp/ovkinstall/openvk/install/automated/common/httpd.conf /usr/local/etc/apache24/httpd.conf
cp /tmp/ovkinstall/openvk/install/automated/common/httpd-php.conf /usr/local/etc/apache24/Includes/php.conf
sysrc apache24_enable="yes"
service apache24 start

# Cleanup
rm -rf /opt/ovkinstall

# Enjoy
echo "~================= OpenVK 2 Installed =================~"
echo " Use it: http://localhost:80/ "
Expand Down

1 comment on commit a8815a2

@itsv1eds
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

хорошая работа

Please sign in to comment.