Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provisioning fix #501

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Install [Vagrant](https://www.vagrantup.com/).

In your etoa root run ```vagrant up```.



#### Linux

Install [Network File System](https://en.wikipedia.org/wiki/Network_File_System) if necessary. Start/Enable NFS-Server with UDP and Version 3 support.
Expand Down Expand Up @@ -42,7 +44,11 @@ Additional steps because I haven't figured out yet how to reset the db config vi
* enable CPU Virtualization in BIOS
* disable Hyper-V
* ssh connection timeout: Try Virtualbox 5.2

* Provision can't create symlinks:
* Open Start > Windows Administrative Tools > Local Security Policy
* Go to Local Policies/User Rights Assignment in tree view.
* Add user name or user groups you belongs to, to entry Create symbolic links
* Restart

## All steps below are only necessary if you dont want to use the vagrant box!!!!

Expand Down
10 changes: 8 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.box = "ubuntu/jammy64"
config.vm.hostname = "etoa-gui"

config.vm.network "private_network", ip: '192.168.33.11'

config.vm.synced_folder './', '/var/www/etoa', :nfs => true
if Vagrant::Util::Platform.windows? then
config.vm.synced_folder './', '/var/www/etoa'
else
config.vm.synced_folder './', '/var/www/etoa', :nfs => true
end



config.vm.provider "virtualbox" do |vb|
vb.customize [
Expand Down
45 changes: 25 additions & 20 deletions provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,40 @@ export DEBIAN_FRONTEND=noninteractive
sudo add-apt-repository ppa:ondrej/php
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

sudo apt-get update && sudo apt-get upgrade
sudo apt-get update -q && sudo apt-get upgrade -q

# Force a blank root password for mysql
echo "mysql-server mysql-server/root_password password " | debconf-set-selections
echo "mysql-server mysql-server/root_password_again password " | debconf-set-selections

# Install mysql, nginx, php8.0-fpm
sudo apt-get install -q -y -f git mysql-server mysql-client nginx php8.0 php8.0-fpm php8.0-xdebug
# Install mysql, nginx, php8.1-fpm
sudo apt-get install -q -y -f --no-install-recommends git mysql-server mysql-client nginx php8.1 php8.1-fpm php8.1-xdebug

# Install commonly used php packages
sudo apt-get install -q -y -f php8.0-curl php8.0-cli php8.0-mysqli php8.0-gd php8.0-dom php8.0-zip php8.0-mbstring php8.0-intl php8.0-redis
sudo apt-get install -q -y -f php8.1-curl php8.1-cli php8.1-mysql php8.1-gd php8.1-zip php8.1-mbstring php8.1-intl php8.1-redis php8.1-xml

sudo apt-get upgrade libpcre3
sudo apt-get upgrade -q libpcre3

sudo apt-get -y install curl dirmngr apt-transport-https lsb-release ca-certificates unzip
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
# install nodejs and yarn npm pkg
sudo apt-get -y -q install curl dirmngr apt-transport-https lsb-release ca-certificates unzip
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y -q nodejs
npm install --global yarn

# Setup dummy client files
cd /var/www/etoa && mkdir -p htdocs/web/build && echo "{}" > htdocs/web/build/manifest.json && echo '{"entrypoints": {"admin": {}}}' > htdocs/web/build/entrypoints.json

# Install PHP composer dependencies
cd /var/www/etoa && export COMPOSER_ALLOW_SUPERUSER=1;php composer.phar install --no-interaction
river-etoa marked this conversation as resolved.
Show resolved Hide resolved

# install yarn dependencies
cd /var/www/etoa && yarn install --frozen-lockfile

sudo rm /etc/nginx/sites-available/default
sudo cp /var/www/etoa/vagrant/nginx-default /etc/nginx/sites-available/default
sudo cp /var/www/etoa/vagrant/xdebug.ini /etc/php/8.0/mods-available/xdebug.ini
cp /var/www/etoa/vagrant/db.conf /var/www/etoa/htdocs/config
cp /var/www/etoa/vagrant/roundx.conf /vagrant/htdocs/config/eventhandler.conf
cp /var/www/etoa/vagrant/roundx.conf /var/www/etoa/htdocs/config/eventhandler.conf

sudo service nginx restart
sudo service php8.0-fpm restart
Expand All @@ -37,33 +47,28 @@ sudo chown -R www-data:www-data /var/lib/php/sessions
MYSQL=`which mysql`
PHP=`which php`

# Setup dummy client files
cd /var/www/etoa && mkdir htdocs/web/build && echo "{}" > htdocs/web/build/manifest.json && echo '{"entrypoints": {"admin": {}}}' > htdocs/web/build/entrypoints.json

# Install PHP composer dependencies
cd /var/www/etoa && export COMPOSER_ALLOW_SUPERUSER=1;php composer.phar install --no-interaction

# Install node dependencies and trigger build
cd /vagrant && yarn install --frozen-lockfile
# trigger yarn build
cd /var/www/etoa && yarn run build

# Setup database
Q0="SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));"
Q1="CREATE DATABASE IF NOT EXISTS etoa;"
Q2="GRANT USAGE ON *.* TO etoa@localhost IDENTIFIED BY 'etoa';"
Q2="CREATE USER 'etoa'@'localhost' IDENTIFIED BY 'etoa';"
Q3="GRANT ALL PRIVILEGES ON etoa.* TO etoa@localhost;"
Q4="CREATE DATABASE IF NOT EXISTS etoa_test;"
Q5="GRANT USAGE ON *.* TO etoa_test@localhost IDENTIFIED BY 'etoa';"
Q6="GRANT ALL PRIVILEGES ON etoa_test.* TO etoa@localhost;"
Q7="FLUSH PRIVILEGES;"
SQL="${Q0}${Q1}${Q2}${Q3}${Q4}${Q5}${Q6}${Q7}"
SQL="${Q0}${Q1}${Q2}${Q3}${Q4}${Q6}${Q7}"
$MYSQL -uroot -e "$SQL"

$PHP /var/www/etoa/bin/console database:migrate
$PHP /var/www/etoa/bin/console database:migrate --env=test
Q8="INSERT INTO config (config_name, config_value, config_param1, config_param2) VALUES ('loginurl','', '', '') ON DUPLICATE KEY UPDATE config_value='';"
$MYSQL -uroot -D etoa -e "$Q8"

# Allow world write access to tmp directory
sudo chmod 777 /var/www/etoa/htdocs/tmp

# Setup cronjob
echo "* * * * * php /var/www/etoa/bin/console cron:run" | crontab

Expand Down
Loading