-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3bf8c79
commit c7fbe91
Showing
59 changed files
with
14,893 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ztnet.network |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
google-site-verification: google46bf74768b883ad6.html |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# robots.txt | ||
User-agent: * | ||
Disallow: | ||
Sitemap: https://sinamics.github.io/ztnet/sitemap.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | ||
<url> | ||
<loc>https://sinamics.github.io/ztnet/</loc> | ||
<lastmod>2023-08-27</lastmod> | ||
</url> | ||
</urlset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Dependencies | ||
/node_modules | ||
|
||
# Production | ||
/build | ||
|
||
# Generated files | ||
.docusaurus | ||
.cache-loader | ||
|
||
# Misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Website | ||
|
||
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator. | ||
|
||
### Installation | ||
|
||
``` | ||
$ yarn | ||
``` | ||
|
||
### Local Development | ||
|
||
``` | ||
$ yarn start | ||
``` | ||
|
||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. | ||
|
||
### Build | ||
|
||
``` | ||
$ yarn build | ||
``` | ||
|
||
This command generates static content into the `build` directory and can be served using any static contents hosting service. | ||
|
||
### Deployment | ||
|
||
Using SSH: | ||
|
||
``` | ||
$ USE_SSH=true yarn deploy | ||
``` | ||
|
||
Not using SSH: | ||
|
||
``` | ||
$ GIT_USER=<Your GitHub username> yarn deploy | ||
``` | ||
|
||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
sidebar_position: 4 | ||
--- | ||
|
||
# How ZTNET Works | ||
|
||
## Overview | ||
|
||
ZTnet is a web-based user interface developed in TypeScript, designed to facilitate easier management of ZeroTier networks. It works as an intermediary between the end-user and the ZeroTier Controller API, providing an intuitive interface for network management tasks. | ||
|
||
## Core Components | ||
|
||
### Frontend | ||
|
||
The frontend is built using TypeScript along with modern web frameworks to offer an interactive and user-friendly experience. | ||
|
||
### Backend | ||
|
||
The backend acts as the bridge between the frontend and the ZeroTier Controller API, also written in TypeScript. It handles API requests and performs data transformation, making it easier to manage the network configurations. | ||
|
||
## Communication Flow | ||
|
||
1. **User Input**: The user performs actions on the ZTnet web UI. | ||
2. **API Requests**: ZTnet translates these actions into API requests. | ||
3. **ZeroTier Controller API**: These requests are sent to the ZeroTier Controller API for processing. | ||
4. **API Responses**: The API sends back the data or status update. | ||
5. **Display Data**: ZTnet then takes this information and updates the UI accordingly. | ||
|
||
## ZeroTier API Reference | ||
|
||
For more details about the API endpoints and data formats used, you can refer to the [ZeroTier API Documentation](https://docs.zerotier.com/service/v1/). | ||
|
||
## Language and Libraries | ||
|
||
- **Language**: TypeScript | ||
- **Key Libraries**: React, Next.js | ||
|
||
## Conclusion | ||
|
||
Understanding the basic structure and flow of ZTnet can help both end-users and developers get the most out of the application. The modular design and the use of TypeScript make it scalable and easy to contribute to. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
sidebar_position: 5 | ||
--- | ||
|
||
# Developer | ||
|
||
## Introduction | ||
|
||
ZTnet uses a Development Container to simplify the development setup. This container orchestrates a development environment that includes PostgreSQL and ZeroTier, all configured through a `.devcontainer/docker-compose.yml` file. This setup ensures that the internal network remains consistent, making development easier and more efficient. | ||
|
||
## Prerequisites | ||
|
||
- Docker installed | ||
- Docker Compose installed | ||
- Visual Studio Code with the Remote - Containers extension | ||
|
||
## Step-by-Step Guide to Start Development | ||
|
||
### 1. Clone the Repository | ||
|
||
```bash | ||
git clone https://github.com/sinamics/ztnet.git | ||
``` | ||
|
||
### 2. Navigate to Project Directory | ||
|
||
```bash | ||
cd ztnet | ||
``` | ||
|
||
### 3. Open in Visual Studio Code | ||
|
||
Open the project in Visual Studio Code. | ||
|
||
### 4. Attach to Dev Container | ||
|
||
- In Visual Studio Code, look for the "Remote Explorer" icon in the sidebar. | ||
- Under the "Containers" section, you will see the Dev Container for this project. | ||
- Right-click and choose "Attach to Container". | ||
|
||
|
||
### 5. Install Dependencies | ||
|
||
Once inside the container, navigate to your project folder and install the required Node.js dependencies. | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
### 6. Start the Development Server | ||
|
||
```bash | ||
npm run dev | ||
``` | ||
|
||
Your ZTnet application should now be running in development mode. Any changes you make to the codebase will automatically be reflected in the application. | ||
|
||
## Conclusion | ||
|
||
Using a Development Container significantly streamlines the setup process, allowing you to focus more on developing features rather than setting up your environment. This also ensures that every developer works within a similar setup, reducing the "it works on my machine" problems. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
sidebar_position: 3 | ||
--- | ||
|
||
# Standalone FreeBSD | ||
|
||
### Install PostgreSQL and ZeroTier | ||
First, make sure PostgreSQL and ZeroTier are installed and configured on your FreeBSD server. | ||
```bash | ||
pkg install zerotier | ||
pkg install postgresql13-server postgresql13-contrib | ||
sysrc postgresql_enable=yes | ||
service postgresql initdb | ||
service postgresql start | ||
``` | ||
|
||
### Install Node.js and npm | ||
Next, install Node.js version 18. | ||
```bash | ||
curl -sL https://install-node.now.sh/lts | bash | ||
``` | ||
|
||
### Setup Ztnet | ||
|
||
1. Clone the Ztnet repository: | ||
```bash | ||
git clone https://github.com/sinamics/ztnet.git | ||
``` | ||
|
||
2. Navigate into the directory: | ||
```bash | ||
cd ztnet | ||
``` | ||
|
||
3. Checkout version: | ||
```bash | ||
git checkout tags/v0.3.6 | ||
``` | ||
|
||
4. Install the Node.js dependencies: | ||
```bash | ||
npm install | ||
``` | ||
|
||
5. Create a `.env` file in the root directory and populate it with the necessary environment variables. Make sure these match what you've set up in your PostgreSQL database. | ||
``` | ||
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres?schema=public | ||
ZT_ADDR=http://localhost:9993 | ||
NEXT_PUBLIC_SITE_NAME=ZTnet | ||
NEXTAUTH_URL="http://localhost:3000" | ||
NEXTAUTH_SECRET="random_secret" | ||
``` | ||
6. Populate the PostgreSQL database with the necessary tables: | ||
```bash | ||
npx prisma migrate deploy | ||
npx prisma db seed | ||
``` | ||
7. Build Next.js production: | ||
```bash | ||
npm run build | ||
``` | ||
8. Run server: | ||
```bash | ||
cd .next/standalone | ||
node server.js | ||
``` | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"label": "Installation", | ||
"position": 1, | ||
"link": { | ||
"type": "generated-index" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
--- | ||
sidebar_position: 2 | ||
--- | ||
|
||
# Standalone Debian 11 | ||
|
||
|
||
### Install PostgreSQL and ZeroTier | ||
First, make sure PostgreSQL and ZeroTier are installed and configured on your FreeBSD server. | ||
```bash | ||
curl -s https://install.zerotier.com | sudo bash | ||
sudo apt install postgresql postgresql-contrib | ||
``` | ||
|
||
Set a password for the PostgreSQL user. If you change the password, make sure to update the `DATABASE_URL` url variable in the `.env` file. | ||
```bash | ||
sudo -u postgres psql | ||
\password postgres | ||
``` | ||
### Install Node.js and npm | ||
Next, install Node.js version 18. | ||
```bash | ||
curl -sL https://deb.nodesource.com/setup_18.x | sudo bash - | ||
sudo apt-get install -y nodejs | ||
``` | ||
|
||
### Copy necessary files | ||
Copy mkworld binary to `/usr/local/bin/`: | ||
```bash | ||
cp ztnodeid/build/linux_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')/ztmkworld /usr/local/bin/ztmkworld | ||
``` | ||
|
||
### Setup Ztnet | ||
|
||
1. Clone the Ztnet repository: | ||
```bash | ||
git clone https://github.com/sinamics/ztnet.git | ||
``` | ||
|
||
2. Navigate into the directory: | ||
```bash | ||
cd ztnet | ||
``` | ||
|
||
3. Checkout version: | ||
```bash | ||
git checkout tags/v0.3.6 | ||
```` | ||
4. Install the Node.js dependencies: | ||
```bash | ||
npm install | ||
``` | ||
|
||
5. Create a `.env` file in the root directory and populate it with the necessary environment variables, Make sure these match what you've set up in your PostgreSQL database. | ||
``` | ||
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres?schema=public | ||
ZT_ADDR=http://localhost:9993 | ||
NEXT_PUBLIC_SITE_NAME=ZTnet | ||
NEXTAUTH_URL="http://localhost:3000" | ||
NEXTAUTH_SECRET="random_secret" | ||
``` | ||
6. Populate the PostgreSQL database with the necessary tables: | ||
```bash | ||
npx prisma migrate deploy | ||
npx prisma db seed | ||
``` | ||
7. Build Next.js production: | ||
```bash | ||
npm run build | ||
``` | ||
8. Run server: | ||
```bash | ||
cd .next/standalone | ||
node server.js | ||
``` | ||
Oops, something went wrong.