Browse Source

chore: update cli name from sos to simply os

ntorga 1 year ago
parent
commit
aeabca9730

+ 2 - 2
.air.toml

@@ -3,8 +3,8 @@ root = "."
 tmp_dir = "tmp"
 
 [build]
-bin = "bin/sos"
-cmd = "CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./bin/sos ./sos.go"
+bin = "bin/os"
+cmd = "CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./bin/os ./os.go"
 delay = 1000
 exclude_dir = [".git", "bin", "logs", "tmp", "vendor", "src/devUtils"]
 follow_symlink = false

+ 3 - 3
Containerfile

@@ -26,10 +26,10 @@ COPY --chown=nobody:nogroup /container/nginx/user/ /app/conf/nginx/
 
 COPY /container/supervisord.conf /speedia/supervisord.conf
 
-COPY /bin/sos /speedia/sos
+COPY /bin/os /speedia/os
 
-RUN chmod +x /speedia/sos \
-    && ln -s /speedia/sos /usr/bin/sos
+RUN chmod +x /speedia/os \
+    && ln -s /speedia/os /usr/bin/os
 
 EXPOSE 22/tcp 80/tcp 443/tcp 3306/tcp 5432/tcp 6379/tcp 1618/tcp
 

+ 1 - 1
Containerfile.test

@@ -29,6 +29,6 @@ COPY --chown=nobody:nogroup /container/nginx/user/ /app/conf/nginx/
 COPY /container/supervisord.conf /speedia/supervisord.conf
 
 RUN go mod download \
-    && go build -o sos
+    && go build -o os
 
 ENTRYPOINT ["go", "test", "-v", "./..."]

+ 1 - 1
README.md

@@ -33,7 +33,7 @@ If you add a new env var that is required to run the apis, please add it to the
 When running in production, the `/speedia/.env` file is only used if the environment variables weren't set in the system. For instance, if you want to set the `ENV1` variable, you can do it in the `.env` file or in the command line:
 
 ```
-ENV1=XXX /speedia/sos
+ENV1=XXX /speedia/os
 ```
 
 ### Unit Testing

+ 2 - 2
container/supervisord.conf

@@ -10,8 +10,8 @@ logfile_maxbytes=10MB
 loglevel=WARN
 pidfile=/tmp/supervisord.pid
 
-[program:sos-api]
-command=/speedia/sos serve
+[program:os-api]
+command=/speedia/os serve
 user=root
 directory=/speedia
 autostart=true

+ 0 - 0
sos.go → os.go


+ 1 - 1
src/infra/infraData/globalConfigs.go

@@ -17,5 +17,5 @@ var GlobalConfigs = globalConfigs{
 	VirtualHostsConfDir:              "/app/conf/nginx",
 	MappingsConfDir:                  "/app/conf/nginx/mapping",
 	PublicIpTransientKey:             "PublicIp",
-	DatabaseFilePath:                 "/speedia/sos.db",
+	DatabaseFilePath:                 "/speedia/os.db",
 }

+ 33 - 33
src/infra/marketplace/assets/drupal.json

@@ -1,34 +1,34 @@
 {
-    "name": "Drupal",
-    "type": "app",
-    "description": "Drupal is an open source platform for building amazing digital experiences. It's made by a dedicated community. Anyone can use it, and it will always be free.",
-    "serviceNames": ["php", "mysql"],
-    "mappings": [
-        {
-            "path": "/",
-            "matchPattern": "begins-with",
-            "targetType": "service",
-            "targetValue": "php"
-        }
-    ],
-    "cmdSteps": [
-        "curl -skL -o /app/composer-setup.php https://getcomposer.org/installer",
-        "php /app/composer-setup.php --install-dir=/usr/local/bin --filename=composer",
-        "rm -rf /app/composer-setup.php",
-        "sos runtime php update-module -n sqlite3 -v 8.2 -H %installHostname% && sos runtime php update-module -n pdo_sqlite -v 8.2 -H %installHostname%",
-        "COMPOSER_ALLOW_SUPERUSER=1 composer create-project drupal/recommended-project /app/drupal -q -n --no-dev",
-        "mkdir -p %installDirectory% && ln -s /app/drupal/web %installDirectory%",
-        "sos db create -n drupalDb_%installUuid% -t mysql",
-        "echo $(openssl rand -hex 8) > /app/drupal/drupalDbCredentials",
-        "sos db create-user -n drupalDb_%installUuid% -t mysql -u drupalUser_%installUuid% -p $(cat /app/drupal/drupalDbCredentials) -r all",
-        "rm -rf /app/drupal/drupalDbCredentials"
-    ],
-    "estimatedSizeBytes": 450000000,
-    "avatarUrl": "https://speedia.net/assets/os/marketplace/drupal/drupal-avatar.jpg",
-    "screenshotUrls": [
-        "https://speedia.net/assets/os/marketplace/drupal/drupal-1.jpg",
-        "https://speedia.net/assets/os/marketplace/drupal/drupal-2.jpg",
-        "https://speedia.net/assets/os/marketplace/drupal/drupal-3.jpg",
-        "https://speedia.net/assets/os/marketplace/drupal/drupal-4.jpg"
-    ]
-}
+  "name": "Drupal",
+  "type": "app",
+  "description": "Drupal is an open source platform for building amazing digital experiences. It's made by a dedicated community. Anyone can use it, and it will always be free.",
+  "serviceNames": ["php", "mysql"],
+  "mappings": [
+    {
+      "path": "/",
+      "matchPattern": "begins-with",
+      "targetType": "service",
+      "targetValue": "php"
+    }
+  ],
+  "cmdSteps": [
+    "curl -skL -o /app/composer-setup.php https://getcomposer.org/installer",
+    "php /app/composer-setup.php --install-dir=/usr/local/bin --filename=composer",
+    "rm -rf /app/composer-setup.php",
+    "os runtime php update-module -n sqlite3 -v 8.2 -H %installHostname% && os runtime php update-module -n pdo_sqlite -v 8.2 -H %installHostname%",
+    "COMPOSER_ALLOW_SUPERUSER=1 composer create-project drupal/recommended-project /app/drupal -q -n --no-dev",
+    "mkdir -p %installDirectory% && ln -s /app/drupal/web %installDirectory%",
+    "os db create -n drupalDb_%installUuid% -t mysql",
+    "echo $(openssl rand -hex 8) > /app/drupal/drupalDbCredentials",
+    "os db create-user -n drupalDb_%installUuid% -t mysql -u drupalUser_%installUuid% -p $(cat /app/drupal/drupalDbCredentials) -r all",
+    "rm -rf /app/drupal/drupalDbCredentials"
+  ],
+  "estimatedSizeBytes": 450000000,
+  "avatarUrl": "https://speedia.net/assets/os/marketplace/drupal/drupal-avatar.jpg",
+  "screenshotUrls": [
+    "https://speedia.net/assets/os/marketplace/drupal/drupal-1.jpg",
+    "https://speedia.net/assets/os/marketplace/drupal/drupal-2.jpg",
+    "https://speedia.net/assets/os/marketplace/drupal/drupal-3.jpg",
+    "https://speedia.net/assets/os/marketplace/drupal/drupal-4.jpg"
+  ]
+}

+ 38 - 38
src/infra/marketplace/assets/joomla.json

@@ -1,39 +1,39 @@
 {
-    "name": "Joomla",
-    "type": "app",
-    "description": "Joomla! is a free and open-source content management system (CMS) for publishing web content. It is built on a model-view-controller web application framework that can be used independently of the CMS that allows you to build powerful online applications.",
-    "serviceNames": ["php", "mysql"],
-    "mappings": [
-        {
-            "path": "/",
-            "matchPattern": "begins-with",
-            "targetType": "service",
-            "targetValue": "php"
-        }
-    ],
-    "dataFields": [
-        {
-            "name": "adminMailAddress",
-            "label": "Admin Email",
-            "type": "email",
-            "isRequired": true
-        }
-    ],
-    "cmdSteps": [
-        "curl -skL -o /app/joomla.zip https://speedia.net/assets/os/marketplace/joomla/joomla.zip",
-        "mkdir /app/joomla && unzip /app/joomla.zip -d /app/joomla && rm -rf /app/joomla.zip",
-        "sos db create -n joomlaDb_%installUuid% -t mysql",
-        "echo $(openssl rand -hex 8) > %installDirectory%/joomlaDbCredentials",
-        "sos db create-user -n joomlaDb_%installUuid% -t mysql -u joomlaUser_%installUuid% -p $(cat %installDirectory%/joomlaDbCredentials) -r all",
-        "sos runtime php update -v 82 -H %installHostname%",
-        "php /app/joomla/installation/joomla.php install --site-name=baseWebsite --admin-user=joomlaUser_%installUuid% --admin-username=joomlaUser_%installUuid% --admin-password=$(cat %installDirectory%/joomlaDbCredentials) --admin-email=%adminMailAddress% --db-type=mysqli --db-host=localhost --db-user=joomlaUser_%installUuid% --db-pass=$(cat %installDirectory%/joomlaDbCredentials) --db-name=joomlaDb_%installUuid% --db-prefix=joomla_ --db-encryption=0 --public-folder=%installDirectory%",
-        "rm -rf %installDirectory%/joomlaDbCredentials && rm -rf %installDirectory% && ln -s /app/joomla %installDirectory%"
-    ],
-    "estimatedSizeBytes": 450000000,
-    "avatarUrl": "https://speedia.net/assets/os/marketplace/joomla/joomla-avatar.jpg",
-    "screenshotUrls": [
-        "https://speedia.net/assets/os/marketplace/joomla/joomla-1.jpg",
-        "https://speedia.net/assets/os/marketplace/joomla/joomla-2.jpg",
-        "https://speedia.net/assets/os/marketplace/joomla/joomla-3.jpg"
-    ]
-}
+  "name": "Joomla",
+  "type": "app",
+  "description": "Joomla! is a free and open-source content management system (CMS) for publishing web content. It is built on a model-view-controller web application framework that can be used independently of the CMS that allows you to build powerful online applications.",
+  "serviceNames": ["php", "mysql"],
+  "mappings": [
+    {
+      "path": "/",
+      "matchPattern": "begins-with",
+      "targetType": "service",
+      "targetValue": "php"
+    }
+  ],
+  "dataFields": [
+    {
+      "name": "adminMailAddress",
+      "label": "Admin Email",
+      "type": "email",
+      "isRequired": true
+    }
+  ],
+  "cmdSteps": [
+    "curl -skL -o /app/joomla.zip https://speedia.net/assets/os/marketplace/joomla/joomla.zip",
+    "mkdir /app/joomla && unzip /app/joomla.zip -d /app/joomla && rm -rf /app/joomla.zip",
+    "os db create -n joomlaDb_%installUuid% -t mysql",
+    "echo $(openssl rand -hex 8) > %installDirectory%/joomlaDbCredentials",
+    "os db create-user -n joomlaDb_%installUuid% -t mysql -u joomlaUser_%installUuid% -p $(cat %installDirectory%/joomlaDbCredentials) -r all",
+    "os runtime php update -v 82 -H %installHostname%",
+    "php /app/joomla/installation/joomla.php install --site-name=baseWebsite --admin-user=joomlaUser_%installUuid% --admin-username=joomlaUser_%installUuid% --admin-password=$(cat %installDirectory%/joomlaDbCredentials) --admin-email=%adminMailAddress% --db-type=mysqli --db-host=localhost --db-user=joomlaUser_%installUuid% --db-pass=$(cat %installDirectory%/joomlaDbCredentials) --db-name=joomlaDb_%installUuid% --db-prefix=joomla_ --db-encryption=0 --public-folder=%installDirectory%",
+    "rm -rf %installDirectory%/joomlaDbCredentials && rm -rf %installDirectory% && ln -s /app/joomla %installDirectory%"
+  ],
+  "estimatedSizeBytes": 450000000,
+  "avatarUrl": "https://speedia.net/assets/os/marketplace/joomla/joomla-avatar.jpg",
+  "screenshotUrls": [
+    "https://speedia.net/assets/os/marketplace/joomla/joomla-1.jpg",
+    "https://speedia.net/assets/os/marketplace/joomla/joomla-2.jpg",
+    "https://speedia.net/assets/os/marketplace/joomla/joomla-3.jpg"
+  ]
+}

+ 3 - 3
src/infra/marketplace/assets/opencart.yml

@@ -28,10 +28,10 @@ cmdSteps:
   - mkdir -p %installDirectory% && mv /app/opencart-*/upload/* %installDirectory% && rm -rf /app/opencart*
   - mv %installDirectory%/config-dist.php %installDirectory%/config.php
   - mv %installDirectory%/admin/config-dist.php %installDirectory%/admin/config.php
-  - sos runtime php update -v 82 -H %installHostname%
-  - sos db create -n ocDb_%installUuid% -t mysql
+  - os runtime php update -v 82 -H %installHostname%
+  - os db create -n ocDb_%installUuid% -t mysql
   - echo $(openssl rand -hex 8) > %installDirectory%/ocDbCredentials
-  - sos db create-user -n ocDb_%installUuid% -t mysql -u adminUsername_%installUuid% -p $(cat %installDirectory%/ocDbCredentials) -r all
+  - os db create-user -n ocDb_%installUuid% -t mysql -u adminUsername_%installUuid% -p $(cat %installDirectory%/ocDbCredentials) -r all
   - php %installDirectory%/install/cli_install.php install --username %adminUsername% --password %adminPassword% --email %adminMailAddress% --http_server https://%installHostname%%installUrlPath% --db_driver mysqli --db_hostname localhost --db_username adminUsername_%installUuid% --db_password $(cat %installDirectory%/ocDbCredentials) --db_database ocDb_%installUuid% --db_port 3306 --db_prefix oc_
   - rm -rf %installDirectory%/ocDbCredentials
 estimatedSizeBytes: 1000000000

+ 61 - 69
src/infra/marketplace/assets/wordpress.json

@@ -1,70 +1,62 @@
 {
-    "name": "WordPress",
-    "type": "app",
-    "description": "Build and grow your website with the best way to WordPress. Lightning-fast hosting, intuitive, flexible editing, and everything you need to grow your site and audience, baked right in.",
-    "serviceNames": ["php", "mysql"],
-    "mappings": [
-        {
-            "path": "/",
-            "matchPattern": "begins-with",
-            "targetType": "service",
-            "targetValue": "php"
-        }
-    ],
-    "dataFields": [
-        {
-            "name": "locale",
-            "label": "WordPress Language",
-            "type": "text",
-            "defaultValue": "en_US",
-            "options": [
-                "en_US",
-                "pt_BR",
-                "pt_PT",
-                "es_ES",
-                "de_DE",
-                "it_IT",
-                "fr_FR"
-            ]
-        },
-        {
-            "name": "adminUsername",
-            "label": "Admin Username",
-            "type": "text",
-            "isRequired": true
-        },
-        {
-            "name": "adminPassword",
-            "label": "Admin Password",
-            "type": "password",
-            "isRequired": true
-        },
-        {
-            "name": "adminMailAddress",
-            "label": "Admin Email",
-            "type": "email",
-            "isRequired": true
-        }
-    ],
-    "cmdSteps": [
-        "curl -skL -o /app/wp-cli.phar https://speedia.net/assets/os/marketplace/wordpress/wp-cli.phar",
-        "chmod +x /app/wp-cli.phar",
-        "mv /app/wp-cli.phar /usr/local/bin/wp",
-        "wp core download --path=%installDirectory% --locale=%locale% --allow-root",
-        "sos db create -n wpDb_%installUuid% -t mysql",
-        "echo $(openssl rand -hex 8) > %installDirectory%/wpDbCredentials",
-        "sos db create-user -n wpDb_%installUuid% -t mysql -u wpUser_%installUuid% -p $(cat %installDirectory%/wpDbCredentials) -r all",
-        "wp config create --path=%installDirectory% --dbname=wpDb_%installUuid% --dbuser=wpUser_%installUuid% --dbpass=$(cat %installDirectory%/wpDbCredentials) --allow-root",
-        "rm -rf %installDirectory%/wpDbCredentials",
-        "wp core install --path=%installDirectory% --locale=%locale% --url=%installHostname% --title=%adminTitle% --admin_user=%adminUsername% --admin_password=%adminPassword% --admin_email=%adminMailAddress% --allow-root"
-    ],
-    "estimatedSizeBytes": 1000000000,
-    "avatarUrl": "https://speedia.net/assets/os/marketplace/wordpress/wp-avatar.jpg",
-    "screenshotUrls": [
-        "https://speedia.net/assets/os/marketplace/wordpress/wp-dashboard.jpg",
-        "https://speedia.net/assets/os/marketplace/wordpress/wp-themes.jpg",
-        "https://speedia.net/assets/os/marketplace/wordpress/wp-front-1.jpg",
-        "https://speedia.net/assets/os/marketplace/wordpress/wp-front-2.jpg",
-        "https://speedia.net/assets/os/marketplace/wordpress/wp-front-3.jpg"
-    ]
-}
+  "name": "WordPress",
+  "type": "app",
+  "description": "Build and grow your website with the best way to WordPress. Lightning-fast hosting, intuitive, flexible editing, and everything you need to grow your site and audience, baked right in.",
+  "serviceNames": ["php", "mysql"],
+  "mappings": [
+    {
+      "path": "/",
+      "matchPattern": "begins-with",
+      "targetType": "service",
+      "targetValue": "php"
+    }
+  ],
+  "dataFields": [
+    {
+      "name": "locale",
+      "label": "WordPress Language",
+      "type": "text",
+      "defaultValue": "en_US",
+      "options": ["en_US", "pt_BR", "pt_PT", "es_ES", "de_DE", "it_IT", "fr_FR"]
+    },
+    {
+      "name": "adminUsername",
+      "label": "Admin Username",
+      "type": "text",
+      "isRequired": true
+    },
+    {
+      "name": "adminPassword",
+      "label": "Admin Password",
+      "type": "password",
+      "isRequired": true
+    },
+    {
+      "name": "adminMailAddress",
+      "label": "Admin Email",
+      "type": "email",
+      "isRequired": true
+    }
+  ],
+  "cmdSteps": [
+    "curl -skL -o /app/wp-cli.phar https://speedia.net/assets/os/marketplace/wordpress/wp-cli.phar",
+    "chmod +x /app/wp-cli.phar",
+    "mv /app/wp-cli.phar /usr/local/bin/wp",
+    "wp core download --path=%installDirectory% --locale=%locale% --allow-root",
+    "os db create -n wpDb_%installUuid% -t mysql",
+    "echo $(openssl rand -hex 8) > %installDirectory%/wpDbCredentials",
+    "os db create-user -n wpDb_%installUuid% -t mysql -u wpUser_%installUuid% -p $(cat %installDirectory%/wpDbCredentials) -r all",
+    "wp config create --path=%installDirectory% --dbname=wpDb_%installUuid% --dbuser=wpUser_%installUuid% --dbpass=$(cat %installDirectory%/wpDbCredentials) --allow-root",
+    "rm -rf %installDirectory%/wpDbCredentials",
+    "wp core install --path=%installDirectory% --locale=%locale% --url=%installHostname% --title=%adminTitle% --admin_user=%adminUsername% --admin_password=%adminPassword% --admin_email=%adminMailAddress% --allow-root"
+  ],
+  "estimatedSizeBytes": 1000000000,
+  "avatarUrl": "https://speedia.net/assets/os/marketplace/wordpress/wp-avatar.jpg",
+  "screenshotUrls": [
+    "https://speedia.net/assets/os/marketplace/wordpress/wp-dashboard.jpg",
+    "https://speedia.net/assets/os/marketplace/wordpress/wp-themes.jpg",
+    "https://speedia.net/assets/os/marketplace/wordpress/wp-front-1.jpg",
+    "https://speedia.net/assets/os/marketplace/wordpress/wp-front-2.jpg",
+    "https://speedia.net/assets/os/marketplace/wordpress/wp-front-3.jpg"
+  ]
+}

+ 2 - 2
src/presentation/cli/router.go

@@ -26,7 +26,7 @@ func NewRouter(
 
 var versionCmd = &cobra.Command{
 	Use:   "version",
-	Short: "Print software version",
+	Short: "ShowSoftwareVersion",
 	Run: func(cmd *cobra.Command, args []string) {
 		fmt.Println("Speedia OS v0.0.1")
 	},
@@ -119,7 +119,7 @@ func (router Router) runtimeRoutes() {
 func (router Router) serveRoutes() {
 	var serveCmd = &cobra.Command{
 		Use:   "serve",
-		Short: "Start the SOS server (default to port 1618)",
+		Short: "Start Speedia OS HTTPS server (port 1618)",
 		Run: func(cmd *cobra.Command, args []string) {
 			api.ApiInit(router.transientDbSvc, router.persistentDbSvc)
 		},