Shopware 6 CI and Post Deploy - deployment

I am trying to set up continuous integration for a Shopware 6 store via Github Actions. Once the code is on the server, I am running the following commands in order to complete the deploy. Unfortunately, I can't seem to find a good tutorial or article on the post deploy steps necessary.
Which folders need write permissions?
Which console commands need to fire? Which ones are optional? (cache:clear theme:compile and so on?
Which npm commands are mandatory?
what's the config/jwt folder with its certificates and what certificates go in there?
Are there additional commands needed to get DB Migrations running?
sudo php bin/console cache:clear
sudo php bin/console dal:refresh:index
sudo php bin/console theme:compile
sudo rm -rf var/cache
sudo /usr/bin/npm clean-install --prefix vendor/shopware/administration/Resources
sudo /usr/bin/npm run --prefix vendor/shopware/administration/Resources lerna -- bootstrap
sudo /usr/bin/npm clean-install --prefix vendor/shopware/storefront/Resources/app/storefront /
sudo /usr/bin/node vendor/shopware/storefront/Resources/app/storefront/copy-to-vendor.js
sudo php bin/console bundle:dump
sudo sh bin/build-js.sh
PROJECT_ROOT=/var/www/path-to-shopware/ sudo /usr/bin/npm --prefix vendor/shopware/storefront/Resources/app/storefront/ run production
It would be great to learn how others deploy SW6 and to compare this to what others need to do, once the Shopware 6 code is on the server. What tools do you use? Ansible or any other tools. Although this mostly works, I cannot use updates due to an error coming from the API.

Related

pdftron html2pdf sample can't work on k8s?

run from this Dockerfile
FROM centos:8
USER root
WORDDIR /root
RUN yum install -y wget java-1.8.0-openjdk-devel.i686
RUN wget https://www.pdftron.com/downloads/PDFNetC64.tar.gz
RUN tar xvfz PDFNetC64.tar.gz
RUN cd PDFNetC64/Samples/HTML2PDFTest/JAVA
CMD ["/bin/bash", "RunTest.sh"]
The result is perfect, pdfs can be generated.
However, if I deploy the docker image in a k8s (UI: rancher) env, then it stopped working, the screenshot is:
So could anybody give me some clue? I am doubting there is some special settings in k8s, and because pdftron is calling native so library by JNI, so is there anything I need to pay attention to?
Any idea is appreciated, thanks guys.

Install MongoDB on Manjaro

I'm facing difficulties installing the MongoDB community server on Manjaro Linux.
There isn't official documentation on how to install it on Arch-based systems and Pacman can't find it in the AUR repos.
Has anyone ever tried to install it?
Here is what I did to install.
As the package is not available in the official Arch repositories and can't be installed using pacman, you need to follow a few steps to install it.
First, you need to get the URL for the repo of prebuilt binaries from AUR. It can be found here and by the time of writing this it was https://aur.archlinux.org/mongodb-bin.git
Simply clone the repo in your home directory or anywhere else. Do git clone https://aur.archlinux.org/mongodb-bin.git, then head to the cloned directory, cd mongodb-bin.
Now, all you need to do is to run makepkg -si command to make the package. the -s flag will handle the dependencies for you and the -i flag will install the package.
After makepkg finishes its execution, don't forget to start mongodb.service. Run systemctl start mongodb and if needed enable it with systemctl enable mongodb.
Type mongo in the terminal and if the Mongo Shell runs you are all set.
Later edit (8.2.2021): This package is now available in AUR.
It is available in AUR, so you can view it with pamac with -a flag,
eg.
pamac search -a mongodb-bin
pamac info -a mongodb-bin
And, then build and install with (this can be done after manually cloning too) -
pamac build mongodb-bin
Note that there's also a package named mongodb, but mongodb-bin is a newer release (you can check the version numbers by search or info arguments)
I've been using mongodb via docker for a couple of years.
In my experience, it's easier than installing the regular way. (assuming you already have docker installed)
1. Ensure you have docker installed
If you don't already have it, you can install via pacman/pamac, because it's in the official Arch/Manjaro package repositories. The easiest way is to run the following command:
sudo pacman -S docker
2. Run a single docker command
sudo docker run -d -p 27017:27017 -v ~/mongodb_data:/data/db mongo
This command will run mongodb on a port 27017, and place its data files into a folder ~/mongodb_data.
If you're running this command for the first time, it will also download all the required files.
Now you're successfully running a local instance of mongodb, and you can connect it with your favorite db management tool or from your code.

Webtatic PHP7.1 is missing

After installing PHP7.1 using this on CentOS7
https://webtatic.com/packages/php71/
Running
php -v
Results in
-bash: php: command not found
The install worked but PHP is not there - have I missed a step?
Since you have installed php from webtatic, you'll need to install the cli SAPI.
To do that you need to run:
sudo yum install php71w-cli
After the installation, try running the below to see if it works:
php --version
https://webtatic.com/packages/php71/
Contained in the php71w-cli package, this SAPI allows running scripts from the command-line, and also has a built-in web server for development-use. Located at /usr/bin/php
I had similar issues on my computer. For me the command was just renamed to php7 or php71. So if have the same issue please create a symlink.
Find out where your php7 file is residing
$ which php7
/usr/bin/php7
Symlink this file
sudo ln -s /usr/bin/php7 /usr/bin/php
Test that this is working
php -v
Your problem should be solved. Only case might be that you need to change newly created file as executable or change the owner/group.
Please let me know if this was helpful.

ownCloud "Downgrading not supported" after apt-get upgrade

I am running an ownCloud installation on Raspbian on an RPi2 and I just ran:
apt-get update
apt-get dist-upgrade
Now I get the following message when I try to go to my ownCloud-site in the browser:
Downgrading is not supported and is likely to cause unpredictable
issues (from 8.2.2.2 to 8.1.5.2)
I did not make any changes and definitely didn't do any downgrade (consciously). The files are stored on an external HDD and seem to be unaffected. I wasn't really actively using my cloud storage yet (fortunately), so I wouldn't really mind if the data I had put there was lost, but I'd like to keep the other data stored on the HDD (outside the ownCloud folder) if possible. What would you suggest as the best way forward? I thought about just removing ownCloud via apt-get purge - or would that be unsave or leave some junk on my system (I'd maybe have to delete the database manually)? And how can I avoid this problem in the future?
Try to connect to the official repository
wget -nv https://download.owncloud.org/download/repositories/stable/Ubuntu_14.04/Release.key -O Release.key
apt-key add - < Release.key
sh -c "echo 'deb http://download.owncloud.org/download/repositories/stable/Ubuntu_14.04/ /' >> /etc/apt/sources.list.d/owncloud.list"
apt-get update
apt-get dist-upgrade
same problem here - find out that i have old owncloud http in source list:
http://download.opensuse.org/repositories/isv:/ownCloud:/community/Debian_7.0/
new one is (check official page)
http://download.owncloud.org/download/repositories/stable/Debian_7.0/
change it, run upgrade again and manually disable maintenance mode (in /var/www/owncloud/config/config.php)
Same issue for me... Just this morning...
I think it's necessary to download current release from OwnCloud and re-install starting from it.
But before: I'll check if is possible to add OwnCloud as source of apt package, so a new apt-get update / apt-get upgrade will solve the problem and avoid future similar issues.
have a look at https://www.der-webcode.de/owncloud-manuelles-updateupgrade-von-owncloud/. Works fine for me. Don't forget to set Maintaince to false in your config.php.
Torsten
thank you fixed if still have problems try this
Stop the upgrade process this way:
cd /var/www/owncloud/
sudo -u www-data php occ maintenance:mode --off
And start the manual process:
sudo -u www-data php occ upgrade
If this does not work properly, try the repair function:
sudo -u www-data php occ maintenance:repair

How to replicate a Python 2.7, Bottle, MongoDB OpenShift application locally in Linux Mint 17?

This started as a question, but I think I've figured out most of the parts, so am posting it here for reference. It is relatively involved, but I think it may be useful to others contemplating this scenario.
I'm a newb with some of these areas, so if mistakes are made in regards to security issues in Apache or other bad practices, please correct.
Also note that, as it stands, the local development version that is produced from following the steps below no longer has git enabled on it due to changes between it and the production code. So I will keep the local git repo in another location.
Desired Behaviour
Option One:
Replicate my current Python 2.7, Bottle, MongoDB OpenShift application locally to speed up development time (during git push etc).
Option Two (if significantly easier):
Replicate my current Python 2.7, Bottle, MongoDB Openshift application locally *without the OpenShift platform* to speed up development time.
Current Behaviour
I have a Python 2.7, Bottle, MongoDB application on OpenShift.
My current workflow is:
Edit locally.
git add --all
git commit -m "here is a message"
git push origin master (this updates the live site on openshift)
git push github master (this updates github repo)
Obviously this is not ideal for developing due to the time each push takes before I can see the results.
Directory Structure
This is the structure of my app now that it is running locally:
Environment
Linux Mint 17 Cinnamon
Steps To Replicate Locally
01) MongoDB 2.4.9 - DONE
Install instructions for MongoDB 2.4.9 on Linux Mint 17:
http://docs.mongodb.org/v2.4/tutorial/install-mongodb-on-ubuntu
02) RockMongo 1.1 (which requires Apache, PHP and MongoDB Driver) - DONE
sudo apt-get install apache2 php5
sudo apt-get install php5-dev php5-cli
sudo apt-get install php-pear
pear version
pecl version
sudo pecl install mongo
At this point, I was prompted with something that included [no] and I just pressed Enter.
cd /etc/php5/apache2
sudo vi php.ini
Add this to the end of the file:
extension=mongo.so
Then restart:
/etc/init.d/apache2 restart
Then install RockMongo:
cd /var/www/html
wget https://github.com/iwind/rockmongo/archive/1.1.7.zip
unzip 1.1.7.zip
mv rockmongo-1.1.7 rockmongo
rm 1.1.7.zip
03) Create clean virtualenv environment and install packages to it - DONE
virtualenv is a Python package that lets you create independent, virtual environments containing their own Python installation and packages.
Install virtualenv through Synaptic Package Manager.
How To Create
https://code.google.com/p/modwsgi/wiki/VirtualEnvironments
By the author of mod_wsgi, Graham Dumpleton.
Why To Create
http://www.dabapps.com/blog/introduction-to-pip-and-virtualenv-python/
This article is so brilliant it almost make me want to cry, kudos, kudos.
Commands
Before doing the following, install python2.7-dev, libxml2-dev, libxslt1-dev and apache2-dev via Synaptic Package Manager to resolve errors when doing pip installs later.
# change to your html folder
cd /var/www/html
# this will create a folder called ENV that contains its own instance
# of python without inheriting your system's installed python packages.
# it will also install independent instances of pip and setuptools.
# the --no-site-packages option is the default setting in recent versions
# however I added it just to be sure.
virtualenv --no-site-packages ENV
New python executable in ENV/bin/python
Installing setuptools, pip...done.
# you can 'activate' the virtual environment so that each time you use
# pip it automatically installs packages in the virtual environment.
# change to your virtual environment folder
cd /var/www/html/ENV
# activate the virtual environment
source bin/activate
# you can deactivate this by typing 'deactivate` and it is also
# automatically deactivated each time you close the terminal.
deactivate
# from time to time you can save the names of the packages you have
# installed to your virtual environment via pip to a text file with:
pip freeze > requirements.txt
# note, after installing virtualenv as shown above, you will have some
# packages installted by default.
pip freeze
argparse==1.2.1
wsgiref==0.1.2
# requirements.txt would allow installation of all required packages via:
pip install -r requirements.txt
# install packages, whilst virtualenv is activated
pip install bottle
pip install https://github.com/FedericoCeratto/bottle-cork/archive/master.zip
pip install requests
pip install pymongo==2.6.2
pip install beautifulsoup4
pip install lxml
pip install Beaker
pip install pycrypto
pip install pillow
pip install tldextract
04) Copy existing application files to new location - DONE
cp -r path/to/open_shift_apps/my-app/. /var/www/html
05) Remove files and folder unnecessary for *local* production from var/www/html - DONE
rm -r data
rm -r libs
rm -r .openshift
rm -r .git
rm setup.py
rm setup.pyc
rm setup.pyo
06) mod_wsgi - DONE
Through Synaptic Package Manager.
Apache wouldn't work for me unless mod_wsgi was installed at system level, ie it didn't work when mod_wsgi was installed within virtualenv.
07) Understand the relationship between the Apache server, mod_wsgi and your application - DONE
Apache
To run a dynamic website locally, you need a server, in this case we used Apache.
mod_wsgi
mod_wsgi is an Apache module which extends Apache so that rules can be added to its configuration which point to your Python code so that it can be run when a user visits a particular path.
08) Configure Apache rules
/etc/apache2/sites-available/000-default.conf
WSGIPythonHome /var/www/html/ENV
WSGIPythonPath /var/www/html:/var/www/html/ENV/lib/python2.7/site-packages:/var/www/html/wsgi
<VirtualHost *:80>
# for all content in static folder - css, js, img, fonts
Alias /static/ /var/www/html/wsgi/static/
# for rockmongo
Alias /rockmongo /var/www/html/rockmongo
<Directory /var/www/html/rockmongo>
Order deny,allow
Allow from all
</Directory>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
WSGIScriptAlias / /var/www/html/wsgi/application
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
When a user visits a particular path, Apache looks for an application object which contains code which will run your Python program.
In this case, the object is located at wsgi/application and is triggered when the user goes to localhost.
/var/www/html/wsgi/application
from mybottleapp import application
09) Check file ownership and permissions
If things don't work at any stage of the process, be sure to look at the permissions of your local files. Not having the right permissions could mean that your application is not imported.
10) mongodump from OpenShift and mongorestore locally
How to mongodump from OpenShift and mongorestore locally on MongoDB 2.4.9?
Further Reading
How Python web frameworks, WSGI and CGI fit together
https://docs.python.org/2/howto/webservers.html
http://wsgi.readthedocs.org/en/latest/servers.html
https://code.google.com/p/modwsgi/
https://www.python.org/dev/peps/pep-0333
http://bottlepy.org/docs/dev/deployment.html#apache-mod-wsgi