Skip to content

Edge Node (Scaleway)

Setup recipe for edge servers running on Scaleway virtual machines. These serve the CookieHub consent widget via PHP + Nginx with GeoIP support.

Still active

The Scaleway PHP edge nodes are the primary widget serving layer today. CloudFront + Lambda@Edge handles region detection and consent logging but the PHP servers remain in use.

Initial Setup

apt-get update && apt-get upgrade

Install Dependencies

sudo apt install cron git composer nginx nginx-common \
  php php-fpm wget php-cli php-simplexml php-mbstring php-zip \
  libnginx-mod-http-geoip2

Clone and Configure

cd /var/www
git clone https://github.com/cookiehub-com/edge.git
cd edge
git switch prod  # or stage

composer install

cp _setup/conf/nginx.conf /etc/nginx/nginx.conf
cp _setup/conf/geoip.conf /etc/GeoIP.conf
cp _setup/ssl /etc/nginx/ -r
cp _setup/env.prod .env
chown www-data:www-data /var/www/edge -R

GeoIP Database Updates

wget https://github.com/maxmind/geoipupdate/releases/download/v4.9.0/geoipupdate_4.9.0_linux_amd64.deb
dpkg -i geoipupdate_4.9.0_linux_amd64.deb
geoipupdate

# Schedule weekly updates (Tuesdays at 2am)
(crontab -l 2>/dev/null; echo "0 2 * * 2 /usr/bin/geoipupdate 2>&1") | crontab -

Restart Nginx

/etc/init.d/nginx restart

Monitoring (New Relic)

Credential placeholder

Replace the API key below with the actual New Relic API key.

curl -Ls https://download.newrelic.com/install/newrelic-cli/scripts/install.sh | bash && \
  sudo NEW_RELIC_API_KEY=XXXXXXXXXX \
  NEW_RELIC_ACCOUNT_ID=3718093 \
  NEW_RELIC_REGION=EU \
  /usr/local/bin/newrelic install

Tune the agent config at /etc/newrelic-infra.yml:

metrics_network_sample_rate: 300
metrics_process_sample_rate: 300
windows_updates_refresh_sec: 86400
windows_services_refresh_sec: 300
users_refresh_sec: 900
metrics_storage_sample_rate: 3600
metrics_system_sample_rate: 300

Disable logging to reduce noise:

mv /etc/newrelic-infra/logging.d/logging.yml /etc/newrelic-infra/logging.d/logging.yml.example
mv /etc/newrelic-infra/logging.d/discovered.yml /etc/newrelic-infra/logging.d/discovered.yml.example
systemctl restart newrelic-infra