-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: szaimen <[email protected]>
- Loading branch information
Showing
10 changed files
with
147 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
.build/digitalocean/files/var/lib/cloud/scripts/per-instance/001_onboot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
# Remove the ssh force logout command | ||
sed -e '/Match User root/d' \ | ||
-e '/.*ForceCommand.*droplet.*/d' \ | ||
-i /etc/ssh/sshd_config | ||
|
||
systemctl restart ssh | ||
|
||
# Install Nextcloud AIO | ||
sudo docker run -d \ | ||
--name nextcloud-aio-mastercontainer \ | ||
--restart always \ | ||
-p 80:80 \ | ||
-p 8080:8080 \ | ||
-p 8443:8443 \ | ||
-e NEXTCLOUD_MOUNT=/mnt/ \ | ||
-e NEXTCLOUD_DATADIR=/mnt/ncdata \ | ||
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \ | ||
--volume /var/run/docker.sock:/var/run/docker.sock:ro \ | ||
nextcloud/all-in-one:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"variables": { | ||
"do_token": "{{env `DIGITALOCEAN_TOKEN`}}", | ||
"image_name": "nextcloud-20-04-snapshot-{{timestamp}}", | ||
"apt_packages": "software-properties-common ufw", | ||
"application_name": "Nextcloud", | ||
"application_version": "1.0.0" | ||
}, | ||
"sensitive-variables": ["do_token"], | ||
"builders": [ | ||
{ | ||
"type": "digitalocean", | ||
"api_token": "{{user `do_token`}}", | ||
"image": "ubuntu-20-04-x64", | ||
"region": "nyc3", | ||
"size": "s-1vcpu-1gb", | ||
"ssh_username": "root", | ||
"snapshot_name": "{{user `image_name`}}" | ||
} | ||
], | ||
"provisioners": [ | ||
{ | ||
"type": "shell", | ||
"inline": [ | ||
"cloud-init status --wait" | ||
] | ||
}, | ||
{ | ||
"type": "file", | ||
"source": "files/var/", | ||
"destination": "/var/" | ||
}, | ||
{ | ||
"type": "shell", | ||
"environment_vars": [ | ||
"DEBIAN_FRONTEND=noninteractive", | ||
"LC_ALL=C", | ||
"LANG=en_US.UTF-8", | ||
"LC_CTYPE=en_US.UTF-8" | ||
], | ||
"inline": [ | ||
"apt -qqy update", | ||
"apt -qqy -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' full-upgrade", | ||
"apt -qqy -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install {{user `apt_packages`}}", | ||
"apt-get -qqy clean" | ||
] | ||
}, | ||
{ | ||
"type": "shell", | ||
"environment_vars": [ | ||
"application_name={{user `application_name`}}", | ||
"application_version={{user `application_version`}}", | ||
"DEBIAN_FRONTEND=noninteractive", | ||
"LC_ALL=C", | ||
"LANG=en_US.UTF-8", | ||
"LC_CTYPE=en_US.UTF-8" | ||
], | ||
"scripts": [ | ||
"scripts/01-nextcloud-aio.sh", | ||
"scripts/02-ufw.sh", | ||
"scripts/03-force-ssh-logout.sh", | ||
"scripts/90-cleanup.sh", | ||
"scripts/99-img-check.sh" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The Digital Ocean build was created following https://marketplace.digitalocean.com/vendors#:~:text=how%20to%20list%20your%201-click%20application%20on%20the%20digitalocean%20marketplace and https://github.com/digitalocean/marketplace-partners#getting-started-creating-your-droplet-based-1-click-app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/bash | ||
|
||
# Install docker | ||
curl -fsSL get.docker.com | sudo sh | ||
|
||
# Adjust permissions | ||
sudo mkdir -p /mnt/ncdata | ||
sudo chown -R 33:0 /mnt/ncdata | ||
|
||
# Get Nextcloud AIO | ||
sudo docker pull nextcloud/all-in-one:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
ufw limit ssh | ||
ufw allow http | ||
ufw allow https | ||
ufw allow 3478/tcp | ||
ufw allow 3478/udp | ||
ufw allow 8080/tcp | ||
ufw allow 8443/tcp | ||
|
||
ufw --force enable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
curl -fsSL https://raw.githubusercontent.com/digitalocean/marketplace-partners/master/scripts/03-force-ssh-logout.sh | sudo bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
curl -fsSL https://raw.githubusercontent.com/digitalocean/marketplace-partners/master/scripts/90-cleanup.sh | sudo bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
curl -fsSL https://raw.githubusercontent.com/digitalocean/marketplace-partners/master/scripts/99-img-check.sh | sudo bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The Linode build files are here: https://github.com/linode/Marketplace-Apps/tree/master/Nextcloud. They were created following https://www.linode.com/de/marketplace/app-partners/#submit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Publish to Digital Ocean | ||
|
||
on: | ||
workflow_dispatch: | ||
branches: [ main ] | ||
|
||
jobs: | ||
publish_to_digitalocean: | ||
runs-on: ubuntu-latest | ||
name: Publish image to Digital Ocean | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Packer | ||
run: | | ||
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - | ||
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | ||
sudo apt-get update && sudo apt-get install packer | ||
packer --version | ||
- name: Create Image | ||
run: | | ||
cd ./build/digitalocean | ||
chmod +x -R ./files/var/lib/cloud/scripts | ||
export DIGITALOCEAN_TOKEN=${{ secrets.DIGITALOCEAN_TOKEN }} | ||
packer validate marketplace-image.json | ||
packer build marketplace-image.json |