#guide #server #aws #caddy #docker #docker-compose #documentation
- Spin up an EC2 instance on AWS in the desired region.
- Select ubuntu and leave the default options
- Select your Instance Type based on what you are needing. A t2 small should be more than enough. t2 micro would be fine for very basic use though
- Proceed without a key pair - need to research this later and make sure it's not like super insecure. I don't think it is though for this use case.
- In Network settings make sure to select the following:
- allow ssh traffic from anywhere
- allow https traffic from the internet
- allow http traffic from the internet
- Default volume settings should be enough
- Click on Launch Instance
- The instance will boot up then it will be time to install docker-compose, docker, and caddy
- run
sudo apt update
andsudo apt upgrade
- Follow the instructions here to install docker https://docs.docker.com/engine/install/ubuntu/
- Follow these commands to install docker compose replace
2.14.2
with whatever version is on their GitHub page in the versions section: https://github.com/docker/compose
sudo apt update
sudo curl -L "https://github.com/docker/compose/releases/download/2.14.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo apt upgrade -y
- Go to your DNS provider and add an A record pointing to the EC2 public IP address.
Type: A
Name: n8n (or the desired subdomain)
IP address: <IP_OF_YOUR_SERVER>
- Run this command to get the files for using caddy. This gives you files for a quick start on getting this setup.
git clone https://github.com/bruddlee/n8n-docker-caddy
- Then run
cd n8n-docker-caddy
or change directory (cd) into whatever the name of the repo is that was cloned - Create a docker volume for the caddy_data
docker volume create caddy_data
- run
nano .env
- follow the comments in the file to change out the credentials for the database, the credentials for the n8n instance, your domain name, and the credentials for the email you will be using to send out the invitations and password reset emails for users of the n8n instance.
- Run
nano caddy_config/Caddyfile
- In this file replace domain and suffix with yourwebsite.com or whatever your website name is. If you didn't opt for using n8n as the subdomain, then change that as well. Yours should look something like this when completed:
n8n.test.com {
reverse_proxy n8n:5678 {
flush_interval -1
}
}
- Now you should be able to run the command
docker-compose up -d
to build your container and get it up and running. - In your web browser open up the URL that you setup the instance to run on and see what happens. Enter the user name and password you defined in the .env file for the variables for
N8N_BASIC_AUTH_USER
andN8N_BASIC_AUTH_PASSWORD
Once you do that you are all set to go.
- I've successfully got an n8n instance working on aws with email smtp using gmail and without any trouble. I just used docker compose and followed there instructions. Now to try and do it in queue mode to get that to function more reliably when things are very high volume
- Steps to get this working:
- in admin.google.com go to security -> Less secure apps -> allow users to enable
- then go into manage my google account when you are logged into gmail in the top right, then security then less secure apps enabled.
- This is good for temp purposes, but I am going to look for a more secure long term solution to this.
- Steps to get this working: