Skip to content

Commit af20e65

Browse files
authored
Merge pull request #1074 from EnterpriseDB/release/2021-03-16
Production Release 2021-03-16 Former-commit-id: 5577abf
2 parents 1cf3ffd + 92d669d commit af20e65

File tree

14 files changed

+275
-80
lines changed

14 files changed

+275
-80
lines changed

.devcontainer/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,12 @@ RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/shar
2828
RUN su vscode -c "source /usr/local/share/nvm/nvm.sh \
2929
&& npm install -g gatsby-cli \
3030
&& npm install -g yarn" 2>&1
31+
32+
# Enable docker-in-docker (see: https://github.com/microsoft/vscode-dev-containers/blob/master/script-library/docs/docker-in-docker.md)
33+
COPY library-scripts/*.sh /tmp/library-scripts/
34+
RUN wget -O- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
35+
&& apt-get update \
36+
&& /bin/bash /tmp/library-scripts/docker-in-docker-debian.sh
37+
ENTRYPOINT ["/usr/local/share/docker-init.sh"]
38+
VOLUME [ "/var/lib/docker" ]
39+
CMD ["sleep", "infinity"]

.devcontainer/devcontainer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
// Use 'postCreateCommand' to run commands after the container is created.
2424
"postCreateCommand": "yarn install && git submodule update --init",
2525

26+
// docker in docker (https://github.com/microsoft/vscode-dev-containers/blob/master/script-library/docs/docker-in-docker.md)
27+
"runArgs": ["--init", "--privileged"],
28+
"overrideCommand": false
29+
2630
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
2731
// "remoteUser": "node"
2832
}
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
#!/usr/bin/env bash
2+
#-------------------------------------------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
5+
#-------------------------------------------------------------------------------------------------------------
6+
#
7+
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/master/script-library/docs/docker-in-docker.md
8+
# Maintainer: The VS Code and Codespaces Teams
9+
#
10+
# Syntax: ./docker-in-docker-debian.sh [enable non-root docker access flag] [non-root user] [use moby]
11+
12+
ENABLE_NONROOT_DOCKER=${1:-"true"}
13+
USERNAME=${2:-"automatic"}
14+
USE_MOBY=${3:-"true"}
15+
16+
set -e
17+
18+
if [ "$(id -u)" -ne 0 ]; then
19+
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
20+
exit 1
21+
fi
22+
23+
# Determine the appropriate non-root user
24+
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
25+
USERNAME=""
26+
POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)")
27+
for CURRENT_USER in ${POSSIBLE_USERS[@]}; do
28+
if id -u ${CURRENT_USER} > /dev/null 2>&1; then
29+
USERNAME=${CURRENT_USER}
30+
break
31+
fi
32+
done
33+
if [ "${USERNAME}" = "" ]; then
34+
USERNAME=root
35+
fi
36+
elif [ "${USERNAME}" = "none" ] || ! id -u ${USERNAME} > /dev/null 2>&1; then
37+
USERNAME=root
38+
fi
39+
40+
# Function to run apt-get if needed
41+
apt-get-update-if-needed()
42+
{
43+
if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
44+
echo "Running apt-get update..."
45+
apt-get update
46+
else
47+
echo "Skipping apt-get update."
48+
fi
49+
}
50+
51+
# Ensure apt is in non-interactive to avoid prompts
52+
export DEBIAN_FRONTEND=noninteractive
53+
54+
# Install docker/dockerd dependencies if missing
55+
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
56+
apt-get-update-if-needed
57+
apt-get -y install --no-install-recommends apt-transport-https curl ca-certificates lsb-release lxc pigz iptables gnupg2
58+
fi
59+
60+
# Swap to legacy iptables for compatibility
61+
update-alternatives --set iptables /usr/sbin/iptables-legacy
62+
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
63+
64+
# Install Docker / Moby CLI if not already installed
65+
if type docker > /dev/null 2>&1 && type dockerd > /dev/null 2>&1; then
66+
echo "Docker / Moby CLI and Engine already installed."
67+
else
68+
if [ "${USE_MOBY}" = "true" ]; then
69+
DISTRO=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
70+
CODENAME=$(lsb_release -cs)
71+
curl -s https://packages.microsoft.com/keys/microsoft.asc | (OUT=$(apt-key add - 2>&1) || echo $OUT)
72+
echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-${DISTRO}-${CODENAME}-prod ${CODENAME} main" > /etc/apt/sources.list.d/microsoft.list
73+
apt-get update
74+
apt-get -y install --no-install-recommends moby-cli moby-engine
75+
else
76+
curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | (OUT=$(apt-key add - 2>&1) || echo $OUT)
77+
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
78+
apt-get update
79+
apt-get -y install --no-install-recommends docker-ce-cli docker-ce
80+
fi
81+
fi
82+
83+
echo "Finished installing docker / moby"
84+
85+
# Install Docker Compose if not already installed
86+
if type docker-compose > /dev/null 2>&1; then
87+
echo "Docker Compose already installed."
88+
else
89+
LATEST_COMPOSE_VERSION=$(curl -sSL "https://api.github.com/repos/docker/compose/releases/latest" | grep -o -P '(?<="tag_name": ").+(?=")')
90+
curl -sSL "https://github.com/docker/compose/releases/download/${LATEST_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
91+
chmod +x /usr/local/bin/docker-compose
92+
fi
93+
94+
# If init file already exists, exit
95+
if [ -f "/usr/local/share/docker-init.sh" ]; then
96+
echo "/usr/local/share/docker-init.sh already exists, so exiting."
97+
exit 0
98+
fi
99+
echo "docker-init doesnt exist..."
100+
101+
# Add user to the docker group
102+
if [ "${ENABLE_NONROOT_DOCKER}" = "true" ]; then
103+
if ! getent group docker > /dev/null 2>&1; then
104+
groupadd docker
105+
fi
106+
usermod -aG docker ${USERNAME}
107+
fi
108+
109+
tee /usr/local/share/docker-init.sh > /dev/null \
110+
<< 'EOF'
111+
#!/usr/bin/env bash
112+
#-------------------------------------------------------------------------------------------------------------
113+
# Copyright (c) Microsoft Corporation. All rights reserved.
114+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
115+
#-------------------------------------------------------------------------------------------------------------
116+
117+
sudoIf()
118+
{
119+
if [ "$(id -u)" -ne 0 ]; then
120+
sudo "$@"
121+
else
122+
"$@"
123+
fi
124+
}
125+
126+
# explicitly remove dockerd and containerd PID file to ensure that it can start properly if it was stopped uncleanly
127+
# ie: docker kill <ID>
128+
sudoIf find /run /var/run -iname 'docker*.pid' -delete || :
129+
sudoIf find /run /var/run -iname 'container*.pid' -delete || :
130+
131+
set -e
132+
133+
## Dind wrapper script from docker team
134+
# Maintained: https://github.com/moby/moby/blob/master/hack/dind
135+
136+
export container=docker
137+
138+
if [ -d /sys/kernel/security ] && ! sudoIf mountpoint -q /sys/kernel/security; then
139+
sudoIf mount -t securityfs none /sys/kernel/security || {
140+
echo >&2 'Could not mount /sys/kernel/security.'
141+
echo >&2 'AppArmor detection and --privileged mode might break.'
142+
}
143+
fi
144+
145+
# Mount /tmp (conditionally)
146+
if ! sudoIf mountpoint -q /tmp; then
147+
sudoIf mount -t tmpfs none /tmp
148+
fi
149+
150+
# cgroup v2: enable nesting
151+
if [ -f /sys/fs/cgroup/cgroup.controllers ]; then
152+
# move the init process (PID 1) from the root group to the /init group,
153+
# otherwise writing subtree_control fails with EBUSY.
154+
sudoIf mkdir -p /sys/fs/cgroup/init
155+
sudoIf echo 1 > /sys/fs/cgroup/init/cgroup.procs
156+
# enable controllers
157+
sudoIf sed -e 's/ / +/g' -e 's/^/+/' < /sys/fs/cgroup/cgroup.controllers \
158+
> /sys/fs/cgroup/cgroup.subtree_control
159+
fi
160+
## Dind wrapper over.
161+
162+
# Handle DNS
163+
set +e
164+
cat /etc/resolv.conf | grep -i 'internal.cloudapp.net'
165+
if [ $? -eq 0 ]
166+
then
167+
echo "Setting dockerd Azure DNS."
168+
CUSTOMDNS="--dns 168.63.129.16"
169+
else
170+
echo "Not setting dockerd DNS manually."
171+
CUSTOMDNS=""
172+
fi
173+
set -e
174+
175+
# Start docker/moby engine
176+
( sudoIf dockerd $CUSTOMDNS > /tmp/dockerd.log 2>&1 ) &
177+
178+
set +e
179+
180+
# Execute whatever commands were passed in (if any). This allows us
181+
# to set this script to ENTRYPOINT while still executing the default CMD.
182+
exec "$@"
183+
EOF
184+
185+
chmod +x /usr/local/share/docker-init.sh
186+
chown ${USERNAME}:root /usr/local/share/docker-init.sh

README_DOCKER_VSCODE.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Working on Docs in a Docker container using VSCode
22

3-
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.
3+
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.
44

55
## Prerequesites
66

@@ -16,9 +16,7 @@ If you intend to edit using VSCode, I also recommend installing the [MDX extensi
1616
2. Paste in the URL of this repository, or a GitHub branch URL, or a GitHub PR URL
1717
3. Choose "isolated volume" (in most cases this will be what you want)
1818
4. Wait for VSCode to build the container, then open a terminal
19-
8. Select sources with `yarn config-sources` (see [README](README.md) for details)
20-
9. Pull sources with `yarn pull-sources` (see [README](README.md) for details)
21-
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.
19+
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.
2220

2321
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.
2422

product_docs/docs/migration_portal/3.0.1/02_supported_platforms.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: "Supported Versions"
2+
title: "Supported Platforms"
33

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

9-
<div id="supported_versions" class="registered_link"></div>
9+
<div id="supported_platforms" class="registered_link"></div>
1010

1111
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:
1212

product_docs/docs/migration_portal/3.0.1/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ EnterpriseDB has helped companies migrate their existing database systems to Pos
2424

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

27-
whats_new supported_versions mp_using_portal mp_migrating_database mp_advanced_data_migration conclusion
27+
supported_platforms mp_using_portal mp_migrating_database mp_advanced_data_migration
2828

2929
</div>

product_docs/docs/pem/8.0.1/pem_online_help/11_appendices/02_kerberos.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: "The MIT Kerberos Licence"
44

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

7-
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:
7+
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:
88

99
## Kerberos Copyright
1010

product_docs/docs/pem/8.0.1/pem_upgrade/02_upgrading_backend_database.mdx

Lines changed: 53 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -12,57 +12,56 @@ The update process described in this section uses the `pg_upgrade` utility to mi
1212
!!! Note
1313
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`:
1414

15-
````
16-
- 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:
17-
18-
```text
19-
DO
20-
$$
21-
DECLARE
22-
rec record;
23-
cnt integer;
24-
BEGIN
25-
-- Check for the deprecated type in our user info probe
26-
SELECT count(*) INTO cnt
27-
FROM pem.probe_column
28-
WHERE sql_data_type = ‘abstime’ AND internal_name = ‘valuntil’;
29-
IF cnt = 0 THEN
30-
RETURN;
31-
END IF;
32-
ALTER TABLE pemdata.user_info
33-
ALTER COLUMN valuntil SET DATA TYPE timestamptz;
34-
ALTER TABLE pemhistory.user_info
35-
ALTER COLUMN valuntil SET DATA TYPE timestamptz;
36-
-- Now update the pem.probe_column itself
37-
UPDATE pem.probe_column
38-
SET sql_data_type = ‘timestamptz’
39-
WHERE sql_data_type = ‘abstime’ AND internal_name = ‘valuntil’;
40-
END;
41-
$$ LANGUAGE ‘plpgsql’;
42-
```
43-
44-
- Replace the below function to avoid any alert errors:
45-
46-
```text
47-
CREATE OR REPLACE FUNCTION pem.check_alert_params_array_size(
48-
template_id pem.alert_template.id%type, params text[]
49-
)
50-
RETURNS bool AS $FUNC$
51-
DECLARE
52-
res bool := TRUE;
53-
BEGIN
54-
/*
55-
* During restoring the pem database, it does not maintain the order while
56-
* inserting data in the table, and uses the sort table based on the
57-
* names.
58-
* Hence - we need to check the foreign key constraint is present before
59-
* validating these values.
60-
*/
61-
IF EXISTS(
62-
SELECT 1 FROM information_schema.table_constraints
63-
WHERE constraint_name='alert_template_id_fkey' AND
64-
table_name='alert' AND table_schema='pem'
65-
) THEN
15+
- 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:
16+
17+
```text
18+
DO
19+
$$
20+
DECLARE
21+
rec record;
22+
cnt integer;
23+
BEGIN
24+
-- Check for the deprecated type in our user info probe
25+
SELECT count(*) INTO cnt
26+
FROM pem.probe_column
27+
WHERE sql_data_type = ‘abstime’ AND internal_name = ‘valuntil’;
28+
IF cnt = 0 THEN
29+
RETURN;
30+
END IF;
31+
ALTER TABLE pemdata.user_info
32+
ALTER COLUMN valuntil SET DATA TYPE timestamptz;
33+
ALTER TABLE pemhistory.user_info
34+
ALTER COLUMN valuntil SET DATA TYPE timestamptz;
35+
-- Now update the pem.probe_column itself
36+
UPDATE pem.probe_column
37+
SET sql_data_type = ‘timestamptz’
38+
WHERE sql_data_type = ‘abstime’ AND internal_name = ‘valuntil’;
39+
END;
40+
$$ LANGUAGE ‘plpgsql’;
41+
```
42+
43+
- Replace the below function to avoid any alert errors:
44+
45+
```text
46+
CREATE OR REPLACE FUNCTION pem.check_alert_params_array_size(
47+
template_id pem.alert_template.id%type, params text[]
48+
)
49+
RETURNS bool AS $FUNC$
50+
DECLARE
51+
res bool := TRUE;
52+
BEGIN
53+
/*
54+
* During restoring the pem database, it does not maintain the order while
55+
* inserting data in the table, and uses the sort table based on the
56+
* names.
57+
* Hence - we need to check the foreign key constraint is present before
58+
* validating these values.
59+
*/
60+
IF EXISTS(
61+
SELECT 1 FROM information_schema.table_constraints
62+
WHERE constraint_name='alert_template_id_fkey' AND
63+
table_name='alert' AND table_schema='pem'
64+
) THEN
6665
/*
6766
* Need to use the IS TRUE construct outside the main query, because
6867
* otherwise if there's no template by that ID then the query would return
@@ -83,10 +82,9 @@ BEGIN
8382
$SQL$ INTO res USING template_id, params;
8483
END IF;
8584
RETURN res;
86-
END
87-
$FUNC$ LANGUAGE 'plpgsql';
88-
```
89-
````
85+
END
86+
$FUNC$ LANGUAGE 'plpgsql';
87+
```
9088

9189
`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).
9290

0 commit comments

Comments
 (0)