This repository demonstrates how to deploy applications using the pdeploy
system. It includes:
- A simple Go web server (
main.go
) that echoes back the incoming HTTP request details. - A standard
kennethreitz/httpbin
service for testing HTTP requests.
Both services are defined in the docker-compose.yml
file and are configured for discovery by a Traefik reverse proxy running on the pdeploy
host.
pdeploy
simplifies deployment onto a Linux host running Docker and Traefik. It leverages Git for deployment triggers.
-
Add the pdeploy remote: Replace
<repo_name>
with your desired repository name on the pdeploy server (e.g.,pdeploy-test
).git remote add pdeploy pdeploy:<repo_name>.git
-
Push to deploy: Pushing to the
main
branch triggers the deployment process.git push pdeploy main
What happens during deployment:
- The push is received by the
pdeploy
server. - A Git repository is created or updated at
/repos/<repo_name>.git
. - A post-receive hook clones the repository to
/projects/<repo_name>
. docker compose up --build --remove-orphans -d
is executed within/projects/<repo_name>
, building theecho
service image (usingDockerfile
) and starting both services.- Build and deployment logs are streamed back to your Git client.
Once deployed, the services are accessible via the Traefik proxy based on the labels in docker-compose.yml
:
- Echo Service:
http://echo-antonio.pdeploy.mik.qa
- HTTPBin Service:
http://http-antonio.pdeploy.mik.qa
(Note: Replace antonio
with your username if applicable, based on the pdeploy
server's routing configuration: *-user.pdeploy.mik.qa
)
You can manage the running containers via SSH:
-
SSH into the project directory:
ssh <repo_name>@pdeploy
This logs you directly into the
/projects/<repo_name>
directory on the server. -
Run docker-compose commands remotely:
# View running services ssh <repo_name>@pdeploy ps # Stop services ssh <repo_name>@pdeploy down # Start services ssh <repo_name>@pdeploy up -d # View logs ssh <repo_name>@pdeploy logs -f
-
SSH into the root projects directory:
ssh pdeploy
This logs you into
/projects
.