Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default shared services config #5

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configs/hic-ubuntu-22.04-desktop-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ modules:
- ssms
- utils
- vscode
- shared-services-config

files:
- src: conda-envs/example.yml
Expand Down
1 change: 1 addition & 0 deletions configs/hic-windows-2019-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ modules:
- ssms
- vscode
- autohibernate
- shared-services-config

files:
- src: conda-envs/example.yml
Expand Down
7 changes: 0 additions & 7 deletions modules/rstudio.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ Start-Process C:\Tools\RTools.exe -ArgumentList "/VERYSILENT" -NoNewWindow -Wait
$RConfig = @"
# Set the default help type
options(help_type="html")

# HIC TRE R Repository
local({r <- getOption("repos")
r["CRAN"] <- "http://cran.hic-tre.dundee.ac.uk/"
options(repos=r)
})

# Set timezone
Sys.setenv(TZ='Europe/London')
"@
Expand Down
7 changes: 0 additions & 7 deletions modules/rstudio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ fi
cat > "$HOME/.Rprofile" <<EOF
# Set the default help type
options(help_type="html")

# HIC TRE R Repository
local({r <- getOption("repos")
r["CRAN"] <- "http://cran.hic-tre.dundee.ac.uk/"
options(repos=r)
})

# Set timezone
Sys.setenv(TZ='Europe/London')
EOF
Expand Down
28 changes: 28 additions & 0 deletions modules/shared-services-config.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Configure the workspace to access shared services

if (-not $env:SHARED_SERVICES_DOMAIN) {
$env:SHARED_SERVICES_DOMAIN = "tre.internal"
}
if (-not $env:SHARED_SERVICES_DNS) {
$env:SHARED_SERVICES_DNS = "10.253.0.253"
}

$condarc = @"
channels:
- conda-forge
channel_alias: http://conda.${env:SHARED_SERVICES_DOMAIN}/
"@
Set-Content -Path C:\Users\Administrator\.condarc $condarc

$RConfig = @"
# TRE CRAN repository
local({r <- getOption("repos")
r["CRAN"] <- "http://cran.${env:SHARED_SERVICES_DOMAIN}/"
options(repos=r)
})
"@
Get-ChildItem "C:\Program Files\R" -Directory | ForEach-Object {
Add-Content "$($_.FullName)\etc\Rprofile.site" $RConfig
}

Add-DnsClientNrptRule -Namespace ".${env:SHARED_SERVICES_DOMAIN}" -NameServers $env:SHARED_SERVICES_DNS
32 changes: 32 additions & 0 deletions modules/shared-services-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

set -eu

if [ -z "$SHARED_SERVICES_DOMAIN" ]; then
SHARED_SERVICES_DOMAIN="tre.internal"
fi
if [ -z "$SHARED_SERVICES_DNS" ]; then
SHARED_SERVICES_DNS="10.253.0.253"
fi

cat <<EOF > "$HOME/.condarc"
channels:
- conda-forge
channel_alias: "http://conda.${SHARED_SERVICES_DOMAIN}/"
EOF

cat <<EOF >> "$HOME/.Rprofile"
# TRE CRAN repository
local({r <- getOption("repos")
r["CRAN"] <- "http://cran.${SHARED_SERVICES_DOMAIN}/"
options(repos=r)
})
EOF

# The following sets the global DNS server which is used for entries in
# the Domains key when prefixed with a tilde. The Link name server (set
# by DHCP) is used for all other queries, allowing SSM endpoints etc to
# still be resolved within the VPC.
echo "DNS=${SHARED_SERVICES_DNS}" | sudo tee -a /etc/systemd/resolved.conf
echo "Domains=~${SHARED_SERVICES_DOMAIN}" | sudo tee -a /etc/systemd/resolved.conf
sudo systemctl restart systemd-resolved