Guides
Apps
- Introduction to Apps
- Image
- Direct Docker Image Deploy
- Dockerfile Deploy
- Build Context
- Accessing Configuration variables during the Docker build
- Dockerfile
- Migrating from Direct Docker Image Deploy to Dockerfile Deploy
- Private Base Images
- Configuration
- Services
- Releases
- Scaling
- Ephemeral SSH Sessions
- Git Remote
- .aptible.yml
- Security Scans
- Deprovisioning an App
- Deployment with CI/CD
Endpoints
Databases
Containers
Stacks
CLI
- Aptible CLI
- aptible apps
- aptible apps:create
- aptible apps:deprovision
- aptible apps:rename
- aptible apps:scale
- aptible backup:list
- aptible backup:orphaned
- aptible backup:purge
- aptible backup:restore
- aptible config
- aptible config:add
- aptible config:rm
- aptible config:set
- aptible config:unset
- aptible db:backup
- aptible db:clone
- aptible db:create
- aptible db:deprovision
- aptible db:dump
- aptible db:execute
- aptible db:list
- aptible db:modify
- aptible db:reload
- aptible db:rename
- aptible db:replicate
- aptible db:restart
- aptible db:tunnel
- aptible db:url
- aptible db:versions
- aptible deploy
- aptible domains
- aptible endpoints:database:create
- aptible endpoints:database:modify
- aptible endpoints:deprovision
- aptible endpoints:https:create
- aptible endpoints:https:modify
- aptible endpoints:list
- aptible endpoints:renew
- aptible endpoints:tcp:create
- aptible endpoints:tcp:modify
- aptible endpoints:tls:create
- aptible endpoints:tls:modify
- aptible environment:ca_cert
- aptible environment:list
- aptible environment:rename
- aptible help
- aptible log_drain:create:datadog
- aptible log_drain:create:elasticsearch
- aptible log_drain:create:https
- aptible log_drain:create:logdna
- aptible log_drain:create:papertrail
- aptible log_drain:create:sumologic
- aptible log_drain:create:syslog
- aptible log_drain:deprovision
- aptible log_drain:list
- aptible login
- aptible logs
- aptible logs_from_archive
- aptible metric_drain:create:datadog
- aptible metric_drain:create:influxdb
- aptible metric_drain:create:influxdb:custom
- aptible metric_drain:deprovision
- aptible metric_drain:list
- aptible operation:cancel
- aptible operation:follow
- aptible operation:logs
- aptible rebuild
- aptible restart
- aptible services
- aptible ssh
- aptible version
Tutorials
- Application Performance Monitoring
- CI Integration
- Aptible Demo App
- Deploying Grafana
- Direct Docker Image Deploy Example
- Dockerfile Deploy Example
- Exposing a Web App to the Internet
- Using Nginx with Aptible Endpoints
- Quickstart Guides
- Setting up Logging
- Automating Database Migrations
- Dockerfile Caching
- Using Domain Apex with Endpoints
- Accepting File Uploads
- Scheduling Tasks
- Serving Static Assets
- Terraform
- How to test a PostgreSQL Database's schema on a new version
- How to dump and restore PostgreSQL
- How to upgrade PostgreSQL with logical replication
- How to upgrade Redis
- How to upgrade MongoDB
- How to use mysqldump to Test for Upgrade Incompatabilities
- How to dump and restore MySQL
Troubleshooting
- Aptible Support
- App Processing Requests Slowly
- This Application Crashed
- before_release Commands Failed
- Build Failed
- Container Failed to Start
- Certificate Signing Requests
- Deploys Take Too long
- git Reference Error
- git Push "Everything up-to-date."
- HTTP Health Checks Failed
- App Logs Not Being Received
- PostgreSQL Replica max_connections
- Connecting to MongoDB fails
- MySQL Access Denied
- No CMD or Procfile in Image
- git Push Permission Denied
- aptible ssh Permission Denied
- PostgreSQL Incomplete Startup Packet
- PostgreSQL SSL Off
- Private Key Must Match Certificate
- aptible ssh Operation Timed Out
- SSL error ERR_CERT_AUTHORITY_INVALID
- SSL error ERR_CERT_COMMON_NAME_INVALID
- Unexpected Requests in App Logs
Accessing Configuration variables during the Docker build
By design (for better or worse), Docker doesn't allow setting arbitrary environment variables during the Docker build process: that is only possible when running Containers after the Image is built.
The rationale for this is that Dockerfiles should be fully portable and not tied to any specific environment.
A direct consequence of this design is that your Configuration variables, set via aptible config:set
, are not available to commands executed during the Docker build.
It's a good idea to follow Docker best practice and avoid depending on Configuration variables in instructions in your Dockerfile, but if you absolutely need to, Aptible provides a workaround: .aptible.env
.
.aptible.env
When building your image, Aptible injects a .aptible.env
file at the root of your repository prior to running the Docker build. The file contains your Configuration variables, and can be sourced by a shell.
Here's an example:
RAILS_ENV=production
DATABASE_URL=postgresql://user:password@host:123/db
If needed, you can use this file to access environment variables during your build, like this:
# Assume that you've already ADDed your repo:
ADD . /app
WORKDIR /app
# The bundle exec rake assets:precompile command
# will run with your configuration
RUN set -a && . /app/.aptible.env && \
bundle exec rake assets:precompile
❗️ Warning
Do not use the .aptible.env
file outside of Dockerfile instructions.
This file is only injected when your image is built, so changes to your configuration will not be reflected in the .aptible.env
file unless you deploy again or rebuild.
Outside of your Dockerfile, your configuration variables are accessible in the Container Environment.