This is a simple web app that runs the speedtest-cli package and displays the results in a simple web page.
The iperf tagged images does not include the runner for the speedtest.
Another service that will run the speedtest and send data to this
service to display the data.
This project uses SQLite to store the results. The docker compose file will
create a volume, called <dirname>_sqlite - where <dirname> is the directory
the project is located in, for the database directory located
at /app/data.
version: "3.9"
volumes:
sqlite: null
services:
server:
image: alexdaiii/speedtest_app:iperf
volumes:
- sqlite:/app/data
ports:
- "${APP_PORT:-8000}:8000"
environment:
TZ: "America/New_York"
docker compose up -d
http://localhost:8000The app can be configured by editing the docker-compose.yml file and
changing the environment variables.
version: "3.9"
volumes:
sqlite: null
services:
server:
build:
context: .
dockerfile: Dockerfile
image: alexdaiii/speedtest_app
volumes:
- sqlite:/app/data
ports:
- "${APP_PORT:-8000}:8000"
environment:
RUN_SPEEDTEST_INTERVAL: ${RUN_SPEEDTEST_INTERVAL:-6000}
RUN_SPEEDTEST_ON_START: ${RUN_SPEEDTEST_ON_START:-true}
To add a new environment variable, add it to the environment section.
Values in ${} are variables that can be set in a .env file (values
can be hard coded as well). The value after the : is the default value
if the variable is not set.
Available environment variables (tag iperf):
| Environment variable | Default Value | Description |
|---|---|---|
| PYTHON_ENV | production | Used to set other variables automatically. Valid values are 'dev', 'production' and 'test' |
| LOG_LEVEL | 20 if production, 10 otherwise | The Python logging level |
| ENABLE_CORS | false | Whether to enable CORS |
| BACKEND_CORS_ORIGINS | '["http://localhost:3000","localhost:3000",]' | The origins to allow for CORS. Takes in a list of origins |
| SERVE_FRONTEND | True | Serve the frontend from theclient/out directory |
| DATABASE_DIR | data | The directory to store the database in |
| DB_FILE | data.db | The name of the database file |
| SQLALCHEMY_ENGINE_ECHO | True in dev, False otherwise | Whether to echo SQL queries to the console |
| SQLALCHEMY_DATABASE_URI | sqlite+aiosqlite:///data/data.db | The full URI to the database. Should not be set manually |
| DEV_INIT_DB | True in dev, False otherwise | Whether to initialize the database on startup without using alembic |
| DEV_DROP_TABLES_ON_START | True in dev, False otherwise | Whether to drop the database tables and recreate them |
| ACCESS_TOKEN_LIFETIME_SECONDS | 2592000 | The number of seconds the access token lives for. Default is 30 days |
docker run --entrypoint "manage_app <ARGS>" alexdaiii/speedtest_app:iperf
Available args are:
{create_user,update_user} - positional arguments
if create_user is input:
positional arguments:
username
password
if update_user is input:
--new-username NEW_USERNAME
--password PASSWORD
This method is not recommended, but is provided for those who want to run the app without Docker.
Install Python 3.10.
Install Node 18.
Install Yarn.
Clone this repository and change into the directory you cloned it into.
git clone https://gitlab.com/alexdaiii/speedtest_app.git
cd speedtest_app
Create a virtual environment and install the Python dependencies.
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Run the database migrations. This will create a folder called data in the
root directory of the project with a SQLite database file in it.
make migration
Change into the client directory and install the Node dependencies.
yarn install
Build the client. This will create a folder called out in the client
directory.
yarn build
Change back into the root directory of the project and run the app.
cd ..
make run
Content type
Image
Digest
sha256:57bd19064…
Size
72.3 MB
Last updated
about 4 years ago
docker pull alexdaiii/speedtest_app:1.0.beta-iperf