-
Notifications
You must be signed in to change notification settings - Fork 0
Deprecated
These pages have been deprecated and the guidance comprised within will not be updated going forward.
Prerequisites:
- Git
- docker, docker-compose
- maven
- access to the public registry on ECR
We're building GeoNetwork from a custom fork from the start as if we need to make any changes to the java code we can then build our own war file and docker image rather than using the default geonetwork one.
Clone https://github.com/AstunTechnology/custom-geonetwork and check out the os-310x branch:
git clone https://github.com/AstunTechnology/custom-geonetwork.git && git checkout os-310x
Build war file with es profile (for elasticsearch):
cd custom-geonetwork
sudo mvn clean install -DskipTests -Pes
Copy war file to os-custom-geonetwork/docker
(and change to that directory):
cd web/target && cp geonetwork.war ../../../os-custom-geonetwork/docker && cd !$
Build image and check it's present:
docker build --no-cache . -t os-geonetwork:v0
docker images -a
Get login details from AWS ECR and temporarily authenticate your local docker:
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
Create repository:
aws ecr-public create-repository --region us-east-1 --repository-name os-custom-geonetwork
Tag image and push to ECR. You can see the registryid
in the image reference in the docker file.
docker tag os-geonetwork:v0 public.ecr.aws/[registryid]/os-custom-geonetwork
docker push public.ecr.aws/[registryid]/os-custom-geonetwork
We're building a custom ElasticSearch container so we can pre-load it with the GeoNetwork indices (after checking whether they already exist)
In the current repository (eg os-custom-geonetwork
) change to the docker/elasticsearch
directory.
Build image and check it's present:
docker build --no-cache . -t os-elasticsearch:v0
docker images -a
Get login details from AWS ECR and temporarily authenticate your local docker:
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
Create repository:
aws ecr-public create-repository --repository-name os-elasticsearch
Tag image and push to ECR:
docker tag os-elasticsearch:v0 public.ecr.aws/[registryid]/os-elasticsearch
docker push public.ecr.aws/[registryid]/os-elasticsearch
Prerequisites:
- security key for ssh
- jq
Get the IP address of the EC2 instance and ssh onto it:
instanceIP=$( aws ec2 describe-instances --filters "Name=vpc-id, Values=[vpcid]" --query 'Reservations[*].Instances[*].PublicIpAddress' --output json | jq .[]| jq -r .[] ) && ssh ec2-user@$instanceIP -i ~/.ssh/sandpit_shared.euwest2.pem
Check the output of /var/log/cloud-init-output.log
If you run ecs-cli ps
and see messages about hitting dockerhub limits:
- Sign up for a pro account for dockerhub
- Authenticate at the command prompt with
docker login
- ssh onto the instance as above and edit /etc/ecs/ecs.config to include the credentials from your local
.docker/config.json
as per this link - Restart the ecs service with
sudo service ecs restart
- Run the
ecs-cli compose
command again to redeploy the containers
(Note that this is an interim approach- the change to ecs.config will need to be repeated if the EC2 instance is re-created, but it's not recommended to include the dockerhub credentials as environment variables)