This last improvement requires that secure communication between the VEN and VTN use port 8443. We generated a new Amazon cloud master image that includes these logging enhancements, as well as one additional fix that enables use of the EPRI VEN over a secure channel with the VTN in the Cloud. The Request and Response banners also indicate the direction of the payload exchange. Note that each Request Response exchange has a header with the Date, Time, VEN Name, and VEN ID. Once logging is enabled for one or more VENs and payloads have been exchanged, you can click the View Log option in the sidebar menu to last 3,000 lines of logged data as shown in Figure 3 below. Make sure to click “Save” after changing this setting. Selecting the View, Edit option will allow you to configure the VEN, including logging.įigure 2 below shows that there is now a logging check box on the OpenADR Profile Settings section of the VEN configuration dialogs. Note the new column showing whether logging is enabled for each VEN. Despite the unexpected effort, we were quite happy with the end result.įigure 1 below shows the VEN list that is displayed when the sidebar VEN menu option is selected. Seems simple, but it took us a while to get the lay of the land with regards to the MVP implementation, and we had to modify or create almost 20 source code files to implement this relatively simple functionality. Our goal was to allow the administrative user to enable or disable logging on a selective basis for each VEN, then to allow users to view the composite log of all payload exchanges with appropriate descriptive banners and formatting of the XML data. This limitation is particularly serious if the VEN you are using also does not provide payload exchange logging and you encounter errors.Īlthough unfamiliar with the Ruby on Rails MVC (Model, View, Controller) programming environment used to implement the EPRI VTN, we undertook the task of adding logging functionality to the Cloud VTN supported by QualityLogic. The open source EPRI VTN, the basis for QualityLogic’s cloud offering, provides no support in the administrative interface for viewing payload exchanges. One of the challenges with the VTN in the Cloud is isolating problems with OpenADR XML payload exchanges. Since the database exists already, we don’t need the migration file. Rails generate scaffold Article title:string body:text Step 9 : Delete the Articles Migration file Open your terminal and run the following command : Repeat steps 5 and 6 Step 8 : Generate The CRUD for Articles The final SQL Command to create the table should look like this : CREATE TABLE articles ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, title VARCHAR(50), body TEXT, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL ) To fix this, tweak the articles table structure a bit. Of course there is a tiny mistake here ! Following rails conventions, the fields created_at updated_at are handled by default and should not be included in the fields list of the scaffold command. (copied to your clipboard) Step 7: Update table structure to follow Rails Conventions ![]() Rails generate scaffold Article title:string body:text created:datetime modified:datetime Options are: 4 for table 4 (4.6) for table 4 to 6 for tables 4 and 6 * for all Tables Scaffold -c -p ~/path_to_rails_app/db/schema.rb It’s time now to make use of the gem we previously installed Rails db:schema:dump Step 6: Generate the scaffold commands The next step is to generate the schema.rb file based on the existing db More info on the gem here Step 5 : Generate the schema Now, we need to install the gem that will do the work for us : Sudo apt-get install xclip Step 4: Install the required gem if you are using a Debian based distro like me, execute: Grab it from the repo of your linux distribution. Ĭreate the table articles with the following SQL Command : CREATE TABLE articles ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, title VARCHAR(50), body TEXT, created DATETIME DEFAULT NULL, modified DATETIME DEFAULT NULL ) Step 3 : Install xclip Now we link our freshly rails app to our existing db by tinkering database.ymlĭefault: &default adapter: mysql2 encoding: utf8 pool: 5 username: password: socket: /var/run/mysqld/mysqld.sockįor the purpose of this tutorial we will work on a db called blog with one table called articles. Rails new -d mysql Step 2: Configure the database ![]() Let’s start! STEP 1: Create a rails project If you are maintaining a legacy app or planning to migrate from another technology to Rails anyway, it can be daunting if you don’t pay attention to the conventions that the Rails framework impose. If done right, the migration will be worth it How to build a Rails app on top of an existing database
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |