Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

LinuxStore install & update instructions

Jorge edited this page Jan 11, 2018 · 4 revisions

LinuxStore install instructions

Introduction

LinuxStore has 4 components:

  • linux-store-frontend:

    • web frontend developed in Angular 4. In summary is a bunch of html+javascript files served by nginx
    • Deployed as a NGINX docker container
  • linux-store-backend:

    • backend server providing a simple REST api for the frontend (list of apps and info about them)
    • Developed in Java using the Spring Boot framework
    • Deployed as a docker container
  • PotsgreSQL database:

    • Stores the information about apps, repos, ...
    • Deployed also as a docker container
  • appstream-extractor:

    • Simple script that regulary downloads flathub's appstream data and extracts it to a local folder
    • The script is executed regulary with a cron task
    • linux-store-backend reads the extracted data regulary (some minutes after the cron task) and adds the information to the database

LinuxStore installation

Requirements:

  • Ubuntu Linux 16.04 or any other distro with docker support
  • Minimum requirements: 1GB RAM + 2 GB swap

Install steps for Ubuntu 16.04:

  1. Install docker-ce and docker-compose following this links:
  1. Install flatpak and other requirements

    add-apt-repository ppa:alexlarsson/flatpak
    apt update
    apt install flatpak ostree tar unzip
    
  2. Add Flathub repo

    flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
    flatpak remote-ls flathub
    
  3. Install appstream-extractor

    cd /usr/local/bin
    wget https://raw.githubusercontent.com/jgarciao/linux-store-backend/master/appstream-extractor/appstream-extractor.sh
    chmod u+x appstream-extractor.sh
    
    ./appstream-extractor.sh 
    This script requires to create this folder /var/lib/appstream-extractor
    Do you want to continue?
    1) Yes
    2) No
    #? 1
    
  4. Run the extractor every 2 hours adding a task at root's cron:

    # Edit root's crontab
    crontab -e
    
    # Add this line to execute the script every 5 mins
    */5 * * * * /usr/local/bin/appstream-extractor.sh
    
  5. Create some folders required by linux-store-frontend

    mkdir -p /var/www/main-store/apps
    mkdir -p /var/www/main-store/icons
    
  6. Download database stub

    Before running the PostgreSQL database we are going to download the database files with all the tables already created.

    # Download postgresql-docker.tar.gz and uncompress it to /var/lib/postgresql-docker
    
    # Inside the folder postgresql-docker you should find the "data" folder 
    ls /var/lib/postgresql-docker
    
    data
    
  7. Download LinuxStore docker-compose and password files

    # Create conf folder and download example files
    mkdir -p /opt/linux-store
    cd /opt/linux-store
    wget https://raw.githubusercontent.com/jgarciao/linux-store-backend/master/conf/docker-compose.yml
    wget https://raw.githubusercontent.com/jgarciao/linux-store-backend/master/conf/linux-store-backend-passwords.yml
    
    # IMPORTANT: edit the files and set the correct password for the database
    vi docker-compose.yml
    vi linux-store-backend-passwords.yml
    
  8. Run the application!

    # Download docker images
    cd /opt/linux-store
    docker-compose pull
    
    # Start the webapp starting all the required containers
    docker-compose up -d
    
    # After few seconds everything should be working
    docker ps
    
    CONTAINER ID        IMAGE                           COMMAND                  CREATED             STATUS              PORTS                     NAMES
    8a577f2ed39c        jgarciao/linux-store-frontend   "nginx -g 'daemon ..."   3 days ago          Up 3 days           0.0.0.0:80->80/tcp        linuxstoreproduction_frontend_1
    56ce353bd47a        jgarciao/linux-store-backend    "sh -c 'java $JAVA..."   3 days ago          Up 3 days           0.0.0.0:32771->8080/tcp   linuxstoreproduction_backend2_1
    6fb2d32561eb        jgarciao/linux-store-backend    "sh -c 'java $JAVA..."   3 days ago          Up 3 days           0.0.0.0:32770->8080/tcp   linuxstoreproduction_backend1_1
    10a36de0dd32        postgres:9.6-alpine             "docker-entrypoint..."   3 days ago          Up 3 days           0.0.0.0:5432->5432/tcp    linuxstoreproduction_postgresdb_1
    
    

    Tests links:

  9. Update the application to a newer version

    To update LinuxStore we pull the newer docker images from Docker Hub and restart everything:

    cd /opt/linux-store
    docker-compose pull
    docker-compose down --remove-orphans
    docker-compose up -d
    
  10. Make docker-compose run automatically at server startup

    crontab -e
    
    # Launch containers after reboot
    @reboot (sleep 30s ; cd /opt/linux-store/ ; /usr/local/bin/docker-compose up -d )&
    
Clone this wiki locally