Skip to content

Set up your EC2 instance as a data application location#

In this article, you will learn how easy it is to deploy a self-hosted managed Odoo Data Application on an EC2 instance.

Signup#

If you do not have an Ametnes Cloud account, sign up here to create one.

Set up an Ametnes Data Application Location#

Create your EC2 Instance.#

In your AWS Console.

  1. On the left menu, click the Instances link.
  2. On the top right, click Launch Instances.
  3. Enter the following information.
    1. Name: ADAL-Test
    2. Under Quick Start select : Ubuntu.
    3. Under Instance Type select : t2-large (or the equivalent of 2vCPU and 8GB RAM in your region).
    4. Select your key pair or create one.
    5. Select or create a security group allowing SSH and HTTPS traffic.
    6. Configure storage for 100Gb.
  4. Click Launch Instance

Configure the EC2 instance as Data Application Location#

Setup your EC2 instance#

Login into your ec2 instance with

ssh -i /path/to/your/private-key.pem ubuntu@<your.ec2.public.ip>

Create the setup script

setup-location.sh
1
2
3
4
5
6
7
8
9
cat > setup-location.sh<<EOF
ip_address="\$1"
location_uuid="\$2"

curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" sh -s - --disable traefik --node-external-ip "\${ip_address}"
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
helm repo add ametnes https://ametnes.github.io/helm && helm repo update
helm upgrade --kubeconfig=/etc/rancher/k3s/k3s.yaml --install --create-namespace --namespace ametnes-system ametnes-cloud-agent ametnes/cloud-agent --set agent.config.location="\${location_uuid}"
EOF

Location UUID#

In your Ametnes Cloud console account, get the default Application Location with

  1. Login into your Ametnes Cloud account here.
  2. Navigate to the Service Locations menu on the left
  3. Copy the default location's UUID

Configure the location#

bash ./setup-location.sh <your.ec2.public.ip> <location-uuid>

After a short while, the Data Application location should come online in your Ametnes Cloud account.

Create the service#

In your Ametnes console.

  1. Using the Services left menu link, navigate to the service management dashboard.
  2. Click New Service.
  3. Enter the Odoo to filter from the list and select Create
  4. In the displayed form, enter the following info.
    1. Enter the Name: Odoo-Service-DSL1 and Description: Odoo-Service-DSL1.
    2. Select a Version from the list.
    3. Select the Location: Default/Location.
    4. Enter your desired password.
    5. Select the Public option.
    6. Click Create.

Test connectivity#

  1. Using the Services left menu, navigate to the service management dashboard. Your service should be listed.

    Service not showing

    If your service list is empty, use the filter at the top right corner, to filter for ALL services.

  2. After a while, your Data Application status will change to ready.

  3. To the right of your service, click the Admin button and you will navigate to your service's details page.
  4. At the bottom of the page, copy the endpoint of your service as well as your username/key and password.
  5. In your browser, paste the URL https://<your.instance.host.name>/.
  6. Login with: Your Ametnes Cloud account email, your configured password.

    EC2 Elastic IP Addresses

    If you restart an EC2 instance, AWS will likely assign it a different public IP address. Connectivity to your Odoo instancess will fail since your Odoo instance would have been assigned a DNS name mapped to your previous IP address. To get around this, allocate an Elastic IP address and assign it to your EC2 instance before you run the setup-location.sh script.

Clean up#

Delete all services#

  1. In your Ametnes Cloud console, navigate to the Admin section of each service
  2. Delete the service.

Summary#

In this post, we explored how to set up your local workstation as an Ametnes Data Application location. This then allowed us to deploy a Odoo service that we were able to connect to.