nethserver-cockpit-empty-VueJS scaffold

Working on a template to build cockpit application with VueJS

in short https://nethserver.github.io/nethserver-cockpit/tutorial/

git clone https://github.com/stephdl/nethserver-cockpit-empty-VueJS
cd nethserver-cockpit-empty-VueJS
./prep-sources
make-rpms *.spec

then you should have something to start your work (dashboard, settings, logs, about) and the template to put your esmith files.

OK, you will have other things to do of course, but I hope you could save time :slight_smile:

@dev_team I need your inputs, I put maybe too much dependencies, but it is what I missed to understand the first time

5 Likes

I don’t think so, for the UI part you included the common used components, nice work! :+1:

2 Likes

Good morning, @stephdl. Thank you for your contribution.

I was trying to replicate your project, but I am encountering the following issue when compiling it.

I’m not proficient, and I have recently started exploring this fantastic world.

From reading various posts, I understood that I should not compile with the “root” user. With which user should I perform the operations: ./prep-sources and make-rpms *.spec?

[root@nethsecurity nethserver-cybersecurity]# sudo make-rpms *.spec

prep-sources [INFO] source0 git archive: nethserver-cybersecurity-0.0.0.tar.gz
INFO: mock.py version 2.17 starting (python version = 3.6.8, NVR = mock-2.17-1.e                                                                                                             l7)...
Start(bootstrap): init plugins
INFO: selinux disabled
Finish(bootstrap): init plugins
Start: init plugins
INFO: selinux disabled
Finish: init plugins
INFO: Signal handler active
Start: run
INFO: Start(nethserver-cybersecurity.spec)  Config(nethserver-7-x86_64)
Start: clean chroot
Finish: clean chroot
Start(bootstrap): chroot init
INFO: calling preinit hooks
INFO: enabled root cache
INFO: enabled package manager cache
Start(bootstrap): cleaning package manager metadata
Finish(bootstrap): cleaning package manager metadata
INFO: enabled HW Info plugin
Mock Version: 2.17
INFO: Mock Version: 2.17
Finish(bootstrap): chroot init
Start: chroot init
INFO: calling preinit hooks
INFO: enabled root cache
Start: unpacking root cache
Finish: unpacking root cache
INFO: enabled package manager cache
Start: cleaning package manager metadata
Finish: cleaning package manager metadata
INFO: enabled HW Info plugin
Mock Version: 2.17
INFO: Mock Version: 2.17
Start: yum update
Failed to create directory /var/lib/mock/nethserver-7-x86_64-bootstrap/root//sys/fs/selinux: Read-only file system
Failed to create directory /var/lib/mock/nethserver-7-x86_64-bootstrap/root//sys/fs/selinux: Read-only file system
Failed to set locale, defaulting to C
Finish: yum update
Finish: chroot init
Start: buildsrpm
Start: rpmbuild -bs
Failed to create directory /var/lib/mock/nethserver-7-x86_64/root//sys/fs/selinux: Read-only file system
Failed to create directory /var/lib/mock/nethserver-7-x86_64/root//sys/fs/selinux: Read-only file system
error: Bad file: /builddir/build/SOURCES/nethserver-cybersecurity.tar.gz: No such file or directory
    Bad file: /builddir/build/SOURCES/nethserver-cybersecurity.tar.gz: No such file or directory
Building target platforms: x86_64
Building for target x86_64


RPM build errors:
Finish: rpmbuild -bs
Finish: buildsrpm
ERROR: Exception(nethserver-cybersecurity.spec) Config(nethserver-7-x86_64) 1 minutes 59 seconds
INFO: Results and/or logs in: .
INFO: Cleaning up build root ('cleanup_on_failure=True')
Start: clean chroot
Finish: clean chroot
ERROR: Command failed:
 # /usr/bin/systemd-nspawn -q -M 2f12e32a6dd74ed1aa3a791483aa5567 -D /var/lib/mock/nethserver-7-x86_64/root -a -u mockbuild --capability=cap_ipc_lock --bind=/tmp/mock-resolv.1eom65se:/etc/resolv.conf --bind=/dev/btrfs-control --bind=/dev/loop-control --bind=/dev/loop0 --bind=/dev/loop1 --bind=/dev/loop2 --bind=/dev/loop3 --bind=/dev/loop4 --bind=/dev/loop5 --bind=/dev/loop6 --bind=/dev/loop7 --bind=/dev/loop8 --bind=/dev/loop9 --bind=/dev/loop10 --bind=/dev/loop11 --setenv=TERM=vt100 --setenv=SHELL=/bin/bash --setenv=HOME=/builddir --setenv=HOSTNAME=mock --setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin --setenv=PROMPT_COMMAND=printf "\033]0;<mock-chroot>\007" --setenv=PS1=<mock-chroot> \s-\v\$  --setenv=LANG=C.UTF-8 bash --login -c /usr/bin/rpmbuild -bs --target x86_64 --nodeps /builddir/build/SPECS/nethserver-cybersecurity.spec

Info

[root@nethsecurity nethserver-cybersecurity]# yum info nethserver-mock
Loaded plugins: changelog, copr, nethserver_events
Installed Packages
Name        : nethserver-mock
Arch        : noarch
Version     : 1.6.3
Release     : 1.ns7
Size        : 71 k
Repo        : installed
From repo   : /nethserver-mock-1.6.3-1.ns7.noarch
Summary     : RPM build automation scripts for NethServer packages
URL         : http://www.nethserver.org
License     : GPLv3
Description : Provides build automation scripts for NethServer packages
[root@nethsecurity nethserver-cybersecurity]#  rpm -q kernel
kernel-3.10.0-1160.80.1.el7.x86_64
kernel-3.10.0-1160.81.1.el7.x86_64
kernel-3.10.0-1160.83.1.el7.x86_64
kernel-3.10.0-1160.88.1.el7.x86_64
kernel-3.10.0-1160.90.1.el7.x86_64

Operating System

 Operating System: NethServer Enterprise 7.9.2009
           CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-1160.80.1.el7.x86_64
            Architecture: x86-64

Save de project

[root@nethsecurity nethserver-cybersecurity]# pwd
/root/Prject_newVersion/nethserver-cybersecurity

I apologize in advance for my poor English.

hum you do not to be root to build but your user must be in mock group

╭─stephdl@leo-stephdl-dynu-net ~ ‹master*›
╰─➤ groups stephdl
stephdl : stephdl wheel libvirt mock vboxusers

1 Like

this does not need to be invocated, it is called from make-rpms

1 Like

or maybe yes, with time I became lazzy

╰─➤  cat ~/bin/build
#!/bin/bash
PREP=$2
SERVER=$1
if [[  -z $1 ]];then
    echo "#
# usage 
#

build the rpm and upload to the VM:
    build ns7loc10    # build with prep-source
    build ns7loc10 -p # build without prep-source"
    exit 0
fi

if [[ -n $2 ]]; then
    clean; make-rpms *.spec && /usr/bin/scp *.noarch.rpm $1:/root
elif [[ -f 'prep-sources' ]];then 
    clean; ./prep-sources && make-rpms *.spec && /usr/bin/scp *.{noarch,x86_64}.rpm $1:/root
else
    clean ; make-rpms *.spec && /usr/bin/scp *.{noarch,x86_64}.rpm $1:/root
fi
╰─➤  cat ~/bin/clean
#!/bin/bash

if [[ $1 == '-a' ]]; then 
    echo 'clean *.rpm *.gz *.xz'
    /bin/rm *.rpm *.gz *.xz 
elif [[ $1 == '-h' ]]; then 
echo '- remove rpm & tar if `-a` else remove only *.rpm'
else
    echo 'clean *.rpm'
    /bin/rm *.rpm
fi

I do

build root@hostname and it goes directly to /root of hostname

1 Like

you build on NS7, generally I use fedora, actually F38

2 Likes

I use this sourcelist for mock

╰─➤  cat /etc/mock/nethserver-7-x86_64.cfg                                                                                                                                                                   130 ↵
#
# NethServer 7 mock configuration 
#

import string

config_opts['target_arch'] = 'x86_64'
config_opts['legal_host_arches'] = ('x86_64',)
config_opts['root'] = 'nethserver-7-x86_64'
config_opts['chroot_setup_cmd'] = ('install', '@buildsys-build')
config_opts['plugin_conf']['ccache_enable'] = False

config_opts['macros']['%url_prefix'] = 'http://github.com/NethServer'
config_opts['macros']['%vendor'] = 'NethServer'
config_opts['macros']['%dist'] = 'ns7'


config_opts['plugin_conf']['tmpfs_enable'] = True
config_opts['plugin_conf']['tmpfs_opts'] = {}
config_opts['plugin_conf']['tmpfs_opts']['required_ram_mb'] = 4096
config_opts['plugin_conf']['tmpfs_opts']['max_fs_size'] = '10g'
config_opts['plugin_conf']['tmpfs_opts']['mode'] = '0755'
config_opts['plugin_conf']['tmpfs_opts']['keep_mounted'] = False


config_opts['package_manager'] = 'yum'
#config_opts['bootstrap_package_manager'] = 'yum'

# Substitute $releasever and $basearch:
config_opts['yum.conf'] = string.Template("""


[main]
cachedir=/var/cache/yum
debuglevel=1
logfile=/var/log/yum.log
reposdir=/dev/null
retries=20
obsoletes=1
gpgcheck=0
assumeyes=1
plugins=1
ui_repoid_vars=1
http_caching=none

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
enablegroups=0

[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
enablegroups=0

[nethserver-base]
name=NethServer-$releasever - Base
mirrorlist=http://mirrorlist.nethserver.org/?release=$releasever&repo=base&arch=$basearch
#baseurl=http://mirror.nethserver.org/nethserver/$releasever/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-NethServer-$releasever
enabled=1
enablegroups=0

[nethserver-updates]
name=NethServer-$releasever - Updates
mirrorlist=http://mirrorlist.nethserver.org/?release=$releasever&repo=updates&arch=$basearch
#baseurl=http://mirror.nethserver.org/nethserver/$releasever/updates/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-NethServer-$releasever
enabled=1
enablegroups=1

[nethserver-testing]
name=NethServer-$releasever - Testing
mirrorlist=http://mirrorlist.nethserver.org/?release=$releasever&repo=testing&arch=$basearch
#baseurl=http://mirror.nethserver.org/nethserver/$releasever/testing/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-NethServer-$releasever
enabled=0
enablegroups=0

[epel]
name=Extra Packages for Enterprise Linux $releasever - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/$releasever/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever&arch=$basearch
failovermethod=priority
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever

""").substitute(releasever='7', basearch=config_opts['target_arch'], infra='stock')
2 Likes