Skip to content

Commit

Permalink
prettier: Run prettier opinionated code formatter over entire repo
Browse files Browse the repository at this point in the history
Prettier provides opinionated code format support for a wide variety
of web-focused languages. It's nice to have a consistent
machine-checkable style, so let's use this one for now!
  • Loading branch information
matt9j committed Jul 28, 2021
1 parent 5ae7a3b commit fd17455
Show file tree
Hide file tree
Showing 65 changed files with 39,637 additions and 7,368 deletions.
56 changes: 28 additions & 28 deletions .github/workflows/codeql-analysis.yml
Expand Up @@ -13,10 +13,10 @@ name: "CodeQL"

on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]

jobs:
analyze:
Expand All @@ -30,40 +30,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'python' ]
language: ["javascript", "python"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
10 changes: 4 additions & 6 deletions .github/workflows/main.yml
Expand Up @@ -3,9 +3,9 @@ name: Validate Main
on:
# Triggers the workflow on push or pull request events for the master branch
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -24,7 +24,7 @@ jobs:
- name: Setup nodejs
uses: actions/setup-node@v2
with:
node-version: '14'
node-version: "14"

- name: Run makefile
run: |
Expand All @@ -38,7 +38,6 @@ jobs:
name: colte-package
path: BUILD/colte_*.deb


package-install:
runs-on: ubuntu-latest
needs: build
Expand All @@ -60,7 +59,6 @@ jobs:
sudo dpkg -i colte_*.deb || /bin/true
sudo apt-get install --yes -f
run-tests:
runs-on: ubuntu-latest
services:
Expand All @@ -78,7 +76,7 @@ jobs:
- name: Setup nodejs
uses: actions/setup-node@v2
with:
node-version: '14'
node-version: "14"

- name: Checkout repo
uses: actions/checkout@v2
Expand Down
17 changes: 17 additions & 0 deletions .prettierignore
@@ -0,0 +1,17 @@
**/node_modules

# Vendored css and js files
emergency/homepage/bootstrap.css
emergency/registry/polls/static/css/bootstrap.css
webadmin/public/bootstrap-4.5.3
webgui/public/stylesheets/bootstrap.min.css

# Ignore Jekyll build products Should be moved into the docs directory once
# https://github.com/prettier/prettier/issues/4081 is merged.
docs/_site
docs/.sass-cache
docs/.jekyll-cache
docs/.jekyll-metadata

# Ignore python files, that will be formatted via black
python/**/*.py
5 changes: 5 additions & 0 deletions .prettierrc.yml
@@ -0,0 +1,5 @@
trailingComma: "es5"
printWidth: 100
tabWidth: 2
semi: true
bracketSpacing: false
38 changes: 30 additions & 8 deletions README.md
@@ -1,25 +1,31 @@
# CoLTE

CoLTE is the Community LTE Project. It is designed to be an all-in-one turnkey solution that sets up a small-scale locally-run LTE network. CoLTE consists of several main elements working together:
1) An all-in-one software EPC, powered by [open5gs] (https://github.com/open5gs/open5gs).
2) Network monitoring software, powered by [haulage](https://github.com/uw-ictd/haulage), to keep track of how many bytes each user uses and bill appropriately.
3) A Web GUI that lets network users check the status of their account, top up, transfer/resell credit, and buy data packages.
4) A Web-based admin tool that lets administrators manage all the information above.
5) Local Web and DNS serving/caching via Nginx and BIND.

1. An all-in-one software EPC, powered by [open5gs] (https://github.com/open5gs/open5gs).
2. Network monitoring software, powered by [haulage](https://github.com/uw-ictd/haulage), to keep track of how many bytes each user uses and bill appropriately.
3. A Web GUI that lets network users check the status of their account, top up, transfer/resell credit, and buy data packages.
4. A Web-based admin tool that lets administrators manage all the information above.
5. Local Web and DNS serving/caching via Nginx and BIND.

# Installation

### Basic System Requirements:

We now support Ubuntu 18.04 (bionic), Ubuntu 20.04 (focal), and Debian 10
(buster). Our primary deployments are currently on bionic and buster, and we
have better test coverage for those distributions. We recommend buster for new
installs.

### Apt Packages

To ease deployment, we host apt packages on our server. You will need to add our
apt repository to get colte and haulage, and you will also need to add the
open5gs repository separately. To do this, use the following commands according
to your distribution:

#### Debian 10 (buster) (Recommended)

```shell
echo "deb [signed-by=/usr/share/keyrings/colte-archive-keyring.gpg] http://colte.cs.washington.edu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/colte.list
sudo wget -O /usr/share/keyrings/colte-archive-keyring.gpg http://colte.cs.washington.edu/colte-archive-keyring.gpg
Expand All @@ -32,6 +38,7 @@ sudo apt install colte
```

#### Ubuntu 18.04 or 20.04 (bionic or focal)

```shell
echo "deb [signed-by=/usr/share/keyrings/colte-archive-keyring.gpg] http://colte.cs.washington.edu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/colte.list
sudo wget -O /usr/share/keyrings/colte-archive-keyring.gpg http://colte.cs.washington.edu/colte-archive-keyring.gpg
Expand All @@ -46,52 +53,67 @@ After installation, the admin tool will be running and listening on [http://loca
Haulage can be started with `sudo haulage` or `sudo systemctl start haulage`, but will likely fail if not first configured for your system (see [configuration](#Configuration)). To start Open5Gs, refer to the docs [here](https://open5gs.org/open5gs/docs/).

### Working With The Source:

The top-level Makefile will compile all source and generate a `.deb` package if you type `make`. If you want to run the webgui or webadmin from source in a local terminal without doing a system-wide installation, `cd` into the corresponding directory and then do the following:

```
npm install
npm start
```

# Configuration

After installation, pointers to all the various config files can be found in `/etc/colte/`. The main config file is `config.yml`. After you edit this file, run `colteconf` to reconfigure all components and restart them as necessary. Note that you **must** run colteconf at least once after installing CoLTE, because there is no way for us to know some of the options (e.g. upstream and downstream interfaces).

## Basic Configs:

Conceptually, your machine will need two network connections: one to the Internet (the upstream WAN) and another to the eNodeB (the downstream LAN) - these can actually be the same interface, it doesn't matter.

Set `wan_iface` to your upstream (Internet) interface, and `enb_iface_addr` to the downstream interface's address/subnet. Don't worry about matching `lte_subnet` to any value in particular, because this subnet is created and assigned to the virtual `ogstun` interface used by the Open5Gs pgw.

## Adding Users

Once you’ve configured the system, you will have to add user accounts. The best way to do this is to use `coltedb`. You will have to provide the user’s IMSI, phone number (can be any value you choose), static IP address, and security values (KI and OPC).

## Configuring The Phone
Once you’ve added a user, you *may* have to configure the phone’s APN settings as well. This is easy to do: go to Settings -> Mobile Network -> Advanced -> APN Settings and add an APN. The values for name and apn should both just be “internet”, you can leave everything else alone as it is.

Once you’ve added a user, you _may_ have to configure the phone’s APN settings as well. This is easy to do: go to Settings -> Mobile Network -> Advanced -> APN Settings and add an APN. The values for name and apn should both just be “internet”, you can leave everything else alone as it is.

# Money And Accounting

## System Architecture
Setting the `metered` variable to `true` (this is on by default) turns on three services: `haulage`, `colte-webgui`, and `colte-webadmin`. [haulage](https://github.com/uw-ictd/haulage) monitors the `ogstun` interface, draws user accounts down from a quota, and turns them off when they hit zero. Users can interact with their account (transfer money, buy data packages, etc) via the webgui - accessible by default at `http://(your IP address):7999`. Similarly, we provide a separate web-based tool for network administrators to change account balances, enable or disable specific users, topup accounts, and transfer money from one user to another. It is accessible *only* from the EPC, at `http://(your IP address):7998`. The username is `admin` and the default password is `password`.

Setting the `metered` variable to `true` (this is on by default) turns on three services: `haulage`, `colte-webgui`, and `colte-webadmin`. [haulage](https://github.com/uw-ictd/haulage) monitors the `ogstun` interface, draws user accounts down from a quota, and turns them off when they hit zero. Users can interact with their account (transfer money, buy data packages, etc) via the webgui - accessible by default at `http://(your IP address):7999`. Similarly, we provide a separate web-based tool for network administrators to change account balances, enable or disable specific users, topup accounts, and transfer money from one user to another. It is accessible _only_ from the EPC, at `http://(your IP address):7998`. The username is `admin` and the default password is `password`.

## Administration

To add money to a user’s account, use `coltedb topup` or the webadmin tool. By default, users start out with a zero money balance and 10MB of data-balance. To configure the data packages users can buy, as well as their price-points, edit `/etc/colte/pricing.json`.

## WebAdmin and WebGUI

Both of these services are started automatically after installation. They have detailed configurations in `/etc/colte/{webgui.env|webadmin.env}`; for more details, consult `/{webadmin|webgui}/README`. You will have to restart these services after you change any of these variables, and you can do so with:

```
sudo systemctl {start|stop} {colte-webadmin|colte-webgui}
```

# Log Files

`/var/log/colte`.

# Known Issues

- Right now, the webservices are only hosted as high-number ports. In the interest of not dominating your system we do not currently integrate with any apps that serve DNS or HTTP (e.g. `bind` or `nginx`); we plan to eventually support this. In the meantime, you are responsible for either (a) changing the app to listen on 80 or (b) plumbing a port-forwarding solution using `nginx` or something similar.
- **open5gs-pgwd conflicts with systemd-networkd:** The open5gs package has a known issue wherein open5gs-pgwd conflicts with systemd-networkd. This is already fixed in source, and will be fixed in the packages as soon as Sukchan drafts a new release of open5gs. Until then, you will see an error after running colteconf, but the following commands will fix it:

```
sudo systemctl stop open5gs-pgwd
sudo systemctl restart systemd-networkd
sudo systemctl start open5gs-pgwd
```

- **systemd-networkd sometimes does not bring up the tun IP address:**
I have seen this issue occasionally, but have not been able to reproduce it consistently. I am not entirely sure what causes it, but have found some other discussion about a similar issue. The issue is claimed to have been fixed in systemd-241, but Ubuntu 18.04 ships with version 237. This issue pops up occasionally, but usually right after you change the `lte_subnet` variable and run `colteconf`. Sometimes, but not always, starting (or restarting) `open5gs-pgwd` and/or `systemd-networkd` will fix this issue. If not, a system reboot usually does the trick.
I have seen this issue occasionally, but have not been able to reproduce it consistently. I am not entirely sure what causes it, but have found some other discussion about a similar issue. The issue is claimed to have been fixed in systemd-241, but Ubuntu 18.04 ships with version 237. This issue pops up occasionally, but usually right after you change the `lte_subnet` variable and run `colteconf`. Sometimes, but not always, starting (or restarting) `open5gs-pgwd` and/or `systemd-networkd` will fix this issue. If not, a system reboot usually does the trick.

# What about OAI?

Expand Down

0 comments on commit fd17455

Please sign in to comment.