Added debian packaging process
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
5e895aa3ca
commit
21b48b1f3c
84
Gruntfile.js
Normal file
84
Gruntfile.js
Normal file
@ -0,0 +1,84 @@
|
||||
module.exports = function(grunt) {
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
|
||||
deb_package: {
|
||||
options: {
|
||||
maintainer: 'Gregory Ballantine <gballantine@bitgoblin.tech>',
|
||||
long_description: 'A simple web app to track inventory records.',
|
||||
output: './dist/',
|
||||
},
|
||||
build: {
|
||||
files: [
|
||||
{
|
||||
cwd: './',
|
||||
src: 'index.js',
|
||||
dest: '/opt/overseer'
|
||||
},
|
||||
{
|
||||
cwd: './',
|
||||
src: 'src/**/*',
|
||||
dest: '/opt/overseer/'
|
||||
},
|
||||
{
|
||||
cwd: './',
|
||||
src: 'views/**/*',
|
||||
dest: '/opt/overseer/'
|
||||
},
|
||||
{
|
||||
cwd: './',
|
||||
src: 'config/**/*',
|
||||
dest: '/opt/overseer/'
|
||||
},
|
||||
{
|
||||
cwd: './',
|
||||
src: 'public/**/*',
|
||||
dest: '/opt/overseer/'
|
||||
},
|
||||
{
|
||||
cwd: './build/etc/',
|
||||
src: 'production.json',
|
||||
dest: '/etc/overseer/'
|
||||
},
|
||||
{
|
||||
cwd: './build/etc/',
|
||||
src: 'overseer.service',
|
||||
dest: '/etc/systemd/system/'
|
||||
},
|
||||
{
|
||||
cwd: './',
|
||||
src: 'bin/**/*',
|
||||
dest: '/opt/overseer/'
|
||||
},
|
||||
{
|
||||
cwd: './',
|
||||
src: 'node_modules/**/*',
|
||||
dest: '/opt/overseer/'
|
||||
},
|
||||
{
|
||||
cwd: './',
|
||||
src: 'LICENSE',
|
||||
dest: '/opt/overseer/',
|
||||
},
|
||||
],
|
||||
links: {
|
||||
'/usr/bin/overseer': '/opt/overseer/bin/start.sh'
|
||||
},
|
||||
scripts: {
|
||||
postinst: {
|
||||
src: './build/scripts/postinst.sh'
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
// Load the plugin that provides the "uglify" task.
|
||||
grunt.loadNpmTasks('grunt-deb');
|
||||
|
||||
// Default task(s).
|
||||
grunt.registerTask('package', ['deb_package']);
|
||||
|
||||
};
|
5
bin/start.sh
Executable file
5
bin/start.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd /opt/overseer/
|
||||
|
||||
/usr/bin/env node index.js
|
11
build/etc/overseer.service
Normal file
11
build/etc/overseer.service
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Overseer inventory tracking app
|
||||
|
||||
[Service]
|
||||
User=overseer
|
||||
Group=overseer
|
||||
ExecStart=/usr/bin/overseer
|
||||
SuccessExitStatus=143
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
6
build/etc/production.json
Normal file
6
build/etc/production.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"database": {
|
||||
"driver": "sqlite",
|
||||
"connection_string": "/opt/overseer/data/overseer.db"
|
||||
}
|
||||
}
|
41
build/scripts/postinst.sh
Executable file
41
build/scripts/postinst.sh
Executable file
@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
|
||||
GETENT_USER=$(getent passwd overseer)
|
||||
GETENT_GROUP=$(getent group overseer)
|
||||
|
||||
# Create the overseer user if it doesn't already exist
|
||||
if [ "$GETENT_USER" = "" ]; then
|
||||
echo "Creating the 'overseer' user."
|
||||
useradd -r overseer
|
||||
else
|
||||
echo "The 'overseer' user already exists, skipping creation."
|
||||
fi
|
||||
|
||||
# Create the overseer group if it doesn't already exist
|
||||
if [ "$GETENT_GROUP" = "" ]; then
|
||||
echo "Creating the 'overseer' group."
|
||||
groupadd overseer
|
||||
usermod -aG overseer overseer
|
||||
else
|
||||
echo "The 'overseer' group already exists, skipping creation."
|
||||
fi
|
||||
|
||||
# Change the directory ownership of /etc
|
||||
chown -R overseer:overseer /etc/overseer
|
||||
|
||||
# Create the log directory under /var/log
|
||||
if [ ! -d /var/log/overseer ]; then
|
||||
echo "Creating /var/log/overseer to store log files."
|
||||
mkdir /var/log/overseer
|
||||
chown overseer:overseer /var/log/overseer
|
||||
else
|
||||
echo "/var/log/overseer already exists, skipping creation."
|
||||
fi
|
||||
|
||||
# Make sure the app's source and configuration files are owned the new user and group
|
||||
chown -R overseer:overseer /opt/overseer
|
||||
chown -R overseer:overseer /etc/overseer
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
1733
package-lock.json
generated
1733
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node index.js",
|
||||
"grunt": "grunt",
|
||||
"gulp": "gulp",
|
||||
"nodemon": "nodemon index.js",
|
||||
"lint": "eslint index.js src/**/*.js",
|
||||
@ -19,10 +20,16 @@
|
||||
"tracking"
|
||||
],
|
||||
"author": "Gregory Ballanine <gballantine@bitgoblin.tech>",
|
||||
"uploaders": [
|
||||
{ "name": "Gregory Ballantine", "email": "gballantine@bitgoblin.tech" }
|
||||
],
|
||||
"license": "BSD-2-Clause",
|
||||
"devDependencies": {
|
||||
"eslint": "^8.26.0",
|
||||
"eslint-config-google": "^0.14.0",
|
||||
"grunt": "^1.5.3",
|
||||
"grunt-cli": "^1.4.3",
|
||||
"grunt-deb": "^0.2.5",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-sass": "^5.1.0",
|
||||
"nodemon": "^2.0.20",
|
||||
|
Loading…
Reference in New Issue
Block a user