2022-08-22 14:35:37 -05:00
|
|
|
# Veilid
|
|
|
|
|
|
|
|
## Introduction
|
|
|
|
|
|
|
|
## Obtaining the source code
|
|
|
|
|
|
|
|
```shell
|
2023-07-10 16:59:46 -05:00
|
|
|
git clone --recurse-submodules git@gitlab.com:veilid/veilid.git
|
2022-08-22 14:35:37 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
## Dependencies
|
|
|
|
|
|
|
|
### GNU/Linux
|
|
|
|
|
|
|
|
Development of Veilid on GNU/Linux requires a Debian variant such as Debian
|
|
|
|
itself, Ubuntu or Mint. Pull requests to support other distributions would be
|
|
|
|
welcome!
|
|
|
|
|
2022-08-23 09:37:41 -05:00
|
|
|
Running the setup script requires:
|
|
|
|
* Android SDK and NDK
|
|
|
|
* Rust
|
2022-08-22 14:35:37 -05:00
|
|
|
|
2022-08-23 09:37:41 -05:00
|
|
|
You may decide to use Android Studio [here](https://developer.android.com/studio)
|
|
|
|
to maintain your Android dependencies. If so, use the dependency manager
|
2022-08-23 10:48:22 -05:00
|
|
|
within your IDE. If you plan on using Flutter for Veilid development, the Android Studio
|
|
|
|
method is highly recommended as you may run into path problems with the 'flutter'
|
|
|
|
command line without it. If you do so, you may skip to
|
2022-08-22 14:35:37 -05:00
|
|
|
[Run Veilid setup script](#Run Veilid setup script).
|
|
|
|
|
2023-01-03 08:13:18 -06:00
|
|
|
* build-tools;33.0.1
|
|
|
|
* ndk;25.1.8937393
|
2022-08-22 14:35:37 -05:00
|
|
|
* cmake;3.22.1
|
2023-01-03 08:13:18 -06:00
|
|
|
* platform-tools
|
|
|
|
* platforms;android-33
|
2022-08-22 14:35:37 -05:00
|
|
|
|
|
|
|
#### Setup Dependencies using the CLI
|
|
|
|
|
2023-03-05 12:17:36 -06:00
|
|
|
|
|
|
|
You can automatically install the prerequisites using this script:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
./install_linux_prerequisites.sh
|
|
|
|
```
|
|
|
|
|
2022-08-22 14:35:37 -05:00
|
|
|
Otherwise, you may choose to use Android `sdkmanager`. Follow the installation
|
|
|
|
instructions for `sdkmanager`
|
|
|
|
[here](https://developer.android.com/studio/command-line/sdkmanager), then use
|
|
|
|
the command line to install the requisite package versions:
|
|
|
|
|
|
|
|
```shell
|
2023-01-03 08:13:18 -06:00
|
|
|
sdkmanager --install "platform-tools"
|
|
|
|
sdkmanager --install "platforms;android-33"
|
|
|
|
sdkmanager --install "build-tools;33.0.1"
|
|
|
|
sdkmanager --install "ndk;25.1.8937393"
|
2022-08-22 14:35:37 -05:00
|
|
|
sdkmanager --install "cmake;3.22.1"
|
|
|
|
```
|
|
|
|
|
|
|
|
Export environment variables and add the Android SDK platform-tools directory to
|
|
|
|
your path.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
cat << EOF >> ~/.profile
|
|
|
|
export ANDROID_SDK_ROOT=<path to sdk>
|
2023-01-03 08:13:18 -06:00
|
|
|
export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk/25.1.8937393
|
2022-08-23 09:37:41 -05:00
|
|
|
export PATH=\$PATH:$ANDROID_SDK_ROOT/platform-tools
|
|
|
|
EOF
|
2022-08-22 14:35:37 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
#### Run Veilid setup script
|
|
|
|
|
|
|
|
Now you may run the Linux setup script to check your development environment and
|
|
|
|
pull the remaining Rust dependencies:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
./setup_linux.sh
|
|
|
|
```
|
|
|
|
|
2022-08-23 10:48:22 -05:00
|
|
|
#### Run the veilid-flutter setup script (optional)
|
|
|
|
|
|
|
|
If you are developing Flutter applications or the flutter-veilid portion, you should
|
|
|
|
install Android Studio, and run the flutter setup script:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
cd veilid-flutter
|
|
|
|
./setup_flutter.sh
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2022-08-22 14:35:37 -05:00
|
|
|
### macOS
|
|
|
|
|
2022-08-23 09:37:41 -05:00
|
|
|
Development of Veilid on MacOS is possible on both Intel and ARM hardware.
|
|
|
|
|
|
|
|
Development requires:
|
2022-08-23 11:55:15 -05:00
|
|
|
* Android Studio
|
2022-08-23 09:37:41 -05:00
|
|
|
* Xcode, preferably latest version
|
|
|
|
* Homebrew [here](https://brew.sh)
|
|
|
|
* Android SDK and NDK
|
|
|
|
* Rust
|
|
|
|
|
2022-08-23 11:55:15 -05:00
|
|
|
You will need to use Android Studio [here](https://developer.android.com/studio)
|
|
|
|
to maintain your Android dependencies. Use the SDK Manager in the IDE to install the following packages (use package details view to select version):
|
2023-01-03 08:13:18 -06:00
|
|
|
* Android SDK Build Tools (33.0.1)
|
|
|
|
* NDK (Side-by-side) (25.1.8937393)
|
2022-08-23 11:55:15 -05:00
|
|
|
* Cmake (3.22.1)
|
2023-01-03 08:13:18 -06:00
|
|
|
* Android SDK 33
|
2022-08-23 11:55:15 -05:00
|
|
|
* Android SDK Command Line Tools (latest) (7.0/latest)
|
2022-08-23 09:37:41 -05:00
|
|
|
|
2022-08-23 11:55:15 -05:00
|
|
|
#### Setup command line environment
|
2022-08-23 09:37:41 -05:00
|
|
|
|
|
|
|
Export environment variables and add the Android SDK platform-tools directory to
|
|
|
|
your path.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
cat << EOF >> ~/.zshenv
|
|
|
|
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
|
2023-01-03 08:13:18 -06:00
|
|
|
export ANDROID_NDK_HOME=$HOME/Library/Android/sdk/ndk/25.1.8937393
|
2022-08-23 09:37:41 -05:00
|
|
|
export PATH=\$PATH:$HOME/Library/Android/sdk/platform-tools
|
|
|
|
EOF
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Run Veilid setup script
|
|
|
|
|
|
|
|
Now you may run the MacOS setup script to check your development environment and
|
|
|
|
pull the remaining Rust dependencies:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
./setup_macos.sh
|
|
|
|
```
|
2022-08-22 14:35:37 -05:00
|
|
|
|
2022-08-23 10:48:22 -05:00
|
|
|
#### Run the veilid-flutter setup script (optional)
|
|
|
|
|
|
|
|
If you are developing Flutter applications or the flutter-veilid portion, you should
|
|
|
|
install Android Studio, and run the flutter setup script:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
cd veilid-flutter
|
|
|
|
./setup_flutter.sh
|
|
|
|
```
|
|
|
|
|
2022-08-22 14:35:37 -05:00
|
|
|
### Windows
|
|
|
|
|
|
|
|
**TODO**
|
|
|
|
|
2022-09-19 20:18:46 -05:00
|
|
|
## Running the Application(s)
|
|
|
|
|
|
|
|
### Veilid Server
|
2022-08-22 14:35:37 -05:00
|
|
|
|
|
|
|
In order to run the `veilid-server` locally:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
cd ./veilid-server
|
|
|
|
cargo run
|
|
|
|
```
|
|
|
|
|
|
|
|
In order to see what options are available:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
cargo run -- --help
|
|
|
|
```
|
|
|
|
|
2022-09-19 21:18:35 -05:00
|
|
|
#### Configuration
|
|
|
|
|
|
|
|
`veilid-server` has a wealth of configuration options. Further documentation on
|
|
|
|
the format of the `veilid-server.conf` file may be found [in the project /doc
|
2022-09-19 21:20:26 -05:00
|
|
|
directory](./doc/config/veilid-server-config.md).
|
2022-09-19 21:18:35 -05:00
|
|
|
|
|
|
|
When running `veilid-server` in a Unix-like environment, the application will
|
|
|
|
look for its config file under `/etc/veilid-server/`. If the config file is not
|
|
|
|
found in this location, `veilid-server` will follow the XDG user directory spec
|
|
|
|
and look in `~/.config/veilid-server`.
|
|
|
|
|
|
|
|
When running under Windows, the `veilid-server.conf` file may be created at
|
|
|
|
`C:\Users\<user>\AppData\Roaming\Veilid\Veilid\`, and when running under macOS,
|
|
|
|
at `/Users/<user>/Library/Application Support/org.Veilid.Veilid`.
|
|
|
|
|
2022-09-19 20:18:46 -05:00
|
|
|
### Veilid CLI
|
2022-08-22 14:35:37 -05:00
|
|
|
|
|
|
|
In order to connect to your local `veilid-server`:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
cd ./veilid-cli
|
|
|
|
cargo run
|
|
|
|
```
|
|
|
|
|
|
|
|
Similar to `veilid-server`, you may see CLI options by typing:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
cargo run -- --help
|
|
|
|
```
|
2022-09-19 20:18:46 -05:00
|
|
|
|
|
|
|
## Building the Application
|
|
|
|
|
|
|
|
### Linux Packages
|
|
|
|
|
|
|
|
Veilid server and cli can be built locally using the
|
|
|
|
[Earthly](https://earthly.dev/) framework. After [installing earthly on your
|
|
|
|
local machine](https://earthly.dev/get-earthly), you may use the `earthly` cli
|
|
|
|
to initiate a build:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
earthly +package-linux
|
|
|
|
```
|
|
|
|
|
|
|
|
This will assemble all dependencies and build `.deb` packages for both amd64 and
|
|
|
|
arm64 platforms. Earthly, built on Docker, caches build layers, so after a
|
|
|
|
longer first build, subsequent builds should be much quicker.
|
|
|
|
|
|
|
|
During development, you may want to kick off specific build steps. To see a list
|
|
|
|
of the build steps configured, consult the `Earthfile`, or you may use the
|
|
|
|
`earthly` cli:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
earthly ls
|
|
|
|
```
|