Question

Deploy with wagtail

Posted September 16, 2021 101 views
DockerDjangoDeployment

New to DO, I try to deploy a dev app with Wagtail(django) and Docker-Compose.

I work on windows 10. Also, I can run DOCTL commands from PowerShell.

Mainly I struggle to find a workflow to link my application to DO.

I tried to follow tutorials django-docker  which 
After:
set DIGITALOCEANACCESSTOKEN=[yourdigitaloceantoken]

Propose to create a new Droplet with Docker pre-installed … but with a code:

curl -X POST \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer '$DIGITAL_OCEAN_ACCESS_TOKEN'' \ -d '{"name":"django-docker","region":"sfo3","size":"s-2vcpu-4gb","image":"docker-20-04"}' \ "https://api.digitalocean.com/v2/droplets"

This code is rather confusing for me, as when I access docker-pre-installed I can only create droplets, preferably by selecting Docker from Marketplace or with Ubunto18. I don’t note any shell and the console option appears only after the droplet was already created.

Also confusing is how to run the curl command. I didn’t find it in the DOCTL commands.

Since, I didn’t manage, I tried to jump over this phase by simply setting SSL and create a droplet with docker settings. Which worked just fine.

Next I run:

cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa

I closed and opened a new shell to run:

set PRIVATE_KEY='....'

Next I run: .

ssh-add - <<< "${PRIVATE_KEY}"

and got “`
"Missing file specification after redirection operator.
At line:1 char:11”


The above is the last code line before I can upload source code and create an image. 
Any tip on how I should proceed would be highly appreciated. 

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hello,

Can you confirm which tutorial exactly were you following? I could try to replicate the problem at my end.

Regarding the curl command, it is an HTTP client that is available on most UNIX-based systems. I’m not 100% sure if it is available on PowerShell. It allows you to make HTTP calls. What the command that you’ve shared does is to the DigitalOcean API and all that it does is to create a new Droplet. This could also be done via the DigitalOcean Control panel as well:

https://docs.digitalocean.com/products/droplets/how-to/create/

And also could be done with the doctl command-line tool:

https://docs.digitalocean.com/reference/doctl/reference/compute/droplet/create/

I believe that the main problem that you are facing is that the commands that you’ve shared are intended to be executed on UNIX-based systems however you are running Windows and PowerShell.

What I could suggest is, if you are using Windows, you could install WSL2 so that you could have a local Linux environment, where the commands that you’ve shared would work as expected.

You can take a look at this step by step tutorial here on how to install WSL2:

https://www.digitalocean.com/community/tutorials/how-to-install-the-windows-subsystem-for-linux-2-on-microsoft-windows-10

Regards,
Bobby

by Mason Egger
The Windows Subsystem for Linux 2 is a tool on Microsoft Windows 10 that allows developers to run a Linux environment directly on Windows without any modifications, secondary Virtual Machine software, or dual-boot setups. In this tutorial you'll enable the WSL, install Ubuntu 20.04 onto your workstation using the WSL, and install Microsoft's new Windows Command Line to access your Ubuntu 20.04 installation. This will provide you with a Linux programming environment that is native to Windows.