Skip to content

Commit c343ede

Browse files
committed
VPS name is configurable
1 parent ad14950 commit c343ede

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,27 @@ jobs:
6060

6161
- name: Create VPS if it doesn't exist
6262
run: |
63-
if ! doctl compute droplet list | grep -q 'mautic-vps'; then
64-
doctl compute droplet create mautic-vps --image docker-20-04 --size s-1vcpu-1gb --region nyc1 --ssh-keys ${{ secrets.DIGITALOCEAN_SSH_FINGERPRINT }} --wait --user-data-file setup-vps.sh --enable-monitoring
63+
VPS_NAME="${{ vars.VPS_NAME || 'mautic-vps' }}"
64+
echo "Using VPS name: $VPS_NAME"
65+
if ! doctl compute droplet list | grep -q "$VPS_NAME"; then
66+
doctl compute droplet create "$VPS_NAME" --image docker-20-04 --size s-1vcpu-1gb --region nyc1 --ssh-keys ${{ secrets.DIGITALOCEAN_SSH_FINGERPRINT }} --wait --user-data-file setup-vps.sh --enable-monitoring
6567
echo "droplet_created=true" >> $GITHUB_ENV
6668
else
67-
echo "Droplet 'mautic-vps' already exists."
69+
echo "Droplet '$VPS_NAME' already exists."
6870
echo "droplet_created=true" >> $GITHUB_ENV
6971
fi
72+
echo "vps_name=$VPS_NAME" >> $GITHUB_ENV
7073
7174
- name: Get VPS IP
7275
run: |
76+
VPS_NAME="${{ vars.VPS_NAME || 'mautic-vps' }}"
7377
echo "Waiting for droplet to be ready..."
7478
while : ; do
7579
echo "."
7680
sleep 2
77-
STATUS=$(doctl compute droplet get mautic-vps --format Status --no-header)
81+
STATUS=$(doctl compute droplet get "$VPS_NAME" --format Status --no-header)
7882
if [ "$STATUS" = "active" ]; then
79-
IP=$(doctl compute droplet get mautic-vps --format PublicIPv4 --no-header)
83+
IP=$(doctl compute droplet get "$VPS_NAME" --format PublicIPv4 --no-header)
8084
if [ -n "$IP" ]; then
8185
echo "Droplet is active. IP address: $IP"
8286
break

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ The variables are values that is OK to be visible. You can edit the vaule after
6565

6666
- `EMAIL_ADDRESS` will be used to create a Mautic admin user and you'll use it to log in. It is also used to build the SSL certificates.
6767
- `DOMAIN` is the domain that will be used to access your Mautic. Do not add it at first. Add it only after you know the VPS IP address and after you've pointed the DNS record to that IP address. If the DOMAIN is unknown, you can still access your new Mautic via the IP address.
68+
- `VPS_NAME` (optional) - customize the name of your DigitalOcean droplet. Defaults to `mautic-vps` if not set. Useful if you want to run multiple instances or use a custom naming convention.
6869

6970
Example:
7071
![Github Actions Variables](https://github.com/escopecz/docker-compose-mautic/assets/1235442/bfc5df49-55b0-4a1d-a8ee-181429bdf244)

0 commit comments

Comments
 (0)