By spendlove
I want to have a test environment setup, like test.example.com, so my team can test code changes made by the frontend and backend developers. I did a search in the tutorial section for “test environment” and was surprised to find zero results. Our setup is going to make use of Docker too.
Thank you for any suggestions.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
Indeed, setting up a test environment for your team is a great way to ensure code quality and stability before deploying changes to production.
Here are some general steps that you can take on how to set up a test environment with a custom domain, such as using DigitalOcean and Docker:
Create a new Git branch for testing: Create a separate Git branch for your testing environment, such as test or staging. This branch should contain the latest code changes your team wants to test. Make sure to keep this branch updated with changes from the main development branches.
Configure Docker: Make sure you have a Dockerfile and a docker-compose.yml file in your project to define your application’s container setup. This will allow you to create a consistent environment for testing and deploying your application.
Set up a test environment on DigitalOcean: Create a new DigitalOcean Droplet to host your test environment. You can use a pre-built Docker image or install Docker manually on the Droplet. Once Docker is installed and running, clone your project’s Git repository onto the Droplet and checkout the test branch.
Deploy your application: Run your application using Docker Compose with the command docker-compose up -d. This will create and start the necessary containers based on your docker-compose.yml file.
Configure your custom domain: Add an A record for the subdomain test.example.com in your domain’s DNS settings, pointing to the IP address of your test environment Droplet. This may take some time to propagate.
Set up SSL: If you want to secure your test environment with HTTPS, you can use a service like Let’s Encrypt to obtain an SSL certificate for your custom domain.
An alternative option is to use the DigitalOcean App platform, that way you will not have to manually setup and maintain your server but you could just deploy your test or staging branches directly to the App Platform.
Let me know if you have any questions!
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.