Skip to content

Commit

Permalink
Merge pull request #1074 from EnterpriseDB/release/2021-03-16
Browse files Browse the repository at this point in the history
Production Release 2021-03-16

Former-commit-id: 5577abf
  • Loading branch information
epbarger committed Mar 16, 2021
2 parents 1cf3ffd + 92d669d commit af20e65
Show file tree
Hide file tree
Showing 14 changed files with 275 additions and 80 deletions.
9 changes: 9 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,12 @@ RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/shar
RUN su vscode -c "source /usr/local/share/nvm/nvm.sh \
&& npm install -g gatsby-cli \
&& npm install -g yarn" 2>&1

# Enable docker-in-docker (see: https://github.com/microsoft/vscode-dev-containers/blob/master/script-library/docs/docker-in-docker.md)
COPY library-scripts/*.sh /tmp/library-scripts/
RUN wget -O- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& apt-get update \
&& /bin/bash /tmp/library-scripts/docker-in-docker-debian.sh
ENTRYPOINT ["/usr/local/share/docker-init.sh"]
VOLUME [ "/var/lib/docker" ]
CMD ["sleep", "infinity"]
4 changes: 4 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "yarn install && git submodule update --init",

// docker in docker (https://github.com/microsoft/vscode-dev-containers/blob/master/script-library/docs/docker-in-docker.md)
"runArgs": ["--init", "--privileged"],
"overrideCommand": false

// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "node"
}
Expand Down
186 changes: 186 additions & 0 deletions .devcontainer/library-scripts/docker-in-docker-debian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
#!/usr/bin/env bash
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
#
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/master/script-library/docs/docker-in-docker.md
# Maintainer: The VS Code and Codespaces Teams
#
# Syntax: ./docker-in-docker-debian.sh [enable non-root docker access flag] [non-root user] [use moby]

ENABLE_NONROOT_DOCKER=${1:-"true"}
USERNAME=${2:-"automatic"}
USE_MOBY=${3:-"true"}

set -e

if [ "$(id -u)" -ne 0 ]; then
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
exit 1
fi

# Determine the appropriate non-root user
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
USERNAME=""
POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)")
for CURRENT_USER in ${POSSIBLE_USERS[@]}; do
if id -u ${CURRENT_USER} > /dev/null 2>&1; then
USERNAME=${CURRENT_USER}
break
fi
done
if [ "${USERNAME}" = "" ]; then
USERNAME=root
fi
elif [ "${USERNAME}" = "none" ] || ! id -u ${USERNAME} > /dev/null 2>&1; then
USERNAME=root
fi

# Function to run apt-get if needed
apt-get-update-if-needed()
{
if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update
else
echo "Skipping apt-get update."
fi
}

# Ensure apt is in non-interactive to avoid prompts
export DEBIAN_FRONTEND=noninteractive

# Install docker/dockerd dependencies if missing
if ! dpkg -s apt-transport-https curl ca-certificates lsb-release lxc pigz iptables > /dev/null 2>&1 || ! type gpg > /dev/null 2>&1; then
apt-get-update-if-needed
apt-get -y install --no-install-recommends apt-transport-https curl ca-certificates lsb-release lxc pigz iptables gnupg2
fi

# Swap to legacy iptables for compatibility
update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy

# Install Docker / Moby CLI if not already installed
if type docker > /dev/null 2>&1 && type dockerd > /dev/null 2>&1; then
echo "Docker / Moby CLI and Engine already installed."
else
if [ "${USE_MOBY}" = "true" ]; then
DISTRO=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
CODENAME=$(lsb_release -cs)
curl -s https://packages.microsoft.com/keys/microsoft.asc | (OUT=$(apt-key add - 2>&1) || echo $OUT)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-${DISTRO}-${CODENAME}-prod ${CODENAME} main" > /etc/apt/sources.list.d/microsoft.list
apt-get update
apt-get -y install --no-install-recommends moby-cli moby-engine
else
curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | (OUT=$(apt-key add - 2>&1) || echo $OUT)
echo "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list
apt-get update
apt-get -y install --no-install-recommends docker-ce-cli docker-ce
fi
fi

echo "Finished installing docker / moby"

# Install Docker Compose if not already installed
if type docker-compose > /dev/null 2>&1; then
echo "Docker Compose already installed."
else
LATEST_COMPOSE_VERSION=$(curl -sSL "https://api.github.com/repos/docker/compose/releases/latest" | grep -o -P '(?<="tag_name": ").+(?=")')
curl -sSL "https://github.com/docker/compose/releases/download/${LATEST_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
fi

# If init file already exists, exit
if [ -f "/usr/local/share/docker-init.sh" ]; then
echo "/usr/local/share/docker-init.sh already exists, so exiting."
exit 0
fi
echo "docker-init doesnt exist..."

# Add user to the docker group
if [ "${ENABLE_NONROOT_DOCKER}" = "true" ]; then
if ! getent group docker > /dev/null 2>&1; then
groupadd docker
fi
usermod -aG docker ${USERNAME}
fi

tee /usr/local/share/docker-init.sh > /dev/null \
<< 'EOF'
#!/usr/bin/env bash
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
sudoIf()
{
if [ "$(id -u)" -ne 0 ]; then
sudo "$@"
else
"$@"
fi
}
# explicitly remove dockerd and containerd PID file to ensure that it can start properly if it was stopped uncleanly
# ie: docker kill <ID>
sudoIf find /run /var/run -iname 'docker*.pid' -delete || :
sudoIf find /run /var/run -iname 'container*.pid' -delete || :
set -e
## Dind wrapper script from docker team
# Maintained: https://github.com/moby/moby/blob/master/hack/dind
export container=docker
if [ -d /sys/kernel/security ] && ! sudoIf mountpoint -q /sys/kernel/security; then
sudoIf mount -t securityfs none /sys/kernel/security || {
echo >&2 'Could not mount /sys/kernel/security.'
echo >&2 'AppArmor detection and --privileged mode might break.'
}
fi
# Mount /tmp (conditionally)
if ! sudoIf mountpoint -q /tmp; then
sudoIf mount -t tmpfs none /tmp
fi
# cgroup v2: enable nesting
if [ -f /sys/fs/cgroup/cgroup.controllers ]; then
# move the init process (PID 1) from the root group to the /init group,
# otherwise writing subtree_control fails with EBUSY.
sudoIf mkdir -p /sys/fs/cgroup/init
sudoIf echo 1 > /sys/fs/cgroup/init/cgroup.procs
# enable controllers
sudoIf sed -e 's/ / +/g' -e 's/^/+/' < /sys/fs/cgroup/cgroup.controllers \
> /sys/fs/cgroup/cgroup.subtree_control
fi
## Dind wrapper over.
# Handle DNS
set +e
cat /etc/resolv.conf | grep -i 'internal.cloudapp.net'
if [ $? -eq 0 ]
then
echo "Setting dockerd Azure DNS."
CUSTOMDNS="--dns 168.63.129.16"
else
echo "Not setting dockerd DNS manually."
CUSTOMDNS=""
fi
set -e
# Start docker/moby engine
( sudoIf dockerd $CUSTOMDNS > /tmp/dockerd.log 2>&1 ) &
set +e
# Execute whatever commands were passed in (if any). This allows us
# to set this script to ENTRYPOINT while still executing the default CMD.
exec "$@"
EOF

chmod +x /usr/local/share/docker-init.sh
chown ${USERNAME}:root /usr/local/share/docker-init.sh
6 changes: 2 additions & 4 deletions README_DOCKER_VSCODE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Working on Docs in a Docker container using VSCode

If you cannot or do not wish to install the prerequisite versions of Python, Node, Yarn, Gatsby, etc. on your local machine, *and* you're fond of using VSCode, then you can skip past the first seven steps under the "installation" section in the [README](README.md) and work with Docs entirely from within a Docker container managed by VSCode.
If you cannot or do not wish to install the prerequisite versions of Python, Node, Yarn, Gatsby, etc. on your local machine, *and* you're fond of using VSCode, then you can skip past the first eleven steps under the "installation" section in the [README](README.md) and work with Docs entirely from within a Docker container managed by VSCode.

## Prerequesites

Expand All @@ -16,9 +16,7 @@ If you intend to edit using VSCode, I also recommend installing the [MDX extensi
2. Paste in the URL of this repository, or a GitHub branch URL, or a GitHub PR URL
3. Choose "isolated volume" (in most cases this will be what you want)
4. Wait for VSCode to build the container, then open a terminal
8. Select sources with `yarn config-sources` (see [README](README.md) for details)
9. Pull sources with `yarn pull-sources` (see [README](README.md) for details)
10. Run the site locally with `yarn develop`. VSCode will remap port 8000 used within the container to a free port on your machine, which you can view from the Remote Explorer panel in the left sidebar - or ctrl+click the URL that Gatsby prints in the terminal to open directly.
8. Run the site locally with `yarn develop`. VSCode will remap port 8000 used within the container to a free port on your machine, which you can view from the Remote Explorer panel in the left sidebar - or ctrl+click the URL that Gatsby prints in the terminal to open directly.

You can create as many distinct containers and volumes as you wish, which can be handy for comparing PRs side-by-side without disturbing your primary work. To browse them (or clean them up) open the "Remote Explorer" tool in VSCode.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: "Supported Versions"
title: "Supported Platforms"

legacyRedirectsGenerated:
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
- "/edb-docs/d/edb-postgres-migration-portal/user-guides/user-guide/3.0.1/supported_versions.html"
---

<div id="supported_versions" class="registered_link"></div>
<div id="supported_platforms" class="registered_link"></div>

The Migration Portal supports assessment and migration from Oracle 11g and 12c to EDB Postgres Advanced Server 10, 11, 12, 0r 13. Migration Portal is supported on the following browsers and operating systems:

Expand Down
2 changes: 1 addition & 1 deletion product_docs/docs/migration_portal/3.0.1/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ EnterpriseDB has helped companies migrate their existing database systems to Pos

<div class="toctree" maxdepth="3">

whats_new supported_versions mp_using_portal mp_migrating_database mp_advanced_data_migration conclusion
supported_platforms mp_using_portal mp_migrating_database mp_advanced_data_migration

</div>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: "The MIT Kerberos Licence"

<div id="kerberos" class="registered_link"></div>

PostgreSQL Enterprise Manager uses PostgreSQL's libpq library which may be linked with MIT Kerberos Libraries on some distributions. The MIT Kerberos licence is included below:
Postgres Enterprise Manager uses PostgreSQL's libpq library which may be linked with MIT Kerberos Libraries on some distributions. The MIT Kerberos licence is included below:

## Kerberos Copyright

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,57 +12,56 @@ The update process described in this section uses the `pg_upgrade` utility to mi
!!! Note
If the source PEM Server is lower than the 7.16 version, then you need to replace the following functions before you run `pg_upgrade`:

````
- The `abstime`, `reltime`, and `tinterval` datatypes are depreacated from Postgres version 12 or later, hence to replace those dataypes with `timestamptz` data type use below command:
```text
DO
$$
DECLARE
rec record;
cnt integer;
BEGIN
-- Check for the deprecated type in our user info probe
SELECT count(*) INTO cnt
FROM pem.probe_column
WHERE sql_data_type = ‘abstime’ AND internal_name = ‘valuntil’;
IF cnt = 0 THEN
RETURN;
END IF;
ALTER TABLE pemdata.user_info
ALTER COLUMN valuntil SET DATA TYPE timestamptz;
ALTER TABLE pemhistory.user_info
ALTER COLUMN valuntil SET DATA TYPE timestamptz;
-- Now update the pem.probe_column itself
UPDATE pem.probe_column
SET sql_data_type = ‘timestamptz’
WHERE sql_data_type = ‘abstime’ AND internal_name = ‘valuntil’;
END;
$$ LANGUAGE ‘plpgsql’;
```
- Replace the below function to avoid any alert errors:
```text
CREATE OR REPLACE FUNCTION pem.check_alert_params_array_size(
template_id pem.alert_template.id%type, params text[]
)
RETURNS bool AS $FUNC$
DECLARE
res bool := TRUE;
BEGIN
/*
* During restoring the pem database, it does not maintain the order while
* inserting data in the table, and uses the sort table based on the
* names.
* Hence - we need to check the foreign key constraint is present before
* validating these values.
*/
IF EXISTS(
SELECT 1 FROM information_schema.table_constraints
WHERE constraint_name='alert_template_id_fkey' AND
table_name='alert' AND table_schema='pem'
) THEN
- The `abstime`, `reltime`, and `tinterval` datatypes are deprecated from Postgres version 12 or later, hence to replace those dataypes with `timestamptz` data type use below command:

```text
DO
$$
DECLARE
rec record;
cnt integer;
BEGIN
-- Check for the deprecated type in our user info probe
SELECT count(*) INTO cnt
FROM pem.probe_column
WHERE sql_data_type = ‘abstime’ AND internal_name = ‘valuntil’;
IF cnt = 0 THEN
RETURN;
END IF;
ALTER TABLE pemdata.user_info
ALTER COLUMN valuntil SET DATA TYPE timestamptz;
ALTER TABLE pemhistory.user_info
ALTER COLUMN valuntil SET DATA TYPE timestamptz;
-- Now update the pem.probe_column itself
UPDATE pem.probe_column
SET sql_data_type = ‘timestamptz’
WHERE sql_data_type = ‘abstime’ AND internal_name = ‘valuntil’;
END;
$$ LANGUAGE ‘plpgsql’;
```

- Replace the below function to avoid any alert errors:

```text
CREATE OR REPLACE FUNCTION pem.check_alert_params_array_size(
template_id pem.alert_template.id%type, params text[]
)
RETURNS bool AS $FUNC$
DECLARE
res bool := TRUE;
BEGIN
/*
* During restoring the pem database, it does not maintain the order while
* inserting data in the table, and uses the sort table based on the
* names.
* Hence - we need to check the foreign key constraint is present before
* validating these values.
*/
IF EXISTS(
SELECT 1 FROM information_schema.table_constraints
WHERE constraint_name='alert_template_id_fkey' AND
table_name='alert' AND table_schema='pem'
) THEN
/*
* Need to use the IS TRUE construct outside the main query, because
* otherwise if there's no template by that ID then the query would return
Expand All @@ -83,10 +82,9 @@ BEGIN
$SQL$ INTO res USING template_id, params;
END IF;
RETURN res;
END
$FUNC$ LANGUAGE 'plpgsql';
```
````
END
$FUNC$ LANGUAGE 'plpgsql';
```

`pg_upgrade` supports a transfer of data between servers of the same type. For example, you can use `pg_upgrade` to move data from a PostgreSQL 9.6 backend database to a PostgreSQL 11 backend database, but not to an Advanced Server 11 backend database. If you wish to migrate to a different type of backend database (i.e from a PostgreSQL server to Advanced Server), see [Moving the Postgres Enterprise Manager Server](03_moving_pem_server).

Expand Down
Loading

0 comments on commit af20e65

Please sign in to comment.