This manual is about setting up an automatic deploy workflow using nodejs, PM2, nginx and GitLab CI. It is tested on:
- Target server: Ubuntu 16.04 x64. This is suitable for Ubuntu 14.x.
 - Windows 10 on my PC to work.
 
| default: | |
| image: python:3.9 | |
| stages: | |
| - lint | |
| - test | |
| - deploy | |
| # before_script: | |
| # - pip install flake8 | 
| // example vite.config.js | |
| import { cdn } from './vite-plugin-cdn' | |
| export default { | |
| plugins: [ | |
| // also supported: esm.run, jspm | |
| // loads the dep over the CDN during dev | |
| // auto downloads and includes into the bundle during build | |
| cdn('skypack', { | |
| vue: '^3.0.5' | 
| #!/bin/bash | |
| if (xrandr | grep "DP-0 connected" > /dev/null) | |
| then | |
| exec echo "Conected" & | |
| exec xrandr --output DP-0 --mode 2560x1440 --rate 120.00 & | |
| exec xrandr --output DP-2 --off & | |
| exit | |
| fi% | 
| #!/bin/bash | |
| for i in $(grep "^[^#;]" /etc/ssh/sshd_config); do | |
| echo $i | |
| for s in ChallengeResponseAuthentication PasswordAuthentication PermitRootLogin X11Forwarding GSSAPIAuthentication;do | |
| echo $s | |
| if [[ $i == "$s"* ]]; then | |
| echo $i; | |
| echo $s; | |
| sed -i "s/$s .*/$s no/g" /etc/ssh/sshd_config; | |
| fi; | 
| /** | |
| * This hook overrides a function check at runtime. Currently, cordova-android 7+ incorrectly detects that we are using | |
| * an eclipse style project. This causes a lot of plugins to fail at install time due to paths actually being setup | |
| * for an Android Studio project. Some plugins choose to install things into 'platforms/android/libs' which makes | |
| * this original function assume it is an ecplise project. | |
| */ | |
| module.exports = function(context) { | |
| if (context.opts.cordova.platforms.indexOf('android') < 0) { | |
| return; | |
| } | 
| #!/bin/sh | |
| # SPDX-FileCopyrightText: 2017-2024 SanderTheDragon <[email protected]> | |
| # | |
| # SPDX-License-Identifier: MIT | |
| arch=$(dpkg --print-architecture) | |
| echo "Detected architecture: $arch" | |
| case "$arch" in | 
| axios({ | |
| url: 'http://localhost:5000/static/example.pdf', | |
| method: 'GET', | |
| responseType: 'blob', // important | |
| }).then((response) => { | |
| const url = window.URL.createObjectURL(new Blob([response.data])); | |
| const link = document.createElement('a'); | |
| link.href = url; | |
| link.setAttribute('download', 'file.pdf'); | |
| document.body.appendChild(link); | 
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
| #!/bin/sh | |
| # PATH TO YOUR HOSTS FILE | |
| ETC_HOSTS=/etc/hosts | |
| # DEFAULT IP FOR HOSTNAME | |
| IP="127.0.0.1" | |
| # Hostname to add/remove. | |
| HOSTNAME=$1 |