Skip to content

Commit

Permalink
add postgres readme, fix config globbing, add swagger update
Browse files Browse the repository at this point in the history
  • Loading branch information
killua-eu committed Mar 6, 2024
1 parent b9c3205 commit b11f9ed
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ sudo mkdir -p /etc/apt/keyrings
# Ubuntu is really slow on some packages. We add ppas
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php -y
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/nginx-mainline -y
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash -
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
#postgres
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /usr/share/keyrings/microsoft-archive-keyring.gpg >/dev/null
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql
wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /usr/share/keyrings/postgresql-archive-keyring.gpg >/dev/null
# base
apt install -y nginx libnginx-mod-http-headers-more-filter php php-fpm php-apcu php-bcmath php-curl php-dev php-gd php-gmp php-imap php-json php-mbstring php-mysql php-pear php-readline php-soap php-xml php-zip apache2-utils git mysql-server
sudo apt-get update
apt install -y nginx libnginx-mod-http-headers-more-filter php php-fpm php-apcu php-bcmath php-curl php-dev php-gd php-gmp php-imap php-json php-pgsql php-mbstring php-mysql php-pear php-readline php-soap php-xml php-zip apache2-utils git mysql-server postgresql
# composer
sudo curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
Expand All @@ -35,6 +37,8 @@ echo "extension=sqlsrv.so" > /etc/php/$(php --ini | grep Loaded | cut -d'/' -f4)
phpenmod pdo_sqlsrv
phpenmod sqlsrv
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
sudo sed -i '/^#.*local\s*all\s*all\s*peer/b; /local\s*all\s*all\s*peer/s/^/#/' /etc/postgresql/16/main/pg_hba.conf
grep -q "local\s*all\s*all\s*scram-sha-256" /etc/postgresql/16/main/pg_hba.conf || echo "local all all scram-sha-256" | sudo tee -a /etc/postgresql/16/main/pg_hba.conf
# tools
apt install -y jq mc
Expand All @@ -50,9 +54,17 @@ systemctl start php8.2-fpm
systemctl start nginx
systemctl enable php8.2-fpm
systemctl enable nginx
systemctl start postgresql
systemctl enable postgresql
systemctl start mysql
systemctl enable mysql
```

```
sudo -u postgres psql -c "CREATE DATABASE glued"
sudo -u postgres psql -c "CREATE USER glued WITH PASSWORD 'glued-pw'"
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE glued TO glued"
mysql -e "CREATE DATABASE glued /*\!40100 DEFAULT CHARACTER SET utf8 */;"
mysql -e "CREATE USER glued@localhost IDENTIFIED BY 'glued-pw';"
Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@
"genkey": [
"Glued\\Lib\\ComposerHooks::genKey"
],
"swagger-update": [
"wget https://unpkg.com/swagger-ui-dist@latest/swagger-ui.css -O public/openapi-ui/swagger-ui.css",
"wget https://unpkg.com/swagger-ui-dist@latest/swagger-ui-bundle.js -O public/openapi-ui/swagger-ui-bundle.js",
"wget https://unpkg.com/swagger-ui-dist@latest/swagger-ui-standalone-preset.js -O public/openapi-ui/swagger-ui-standalone-preset.js"
],
"migrate": [
"vendor/vaizard/glued-lib/src/Scripts/migrate.sh"
],
Expand Down
4 changes: 2 additions & 2 deletions glued/container.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@
// TODO replicate foreach below to other microservices.
// TODO document in readme that no recursive array_merge is done and that you intentionally have to repeat defaults or alternatively use extensions such as 'overwrite' and 'append' to differentate and merge arrays recursively (or not) accordingly
$files[] = __ROOT__ . '/vendor/vaizard/glued-lib/src/defaults.yaml';
$files = array_merge($files, glob($refs['env']['DATAPATH'] . '/glued-stor/config/*.y*ml'));
$files = array_merge($files, glob($refs['env']['DATAPATH'] . '/*/config/*.y*ml'));
foreach ($files as $file) {
$yaml = file_get_contents($file);
$array = $class_sy->parse($yaml, $class_sy::PARSE_CONSTANT);
$ret = array_merge($ret, $class_ye->expandArrayProperties($array, $refs));
}

// Read the routes
$files = glob($ret['glued']['datapath'] . '/*/cache/routes.yaml');
$files = glob($ret['glued']['datapath'] . '/*/cache/routes.y*ml');
foreach ($files as $file) {
$yaml = file_get_contents($file);
$array = $class_sy->parse($yaml);
Expand Down

0 comments on commit b11f9ed

Please sign in to comment.