From 079c08e440332e9c40395d2abc0fc5439aac953e Mon Sep 17 00:00:00 2001 From: Mikael Nyvelius <30390845+nyvelius@users.noreply.github.com> Date: Thu, 15 Apr 2021 07:53:56 +0200 Subject: [PATCH 1/4] Update creating-postgresql-service-containers.md --- .../actions/guides/creating-postgresql-service-containers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/actions/guides/creating-postgresql-service-containers.md b/content/actions/guides/creating-postgresql-service-containers.md index 5c95d88d4e..a67aea0de0 100644 --- a/content/actions/guides/creating-postgresql-service-containers.md +++ b/content/actions/guides/creating-postgresql-service-containers.md @@ -22,7 +22,7 @@ topics: ### Introduction -This guide shows you workflow examples that configure a service container using the Docker Hub `postgres` image. The workflow runs a script to create a PostgreSQL client and populate the client with data. To test that the workflow creates and populates the PostgreSQL client, the script prints the client's data to the console. +This guide shows you workflow examples that configure a service container using the Docker Hub `postgres` image. The workflow runs a script that creates a PostgreSQL database and populates it with data. To test that the workflow creates and populates the PostgreSQL database, the script prints the data from the database to the console. {% data reusables.github-actions.docker-container-os-support %} From 97a6159990e4b0c17802857ea802ef27e4f0614e Mon Sep 17 00:00:00 2001 From: Martin Lopes Date: Wed, 12 May 2021 15:49:22 +1000 Subject: [PATCH 2/4] Update creating-postgresql-service-containers.md --- .../creating-postgresql-service-containers.md | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/content/actions/guides/creating-postgresql-service-containers.md b/content/actions/guides/creating-postgresql-service-containers.md index a6364cb861..c63adbe3fd 100644 --- a/content/actions/guides/creating-postgresql-service-containers.md +++ b/content/actions/guides/creating-postgresql-service-containers.md @@ -22,7 +22,7 @@ topics: ### Introduction -This guide shows you workflow examples that configure a service container using the Docker Hub `postgres` image. The workflow runs a script that creates a PostgreSQL database and populates it with data. To test that the workflow creates and populates the PostgreSQL database, the script prints the data from the database to the console. +This guide shows you workflow examples that configure a service container using the Docker Hub `postgres` image. The workflow runs a script that connects to the PostgreSQL service, creates a table, and then populates it with data. To test that the workflow creates and populates the PostgreSQL table, the script prints the data from the table to the console. {% data reusables.github-actions.docker-container-os-support %} @@ -81,10 +81,10 @@ jobs: run: npm ci - name: Connect to PostgreSQL - # Runs a script that creates a PostgreSQL client, populates - # the client with data, and retrieves data + # Runs a script that creates a PostgreSQL table, populates + # the table with data, and then retrieves the data. run: node client.js - # Environment variable used by the `client.js` script to create a new PostgreSQL client. + # Environment variable used by the `client.js` script to create a new PostgreSQL table. env: # The hostname used to communicate with the PostgreSQL service container POSTGRES_HOST: postgres @@ -141,8 +141,8 @@ steps: run: npm ci - name: Connect to PostgreSQL - # Runs a script that creates a PostgreSQL client, populates - # the client with data, and retrieves data + # Runs a script that creates a PostgreSQL table, populates + # the table with data, and then retrieves the data. run: node client.js # Environment variable used by the `client.js` script to create # a new PostgreSQL client. @@ -204,11 +204,11 @@ jobs: run: npm ci - name: Connect to PostgreSQL - # Runs a script that creates a PostgreSQL client, populates - # the client with data, and retrieves data + # Runs a script that creates a PostgreSQL table, populates + # the table with data, and then retrieves the data run: node client.js # Environment variable used by the `client.js` script to create - # a new PostgreSQL client. + # a new PostgreSQL table. env: # The hostname used to communicate with the PostgreSQL service container POSTGRES_HOST: localhost @@ -268,11 +268,11 @@ steps: run: npm ci - name: Connect to PostgreSQL - # Runs a script that creates a PostgreSQL client, populates - # the client with data, and retrieves data + # Runs a script that creates a PostgreSQL table, populates + # the table with data, and then retrieves the data run: node client.js # Environment variable used by the `client.js` script to create - # a new PostgreSQL client. + # a new PostgreSQL table. env: # The hostname used to communicate with the PostgreSQL service container POSTGRES_HOST: localhost @@ -286,9 +286,9 @@ steps: ### Testing the PostgreSQL service container -You can test your workflow using the following script, which creates a PostgreSQL client and adds a new table with some placeholder data. The script then prints the values stored in the PostgreSQL client to the terminal. Your script can use any language you'd like, but this example uses Node.js and the `pg` npm module. For more information, see the [npm pg module](https://www.npmjs.com/package/pg). +You can test your workflow using the following script, which connects to the PostgreSQL service and adds a new table with some placeholder data. The script then prints the values stored in the PostgreSQL table to the terminal. Your script can use any language you'd like, but this example uses Node.js and the `pg` npm module. For more information, see the [npm pg module](https://www.npmjs.com/package/pg). -You can modify *client.js* to include any PostgreSQL operations needed by your workflow. In this example, the script creates the PostgreSQL client instance, creates a table, adds placeholder data, then retrieves the data. +You can modify *client.js* to include any PostgreSQL operations needed by your workflow. In this example, the script connects to the PostgreSQL service, adds a table to the `postgres` table, inserts some placeholder data, and then retrieves the data. {% data reusables.github-actions.service-container-add-script %} @@ -324,11 +324,11 @@ pgclient.query('SELECT * FROM student', (err, res) => { }); ``` -The script creates a new PostgreSQL `Client`, which accepts a `host` and `port` parameter. The script uses the `POSTGRES_HOST` and `POSTGRES_PORT` environment variables to set the client's IP address and port. If `host` and `port` are not defined, the default host is `localhost` and the default port is 5432. +The script creates a new connection to the PostgreSQL service, and uses the `POSTGRES_HOST` and `POSTGRES_PORT` environment variables to define the PostgreSQL service IP address and port. If `host` and `port` are not defined, the default host is `localhost` and the default port is 5432. -The script creates a table and populates it with placeholder data. To test that the PostgreSQL database contains the data, the script prints the contents of the table to the console log. +The script creates a table and populates it with placeholder data. To test that the `postgres` database contains the data, the script prints the contents of the table to the console log. -When you run this workflow, you should see the following output in the "Connect to PostgreSQL" step confirming you created the PostgreSQL client and added data: +When you run this workflow, you should see the following output in the "Connect to PostgreSQL" step, which confirms that you successfully created the PostgreSQL table and added data: ``` null [ { id: 1, From 8461845f4aad749e9fd9024363c480342650be6b Mon Sep 17 00:00:00 2001 From: Martin Lopes Date: Wed, 12 May 2021 16:43:16 +1000 Subject: [PATCH 3/4] Update content/actions/guides/creating-postgresql-service-containers.md Co-authored-by: Lucas Costi --- .../actions/guides/creating-postgresql-service-containers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/actions/guides/creating-postgresql-service-containers.md b/content/actions/guides/creating-postgresql-service-containers.md index c63adbe3fd..37b8d81263 100644 --- a/content/actions/guides/creating-postgresql-service-containers.md +++ b/content/actions/guides/creating-postgresql-service-containers.md @@ -84,7 +84,7 @@ jobs: # Runs a script that creates a PostgreSQL table, populates # the table with data, and then retrieves the data. run: node client.js - # Environment variable used by the `client.js` script to create a new PostgreSQL table. + # Environment variables used by the `client.js` script to create a new PostgreSQL table. env: # The hostname used to communicate with the PostgreSQL service container POSTGRES_HOST: postgres From 24bff880d3dda16610c3ed6f79ad3fa058413d98 Mon Sep 17 00:00:00 2001 From: Martin Lopes Date: Wed, 12 May 2021 17:07:44 +1000 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Lucas Costi --- .../guides/creating-postgresql-service-containers.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/actions/guides/creating-postgresql-service-containers.md b/content/actions/guides/creating-postgresql-service-containers.md index 37b8d81263..62cd439a0a 100644 --- a/content/actions/guides/creating-postgresql-service-containers.md +++ b/content/actions/guides/creating-postgresql-service-containers.md @@ -207,7 +207,7 @@ jobs: # Runs a script that creates a PostgreSQL table, populates # the table with data, and then retrieves the data run: node client.js - # Environment variable used by the `client.js` script to create + # Environment variables used by the `client.js` script to create # a new PostgreSQL table. env: # The hostname used to communicate with the PostgreSQL service container @@ -271,7 +271,7 @@ steps: # Runs a script that creates a PostgreSQL table, populates # the table with data, and then retrieves the data run: node client.js - # Environment variable used by the `client.js` script to create + # Environment variables used by the `client.js` script to create # a new PostgreSQL table. env: # The hostname used to communicate with the PostgreSQL service container @@ -288,7 +288,7 @@ steps: You can test your workflow using the following script, which connects to the PostgreSQL service and adds a new table with some placeholder data. The script then prints the values stored in the PostgreSQL table to the terminal. Your script can use any language you'd like, but this example uses Node.js and the `pg` npm module. For more information, see the [npm pg module](https://www.npmjs.com/package/pg). -You can modify *client.js* to include any PostgreSQL operations needed by your workflow. In this example, the script connects to the PostgreSQL service, adds a table to the `postgres` table, inserts some placeholder data, and then retrieves the data. +You can modify *client.js* to include any PostgreSQL operations needed by your workflow. In this example, the script connects to the PostgreSQL service, adds a table to the `postgres` database, inserts some placeholder data, and then retrieves the data. {% data reusables.github-actions.service-container-add-script %} @@ -324,7 +324,7 @@ pgclient.query('SELECT * FROM student', (err, res) => { }); ``` -The script creates a new connection to the PostgreSQL service, and uses the `POSTGRES_HOST` and `POSTGRES_PORT` environment variables to define the PostgreSQL service IP address and port. If `host` and `port` are not defined, the default host is `localhost` and the default port is 5432. +The script creates a new connection to the PostgreSQL service, and uses the `POSTGRES_HOST` and `POSTGRES_PORT` environment variables to specify the PostgreSQL service IP address and port. If `host` and `port` are not defined, the default host is `localhost` and the default port is 5432. The script creates a table and populates it with placeholder data. To test that the `postgres` database contains the data, the script prints the contents of the table to the console log.