Skip to content

Manual Installation

Matt Argyle edited this page May 21, 2023 · 3 revisions

Manual mugsyOS Installation Walkthrough

This very rough in progress document outlines the basic process of setting up MongoDB, Node.js, Redis Server, and mugsyOS on a Raspberry Pi.

Please note the following:

  • This is an incomplete walk though and a lot of these commands are not meant for a production system.
  • This is meant only to be a rough starting point for documentation while I finalize things like application installation locations, build scripts and remove any non-standard or hacky bits from the process. You should consider this doc only as a rough outline that illustrates some of the primary systems required to run mugsyOS, and not as a completed guide ready to be followed.
  • This set up does not include any process management steps, so there is no automatic or service based application startup, etc.
  • mugsyOS will not live in /var.
  • Several steps are not included yet!

Steps

  1. Update the package lists for upgrades and new package installations:

    sudo apt update
    sudo apt upgrade
  2. Import the MongoDB public GPG key used by the package management system:

    wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
  3. Update the package lists again:

    sudo apt-get update
  4. Install the MongoDB packages:

    sudo apt-get install -y mongodb-org=4.4.17 mongodb-org-server=4.4.17 mongodb-org-shell=4.4.17 mongodb-org-mongos=4.4.17 mongodb-org-tools=4.4.17
  5. Verify the installed MongoDB version:

    mongod --version
  6. Reload the system manager configuration:

    sudo systemctl daemon-reload
  7. Enable MongoDB to start on boot:

    sudo systemctl enable mongod
  8. Start MongoDB:

    sudo systemctl start mongod
  9. Check MongoDB's status:

    sudo systemctl status mongod
  10. Access the MongoDB shell:

    mongo
  11. Open the MongoDB configuration file with a text editor (like nano):

    sudo nano /etc/mongod.conf

    TODO: add authorization configuration here. -m

    After editing the file, restart MongoDB:

    sudo systemctl restart mongod

    And access the MongoDB shell again:

    mongo
  12. If you have MongoDB user credentials, you can log in using:

    mongo -u "admin" -p "******************************"
  13. Deleted -m

  14. Deleted -m

  15. Deleted -m

  16. Deleted -m

  17. Install Node.js:

    curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
    sudo apt install nodejs
  18. Install Redis server:

    sudo apt install redis-server
  19. Create directories for the backend of your application:

    sudo mkdir -p /var/mugsyOS/backend/{dev,prod}
  20. Change directory to /var/mugsyOS/backend/dev:

    cd /var/mugsyOS/backend/dev/
  21. Clone your application repository:

    sudo git clone https://github.com/******/******.git
  22. Change directory into the cloned repository and inspect its contents:

    cd decaf/
    ls
  23. Review the requirements.txt file for Python dependencies:

    cat requirements.txt
  24. Check your Python and Pip versions:

    python --version
    pip --version
  25. Install Python virtual environment:

    sudo apt-get install python3-venv
  26. Create a virtual environment and activate it:

    sudo python -m venv decaf
    source decaf/bin/activate
  27. Install Python dependencies:

    pip3 install -r requirements.txt
  28. Run your application using Uvicorn:

    uvicorn main:app --reload --host mugsySolo.local
  29. If needed, grant full permissions to your application directory: DO NOT DO THIS!

    sudo chmod -R 777 decaf/
  30. Create a directory for the frontend of your application and grant full permissions: DO NOT DO THIS!

    sudo mkdir -p /var/mugsyOS/frontend/dev
    sudo chmod -R 777 /var/mugsyOS/frontend/
  31. Clone your frontend repository:

    cd /var/mugsyOS/frontend/dev/
    git clone  https://github.com/******/******.git
  32. Install the npm dependencies for the frontend application:

    cd mugsyFrontend/
    npm install
  33. Start the frontend application:

    npm start
  34. Deleted -m

  35. After rebooting, navigate back to your backend and frontend directories to restart your applications:

    cd /var/mugsyOS/backend/dev/decaf/
    uvicorn main:app --reload --host mugsySolo.local
    
    cd /var/mugsyOS/frontend/dev/mugsyFront/
    npm start
  36. Run the Redis queue worker with a scheduler:

    rq worker --with-scheduler

Note: Remember to replace "******************************" with your actual MongoDB password, and "mugsySolo.local" with your actual server host. This walkthrough assumes you have sudo permissions and all paths and repository URLs are provided as examples.

Clone this wiki locally