install: updates to docs and scripts for installing core
This commit is contained in:
parent
871b1ae2af
commit
8cf2b9af08
5 changed files with 87 additions and 157 deletions
23
README.md
23
README.md
|
@ -2,7 +2,7 @@
|
|||
|
||||
CORE: Common Open Research Emulator
|
||||
|
||||
Copyright (c)2005-2021 the Boeing Company.
|
||||
Copyright (c)2005-2022 the Boeing Company.
|
||||
|
||||
See the LICENSE file included in this distribution.
|
||||
|
||||
|
@ -20,29 +20,18 @@ The following should get you up and running on Ubuntu 18+ and CentOS 7+
|
|||
from a clean install, it will prompt you for sudo password. This would
|
||||
install CORE into a python3 virtual environment and install
|
||||
[OSPF MDR](https://github.com/USNavalResearchLaboratory/ospf-mdr) from source.
|
||||
For more details on installation see [here](https://coreemu.github.io/core/install.html).
|
||||
For more detailed installation see [here](https://coreemu.github.io/core/install.html).
|
||||
|
||||
```shell
|
||||
git clone https://github.com/coreemu/core.git
|
||||
cd core
|
||||
```
|
||||
|
||||
Ubuntu:
|
||||
```shell
|
||||
./install.sh
|
||||
```
|
||||
|
||||
CentOS:
|
||||
```shell
|
||||
./setup.sh
|
||||
# Ubuntu
|
||||
inv install
|
||||
# CentOS
|
||||
./install.sh -p /usr
|
||||
```
|
||||
|
||||
To additionally install EMANE:
|
||||
```shell
|
||||
reset
|
||||
inv install-emane
|
||||
```
|
||||
|
||||
## Documentation & Support
|
||||
|
||||
We are leveraging GitHub hosted documentation and Discord for persistent
|
||||
|
|
135
docs/install.md
135
docs/install.md
|
@ -105,7 +105,7 @@ Clearing out a current install from 7.0.0+, making sure to provide options
|
|||
used for install (`-l` or `-p`).
|
||||
```shell
|
||||
cd <CORE_REPO>
|
||||
inv uninstall
|
||||
inv uninstall <options>
|
||||
```
|
||||
|
||||
Previous install was built from source for CORE release older than 7.0.0:
|
||||
|
@ -125,16 +125,29 @@ sudo apt remove core
|
|||
```
|
||||
|
||||
## Automated Install
|
||||
The automated install will do the following:
|
||||
* install base tools needed for installation
|
||||
* python3, pip, pipx, invoke, poetry
|
||||
* installs system dependencies for building core
|
||||
* clone/build/install working version of [OPSF MDR](https://github.com/USNavalResearchLaboratory/ospf-mdr)
|
||||
* installs core into poetry managed virtual environment or locally, if flag is passed
|
||||
* installs scripts pointing pointing to appropriate python location based on install type
|
||||
* installs systemd service pointing to appropriate python location based on install type
|
||||
First we will need to clone and navigate to the CORE repo.
|
||||
```shell
|
||||
# clone CORE repo
|
||||
git clone https://github.com/coreemu/core.git
|
||||
cd core
|
||||
```
|
||||
|
||||
After installation has completed you should be able to run `core-daemon` and `core-gui`.
|
||||
First you can use `setup.sh` as a convenience to install tooling for running invoke tasks:
|
||||
|
||||
> **NOTE:** `setup.sh` will attempt to determine your OS by way of `/etc/os-release`, currently it supports
|
||||
> attempts to install OSs that are debian/redhat like (yum/apt).
|
||||
|
||||
* python3, pip, venv
|
||||
* pipx 0.16.4 via pip
|
||||
* invoke 1.4.1 via pipx
|
||||
* poetry 1.1.7 via pipx
|
||||
|
||||
Then you can run `inv install <options>`:
|
||||
* installs system dependencies for building core
|
||||
* installs core into poetry managed virtual environment or locally, if flag is passed
|
||||
* installs scripts pointing to appropriate python location based on install type
|
||||
* installs systemd service pointing to appropriate python location based on install type
|
||||
* clone/build/install working version of [OPSF MDR](https://github.com/USNavalResearchLaboratory/ospf-mdr)
|
||||
|
||||
> **NOTE:** installing locally comes with its own risks, it can result it potential
|
||||
> dependency conflicts with system package manager installed python dependencies
|
||||
|
@ -142,22 +155,21 @@ After installation has completed you should be able to run `core-daemon` and `co
|
|||
> **NOTE:** provide a prefix that will be found on path when running as sudo,
|
||||
> if the default prefix /usr/local will not be valid
|
||||
|
||||
`install.sh` will attempt to determine your OS by way of `/etc/os-release`, currently it supports
|
||||
attempts to install OSs that are debian/redhat like (yum/apt).
|
||||
```shell
|
||||
# make sure pip is the latest version before moving forward
|
||||
python3 -m pip install -U pip
|
||||
inv -h install
|
||||
|
||||
# clone CORE repo
|
||||
git clone https://github.com/coreemu/core.git
|
||||
cd core
|
||||
Usage: inv[oke] [--core-opts] install [--options] [other tasks here ...]
|
||||
|
||||
# script usage: install.sh [-v] [-d] [-l] [-p <prefix>]
|
||||
#
|
||||
# -v enable verbose install
|
||||
# -d enable developer install
|
||||
# -l enable local install, not compatible with developer install
|
||||
# -p install prefix, defaults to /usr/local
|
||||
Docstring:
|
||||
install core, poetry, scripts, service, and ospf mdr
|
||||
|
||||
Options:
|
||||
-d, --dev install development mode
|
||||
-i STRING, --install-type=STRING used to force an install type, can be one of the following (redhat, debian)
|
||||
-l, --local determines if core will install to local system, default is False
|
||||
-o, --[no-]ospf disable ospf installation
|
||||
-p STRING, --prefix=STRING prefix where scripts are installed, default is /usr/local
|
||||
-v, --verbose enable verbose
|
||||
|
||||
# install core to virtual environment
|
||||
./install.sh -p <prefix>
|
||||
|
@ -166,6 +178,26 @@ cd core
|
|||
./install.sh -p <prefix> -l
|
||||
```
|
||||
|
||||
After installation has completed you should be able to run `core-daemon` and `core-gui`.
|
||||
|
||||
## Using Invoke Tasks
|
||||
The invoke tool installed by way of pipx provides conveniences for running
|
||||
CORE tasks to help ensure usage of the create python virtual environment.
|
||||
|
||||
```shell
|
||||
inv --list
|
||||
|
||||
Available tasks:
|
||||
|
||||
install install core, poetry, scripts, service, and ospf mdr
|
||||
install-emane install emane python bindings into the core virtual environment
|
||||
reinstall run the uninstall task, get latest from specified branch, and run install task
|
||||
test run core tests
|
||||
test-emane run core emane tests
|
||||
test-mock run core tests using mock to avoid running as sudo
|
||||
uninstall uninstall core, scripts, service, virtual environment, and clean build directory
|
||||
```
|
||||
|
||||
### Enabling Service
|
||||
After installation, the core service is not enabled by default. If you desire to use the
|
||||
service, run the following commands.
|
||||
|
@ -183,27 +215,6 @@ an installation to your use case.
|
|||
* make sure you have python3 invoke available to leverage `<repo>/tasks.py`
|
||||
|
||||
```shell
|
||||
cd <repo>
|
||||
|
||||
#Usage: inv[oke] [--core-opts] install [--options] [other tasks here ...]
|
||||
#
|
||||
#Docstring:
|
||||
# install core, poetry, scripts, service, and ospf mdr
|
||||
#
|
||||
#Options:
|
||||
# -d, --dev install development mode
|
||||
# -i STRING, --install-type=STRING used to force an install type, can be one of the following (redhat, debian)
|
||||
# -l, --local determines if core will install to local system, default is False
|
||||
# -o, --[no-]ospf disable ospf installation
|
||||
# -p STRING, --prefix=STRING prefix where scripts are installed, default is /usr/local
|
||||
# -v, --verbose enable verbose
|
||||
|
||||
# install virtual environment
|
||||
inv install -p <prefix>
|
||||
|
||||
# indstall locally
|
||||
inv install -p <prefix> -l
|
||||
|
||||
# this will print the commands that would be ran for a given installation
|
||||
# type without actually running them, they may help in being used as
|
||||
# the basis for translating to your OS
|
||||
|
@ -240,39 +251,3 @@ environment, when needed.
|
|||
cd <CORE_REPO>
|
||||
inv install-emane
|
||||
```
|
||||
|
||||
## Using Invoke Tasks
|
||||
The invoke tool installed by way of pipx provides conveniences for running
|
||||
CORE tasks to help ensure usage of the create python virtual environment.
|
||||
|
||||
```shell
|
||||
inv --list
|
||||
|
||||
Available tasks:
|
||||
|
||||
install install core, poetry, scripts, service, and ospf mdr
|
||||
install-emane install emane python bindings into the core virtual environment
|
||||
reinstall run the uninstall task, get latest from specified branch, and run install task
|
||||
test run core tests
|
||||
test-emane run core emane tests
|
||||
test-mock run core tests using mock to avoid running as sudo
|
||||
uninstall uninstall core, scripts, service, virtual environment, and clean build directory
|
||||
```
|
||||
|
||||
Print help for a given task:
|
||||
```shell
|
||||
inv -h install
|
||||
|
||||
Usage: inv[oke] [--core-opts] install [--options] [other tasks here ...]
|
||||
|
||||
Docstring:
|
||||
install core, poetry, scripts, service, and ospf mdr
|
||||
|
||||
Options:
|
||||
-d, --dev install development mode
|
||||
-i STRING, --install-type=STRING used to force an install type, can be one of the following (redhat, debian)
|
||||
-l, --local determines if core will install to local system, default is False
|
||||
-o, --[no-]ospf disable ospf installation
|
||||
-p STRING, --prefix=STRING prefix where scripts are installed, default is /usr/local
|
||||
-v, --verbose enable verbose
|
||||
```
|
||||
|
|
59
install.sh
59
install.sh
|
@ -1,59 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# exit on error
|
||||
set -e
|
||||
|
||||
# parse arguments
|
||||
dev=""
|
||||
verbose=""
|
||||
prefix=""
|
||||
local=""
|
||||
while getopts "dvlp:" opt; do
|
||||
case ${opt} in
|
||||
d)
|
||||
dev="-d"
|
||||
;;
|
||||
v)
|
||||
verbose="-v"
|
||||
;;
|
||||
l)
|
||||
local="-l"
|
||||
;;
|
||||
p)
|
||||
prefix="-p ${OPTARG}"
|
||||
;;
|
||||
\?)
|
||||
echo "script usage: $(basename $0) [-v] [-d] [-l] [-p <prefix>]" >&2
|
||||
echo "" >&2
|
||||
echo "-v enable verbose install" >&2
|
||||
echo "-d enable developer install" >&2
|
||||
echo "-l enable local install, not compatible with developer install" >&2
|
||||
echo "-p install prefix, defaults to /usr/local" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
# install pre-reqs using yum/apt
|
||||
if command -v apt &> /dev/null
|
||||
then
|
||||
echo "setup to install CORE using apt"
|
||||
sudo apt install -y python3-pip python3-venv
|
||||
elif command -v yum &> /dev/null
|
||||
then
|
||||
echo "setup to install CORE using yum"
|
||||
sudo yum install -y python3-pip
|
||||
else
|
||||
echo "apt/yum was not found"
|
||||
echo "install python3 and invoke to run the automated install"
|
||||
echo "inv -h install"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# install pip/invoke to run install with provided options
|
||||
python3 -m pip install --user pipx==0.16.4
|
||||
python3 -m pipx ensurepath
|
||||
export PATH=$PATH:~/.local/bin
|
||||
pipx install invoke
|
||||
inv install ${dev} ${verbose} ${local} ${prefix}
|
26
setup.sh
Executable file
26
setup.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
# exit on error
|
||||
set -e
|
||||
|
||||
# install pre-reqs using yum/apt
|
||||
if command -v apt &> /dev/null
|
||||
then
|
||||
echo "setup to install CORE using apt"
|
||||
sudo apt install -y python3-pip python3-venv
|
||||
elif command -v yum &> /dev/null
|
||||
then
|
||||
echo "setup to install CORE using yum"
|
||||
sudo yum install -y python3-pip
|
||||
else
|
||||
echo "apt/yum was not found"
|
||||
echo "install python3, pip, venv, pipx, and invoke to run the automated install"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# install tooling for invoke based installation
|
||||
python3 -m pip install --user pipx==0.16.4
|
||||
python3 -m pipx ensurepath
|
||||
export PATH=$PATH:~/.local/bin
|
||||
pipx install invoke==1.4.1
|
||||
pipx install poetry==1.1.7
|
1
tasks.py
1
tasks.py
|
@ -197,7 +197,6 @@ def install_core(c: Context, hide: bool) -> None:
|
|||
|
||||
|
||||
def install_poetry(c: Context, dev: bool, local: bool, hide: bool) -> None:
|
||||
c.run("pipx install poetry==1.1.7", hide=hide)
|
||||
if local:
|
||||
with c.cd(DAEMON_DIR):
|
||||
c.run("poetry build -f wheel", hide=hide)
|
||||
|
|
Loading…
Reference in a new issue