Skip to content

Commander - Solution Manager

Commander is a solution management tool that performs system based tasks.

Repository: https://gitlab.group.team.blue/hostedshop/platform/commander

URL: http://commander1.shopfactory.io/graphql-playground (for browsing the schema you need to Auth. See "How to Auth")

Features:

  • See information about the storefront e.g. IsInMaintenance, IsDatabaseClosed.
  • Move tenant data to another shard.
  • Set a tenant into maintenance mode.
  • Revoke access for a tenant database user.
  • Copy functions: Copy Orders, Copy Users, Copy Solution, Copy Files, Copy SolutionData etc.

How to Auth

We authenticate via the Authorization header. See picture below for the format.

See https://netadmin.zitcom.dk/passwords/13767 for the token.

Access and deployment

This setup runs entirely in containers organized with docker-compose. No services have been integrated with the commander API, so it can be changed as much as possible.

ssh [user]@commander1.shopfactory.io

# Switch to commander user
su - commander

# browse to the project
cd /app/commander

# Pull the latest build and recreate containers
docker-compose pull app
docker-compose up -d app worker

# Browse docker-compose.yaml
cat docker-compose.yml

Move a tenant database to a new MySQL

NOTE: Before running any of the mutations. Please have a look at the logic behind https://gitlab.group.team.blue/hostedshop/platform/commander.

When moving a tenant database the whole schema is moved and application specific data is updated with the new connection information. This is all done 100% automatic via the commander API.

API: http://commander1.shopfactory.io/graphql-playground authentication is done via the Authorization header https://netadmin.zitcom.dk/passwords/13767

Queues a job.

mutation moveDatabase{
    moveDatabase(
        tenantId: "[tenant-id]", 
        targetMysqlId: "shopfactory-mysql-id"
    )
}

Follow the job

query audit{
    audit(tenant: "[tenant-id]"){
        data{
            tenant
            component
            message
            created_at
            user {
                name
                email
            }
        }
    }
}

The mutation will queue a job that does every step required to copy a database i.e. Closes the old DB (Leaves the data un-touched), dumps the database, imports the database and corrects the application to point to the new database.