Nov 7, 2022 - Systemd Start Script for Superset

Create the file superset.service at /lib/systemd/system/superset.service and insert the following. Note the user is sysadmin, the port is 8088 and superset is installed in the /opt/super python virtual environment

[Unit]
Description=Start Superset

[Service]
Type=simple
User=sysadmin
Group=sysadmin
Environment="FLASK_APP=superset"
ExecStart=/opt/super/bin/superset run -p 8088 --with-threads --reload --debugger --host 0.0.0.0

[Install]
WantedBy=multi-user.target

To start the service

systemctl daemon-reload
systemctl start superset

Oct 1, 2022 - Installing Apache SuperSet

Update, Upgrade and install Dependancies

apt-get update
apt-get -y upgrade
apt-get -y install build-essential libssl-dev libffi-dev python3-dev python3-pip libsasl2-dev libldap2-dev default-libmysqlclient-dev libpq-dev python-is-python3

Install Superset set with pip on Ubuntu 20.04 while version locking a few packages

pip install --upgrade pip
pip install --upgrade pip --no-warn-script-location
pip install werkzeug==2.0.3 --no-warn-script-location
pip install flask==2.1.3 --no-warn-script-location
pip install wtforms==2.3.0 --no-warn-script-location
pip install --upgrade pyopenssl --no-warn-script-location
pip install psycopg2-binary pillow gunicorn gevent --no-warn-script-location

pip install apache-superset --no-warn-script-location

Configuring Superset and create a Superset user

sudo echo -e 'export FLASK_APP=superset' >> /etc/profile.d/superset.sh
  
export FLASK_APP=superset
FLASK_APP=superset /home/ubuntu/.local/bin/superset db upgrade

FLASK_APP=superset /home/ubuntu/.local/bin/superset fab create-admin --username admin --firstname Fname --lastname Sirname --email admin@domain.com --password <PASSWORD>

FLASK_APP=superset /home/ubuntu/.local/bin/superset init

Starting the application

#enable the python virtual environment
source super/bin/active	 
export FLASK_APP=superset
superset init
superset run -p 8088 --with-threads --reload --debugger --host 0.0.0.0

Configuring Apache2 as Proxy with SSL

sudo apt install apache2

Create the following sites in /etc/apache2/sites-available. Please change the 10.0.0.8 to the proper ip or domain.

/etc/apache2/sites-available/wesite.conf

<VirtualHost *:80>
    #ServerName server.domain.com
    #ServerAlias server.doamin.com

    #Redirect permanent / http://10.0.0.8:8088
    Redirect permanent / https://10.0.0.8

</VirtualHost>

/etc/apache2/sites-available/wesite-sll.conf

<VirtualHost *:443>
    #ServerAdmin root@domain.com
    ServerName 10.0.0.8

    #DocumentRoot /var/www
    #ServerAlias fqdn.domain.com

    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
    SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
 
    ProxyPass / http://10.0.0.8:8088/
    ProxyPassReverse / http://10.0.0.8:8088/
    ProxyRequests off
    ProxyPreserveHost On
    SSLProxyEngine On
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
</VirtualHost>

Create an SSL Certificate

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt

Enable the Apache sites, enable SSL and start the Apache2 service

sudo a2ensite website.conf
sudo a2ensite website-ssl.conf
sudo a2enmod ssl
sudo systemctl restart apache2

Aug 10, 2019 - Ansible Windows win_copy is slow

I have found a few problems with using the Ansible module win_copy. The module is slow and unreliable thus causing multiple timeouts. I have found a more reliable and quicker solution by using using win_command with robocopy.

Here is an example on how I used win_copy in the past.

- name: copy ms office dir to c drive
  win_copy:
    src:  /misc/filessoftware/chocolatey/msoffice2016/
    dest: C:\msoffice
  ignore_errors: yes
  when: hostvars[inventory_hostname]['ansible_getFacts']['Microsoft Office Professional Plus 2016'] is undefined

The new solution along with mounting a network share.

- name: Transfer of msoffice2016
  win_command: ''
  with_items:
    -  'net use  s: \\nfs.fqdn.com\software /P:yes /user:  '
    -  'robocopy s:\msoffice2016 \msoffice2016 /E'
  ignore_errors: yes
  no_log: True 
  when: hostvars[inventory_hostname]['ansible_getFacts']['Microsoft Office Professional Plus 2016'] is undefined