One place for hosting & domains

      OneClick

      How to Deploy MongoDB with One-Click Apps


      Updated by Linode

      Contributed by
      Linode

      MongoDB One-Click App

      MongoDB is a database engine that provides access to non-relational, document-oriented databases. It is part of the growing NoSQL movement, along with databases like Redis and Cassandra (although there are vast differences among the many non-relational databases).

      MongoDB seeks to provide an alternative to traditional relational database management systems (RDBMS). In addition to its schema-free design and scalable architecture, MongoDB provides a JSON output and specialized, language-specific bindings that make it particularly attractive for use in custom application development and rapid prototyping. MongoDB has been used in a number of large scale production deployments and is currently one of the most popular database engines across all systems.

      Deploy a MongoDB One-Click App

      One-Click Apps allow you to easily deploy software on a Linode using the Linode Cloud Manager. To access Linode’s One-Click Apps:

      1. Log in to your Linode Cloud Manager account.

      2. From the Linode dashboard, click on the Create button in the top right-hand side of the screen and select Linode from the dropdown menu.

      3. The Linode creation page will appear. Select the One-Click tab.

      4. Under the Select App section, select the app you would like to deploy:

        Select a One-Click App to deploy

      5. Once you have selected the app, proceed to the app’s Options section and provide values for the required fields.

      The MongoDB Options section of this guide provides details on all available configuration options for this app.

      MongoDB Options

      You can configure your Drupal App by providing values for the following fields:

      FieldDescription
      Mongo passwordPassword for your MongoDB admin account. Required.

      Linode Options

      After providing the app specific options, provide configurations for your Linode server:

      ConfigurationDescription
      Select an ImageDebian 9 is currently the only image supported by MongoDB One-Click Apps, and it is pre-selected on the Linode creation page. Required.
      RegionThe region where you would like your Linode to reside. In general, it’s best to choose a location that’s closest to you. For more information on choosing a DC, review the How to Choose a Data Center guide. You can also generate MTR reports for a deeper look at the network routes between you and each of our data centers. Required.
      Linode PlanYour Linode’s hardware resources. Since MongoDB can require a significant amount of RAM, we recommend using a high memory Linode. You can always resize your Linode to a different plan later if you feel you don’t need you need these resources are needed. Required.
      Linode LabelThe name for your Linode, which must be unique between all of the Linodes on your account. This name will be how you identify your server in the Cloud Manager’s Dashboard. Required.
      Root PasswordThe primary administrative password for your Linode instance. This password must be provided when you log in to your Linode via SSH. It must be at least 6 characters long and contain characters from two of the following categories: lowercase and uppercase case letters, numbers, and punctuation characters. Your root password can be used to perform any action on your server, so make it long, complex, and unique. Required.

      When you’ve provided all required Linode Options, click on the Create button. Your MongoDB app will complete installation anywhere between 2-5 minutes after your Linode has finished provisioning.

      Getting Started after Deployment

      Access MongoDB

      After MongoDB has finished installing, you will be able to access MongoDB from the console via ssh with your Linode’s IPv4 address:

      1. SSH into your Linode and create a limited user account.

      2. Log out and log back in as your limited user account.

      3. Update your server:

        sudo apt-get update && apt-get upgrade
        
      4. Access MongoDB with the admin account password you set when launching the One-Click App:

        mongo -u admin -p --authenticationDatabase admin
        

        The -u, -p, and --authenticationDatabase options in the above command are required in order to authenticate connections to the shell. Without authentication, the MongoDB shell can be accessed but will not allow connections to databases.

        The admin user is purely administrative based on the roles specified. It is defined as an administrator of users for all databases, but does not have any database permissions itself. You may use it to create additional users and define their roles. If you are using multiple applications with MongoDB, set up different users with custom permissions for their corresponding databases.

      5. As the admin user, create a new database to store regular user data for authentication. The following example calls this database user-data:

        use user-data
        
      6. Permissions for different databases are handled in separate roles objects. This example creates the user, example-user, with read-only permissions for the user-data database and has read and write permissions for the exampleDB database that we’ll create in the Manage Data and Collections section below.

        Create a new, non-administrative user to enter test data. Change both example-user and password to something relevant and secure:

        db.createUser({user: "example-user", pwd: "password", roles:[{role: "read", db: "user-data"}, {role:"readWrite", db: "exampleDB"}]})
        

        To create additional users, repeat this step as the administrative user, creating new usernames, passwords and roles by substituting the appropriate values.

      7. Exit the mongo shell:

        quit()
        

      For more information on access control and user management, as well as other tips on securing your databases, refer to the MongoDB Security Documentation.

      Manage Data and Collections

      Much of MongoDB’s popularity comes from its ease of integration. Interactions with databases are done via JavaScript methods, but drivers for other languages are available. This section will demonstrate a few basic features, but we encourage you to do further research based on your specific use case.

      1. Open the MongoDB shell using the example-user we created above:

        mongo -u example-user -p --authenticationDatabase user-data
        
      2. Create a new database. This example calls it exampleDB:

        use exampleDB
        

        Make sure that this database name corresponds with the one for which the user has read and write permissions (we added these permissions in the previous section).

        To show the name of the current working database, run the db command.

      3. Create a new collection called exampleCollection:

        db.createCollection("exampleCollection", {capped: false})
        

        If you’re not familiar with MongoDB terminology, you can think of a collection as analogous to a table in a relational database management system. For more information on creating new collections, see the MongoDB documentation on the db.createCollection() method.

        Note

        Collection names should not include certain punctuation such as hyphens. However, exceptions may not be raised until you attempt to use or modify the collection. For more information, refer to MongoDB’s naming restrictions.
      4. Create sample data for entry into the test database. MongoDB accepts input as documents in the form of JSON objects such as those below. The a and b variables are used to simplify entry; objects can be inserted directly via functions as well.

        var a = { name : "John Doe",  attributes: { age : 30, address : "123 Main St", phone : 8675309 }}
        var b = { name : "Jane Doe",  attributes: { age : 29, address : "321 Main Rd", favorites : { food : "Spaghetti", animal : "Dog" } }}
        

        Note that documents inserted into a collection need not have the same schema, which is one of many benefits of using a NoSQL database.

      5. Insert the data into exampleCollection, using the insert method:

        db.exampleCollection.insert(a)
        db.exampleCollection.insert(b)
        

        The output for each of these operations will show the number of objects successfully written to the current working database:

          
        WriteResult({ "nInserted" : 1 })
        
        
      6. Confirm that the exampleCollection collection was properly created:

        show collections
        

        The output will list all collections containing data within the current working database:

          
        exampleCollection
        
        
      7. View unfiltered data in the exampleCollection collection using the find method. This returns up to the first 20 documents in a collection, if a query is not passed:

        db.exampleCollection.find()
        

        The output will resemble the following:

          
        { "_id" : ObjectId("5e68d4618bd4ea23cc3f5e96"), "name" : "John Doe", "attributes" : { "age" : 30, "address" : "123 Main St", "phone" : 8675309 } }
        { "_id" : ObjectId("5e68d4628bd4ea23cc3f5e97"), "name" : "Jane Doe", "attributes" : { "age" : 29, "address" : "321 Main Rd", "favorites" : { "food" : "Spaghetti", "animal" : "Dog" } } }
        
        

        You may notice the objects we entered are preceded by _id keys and ObjectId values. These are unique indexes generated by MongoDB when an _id value is not explicitly defined. ObjectId values can be used as primary keys when entering queries, although for ease of use, you may wish to create your own index as you would with any other database system.

        The find method can also be used to search for a specific document or field by entering a search term parameter (in the form of an object) rather than leaving it empty. For example:

        db.exampleCollection.find({"name" : "John Doe"})
        

        Running the command above returns a list of documents containing the {"name" : "John Doe"} object:

          
        { "_id" : ObjectId("5e68d4618bd4ea23cc3f5e96"), "name" : "John Doe", "attributes" : { "age" : 30, "address" : "123 Main St", "phone" : 8675309 } }
        
        

      Next Steps

      For more on MongoDB, checkout the following guides:

      More Information

      You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

      This guide is published under a CC BY-ND 4.0 license.



      Source link

      How to Deploy Grafana with One-Click Apps


      Updated by Linode

      Contributed by
      Linode

      Grafana is an open source analytics and monitoring solution with a focus on accessibility for metric visualization. You can use Grafana to create, monitor, store, and share metrics with your team to keep tabs on your infrastructure. Grafana is very lightweight and does not use a lot of memory and CPU resources.

      Deploy Grafana with One-Click Apps

      One-Click Apps allow you to easily deploy software on a Linode using the Linode Cloud Manager. To access Linode’s One-Click Apps:

      1. Log in to your Linode Cloud Manager account.

      2. From the Linode dashboard, click on the Create button in the top right-hand side of the screen and select Linode from the dropdown menu.

      3. The Linode creation page will appear. Select the One-Click tab.

      4. Under the Select App section, select the app you would like to deploy:

        Select a One-Click App to deploy

      5. Once you have selected the app, proceed to the app’s Options section and provide values for the required fields.

      Grafana Options

      The Grafana One-Click form includes a field for your Grafana admin’s password. After your app is deployed, visit the Getting Started After Deployment section.

      Field                                 Description
      Grafana PasswordSet your Grafana instance’s admin password. You will use this password when first logging into Grafana.

      Linode Options

      After providing the app-specific options, provide configurations for your Linode server:

      ConfigurationDescription
      Select an ImageDebian 9 is currently the only image supported by the Grafana One-Click App, and it is pre-selected on the Linode creation page. Required
      RegionThe region where you would like your Linode to reside. In general, it’s best to choose a location that’s closest to you. For more information on choosing a DC, review the How to Choose a Data Center guide. You can also generate MTR reports for a deeper look at the network routes between you and each of our data centers. Required.
      Linode PlanYour Linode’s hardware resources. You can use any size Linode for your Grafana App as it uses minimal system resources. The minimum recommended memory is 255 MB and the minimum recommended CPU is 1. You can always resize your Linode to a different plan later if you feel you need to increase or decrease your system resources. Required
      Linode LabelThe name for your Linode, which must be unique between all of the Linodes on your account. This name will be how you identify your server in the Cloud Manager’s Dashboard. Required.
      Add TagsA tag to help organize and group your Linode resources. Tags can be applied to Linodes, Block Storage Volumes, NodeBalancers, and Domains.
      Root PasswordThe primary administrative password for your Linode instance. This password must be provided when you log in to your Linode via SSH. It must be at least 6 characters long and contain characters from two of the following categories: lowercase and uppercase case letters, numbers, and punctuation characters. Your root password can be used to perform any action on your server, so make it long, complex, and unique. Required

      When you’ve provided all required Linode Options, click on the Create button. Your Grafana app will complete installation anywhere between 2-5 minutes after your Linode has finished provisioning.

      Getting Started after Deployment

      Access Your Grafana Client

      Now that your Grafana One-Click App is deployed, you can log into Grafana to access all of its monitoring and visualization features.

      1. Open a browser and navigate to your Linode’s IP address and port 3000, for example, http://192.0.2.0:3000/. By default, Grafana will listen to port 3000.

        Note

        The Grafana One-Click App will install and enable the UFW firewall allowing TCP traffic on port 3000.
      2. Viewing Grafana’s log in page, enter in admin as the username and the Grafana password you set in the Grafana Options section of the Cloud Manager, as the password. Click on the Log In button.

        Log into Grafana with your admin username and password.

      3. Once you are logged into Grafana, complete your configurations by adding a data source, creating dashboards, and adding users.

      More Information

      You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

      This guide is published under a CC BY-ND 4.0 license.



      Source link

      How to Deploy Flask with One-Click Apps


      Updated by Linode

      Contributed by
      Linode

      Flask is a quick and light-weight web framework for Python that includes several utilities and libraries you can use to create a web application. It is designed to make getting started quick and easy, with the ability to scale up to support more complex applications.

      Deploy a Flask One-Click App

      One-Click Apps allow you to easily deploy software on a Linode using the Linode Cloud Manager. To access Linode’s One-Click Apps:

      1. Log in to your Linode Cloud Manager account.

      2. From the Linode dashboard, click on the Create button in the top right-hand side of the screen and select Linode from the dropdown menu.

      3. The Linode creation page will appear. Select the One-Click tab.

      4. Under the Select App section, select the app you would like to deploy:

        Select a One-Click App to deploy

      5. Once you have selected the app, proceed to the app’s Options section and provide values for the required fields.

      Linode Options

      After providing the app specific options, provide configurations for your Linode server:

      ConfigurationDescription
      Select an ImageDebian 9 is currently the only image supported by Flask One-Click Apps, and it is pre-selected on the Linode creation page. Required.
      RegionThe region where you would like your Linode to reside. In general, it’s best to choose a location that’s closest to you. For more information on choosing a DC, review the How to Choose a Data Center guide. You can also generate MTR reports for a deeper look at the network routes between you and each of our data centers. Required.
      Linode PlanYour Linode’s hardware resources. Flask is lightweight and does not require high system resources. You can select any Linode plan that will support the amount of site traffic you expect for your Flask app. You can always resize your Linode to a different plan later if you feel you need to increase or decrease your system resources. Required.
      Linode LabelThe name for your Linode, which must be unique between all of the Linodes on your account. This name will be how you identify your server in the Cloud Manager’s Dashboard. Required.
      Add TagsA tag to help organize and group your Linode resources. Tags can be applied to Linodes, Block Storage Volumes, NodeBalancers, and Domains.
      Root PasswordThe primary administrative password for your Linode instance. This password must be provided when you log in to your Linode via SSH. It must be at least 6 characters long and contain characters from two of the following categories: lowercase and uppercase case letters, numbers, and punctuation characters. Your root password can be used to perform any action on your server, so make it long, complex, and unique. Required.

      When you’ve provided all required Linode Options, click on the Create button. Your Flask app will complete installation anywhere between 2-5 minutes after your Linode has finished provisioning.

      Getting Started after Deployment

      Installed Software

      In addition to installing Flask, this One-Click app installs and configures software to support running Flask in a production environment. Below is a list of the installed software:

      • The NGINX web server is installed with a basic NGINX configuration, located in /etc/nginx/sites-enabled/flask_app, and listening on your Linode’s IP address.
      • An example Flask application is downloaded to your Linode’s /home/flask_app_project directory. If you visit your Linode’s IP address, you will see the example Flask application running and serving boiler plate blog content.
      • Your example Flask application’s environment will be configured with basic settings located in the /etc/config.json file.
      • Gunicorn, a Python WSGI (web server gateway interface) HTTP Server for UNIX, is installed and running. It is used to forward requests from your NGINX web server to your Flask application.
      • Supervisor, a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems, is installed and running on your Linode. Its configuration file can be found in the following location, /etc/supervisor/conf.d/flask_app.conf.
      • The example Flask app’s logs can be found in the following locations, var/log/flask_app/flask_app.out.log and /var/log/flask_app/flask_app.err.log

      Next Steps

      Now that you are familiar with all the software installed on your Linode with the Flask One-Click app, you can explore the following steps:

      More Information

      You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

      This guide is published under a CC BY-ND 4.0 license.



      Source link