Skip to content

Commit d6f46d6

Browse files
authored
Initial commit
0 parents  commit d6f46d6

7 files changed

Lines changed: 272 additions & 0 deletions

File tree

.do/app.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: sample-html
2+
static_sites:
3+
- environment_slug: html
4+
github:
5+
branch: main
6+
deploy_on_push: true
7+
repo: digitalocean/sample-html
8+
name: sample-html

.do/deploy.template.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
spec:
2+
name: sample-html
3+
static_sites:
4+
- environment_slug: html
5+
git:
6+
branch: main
7+
repo_clone_url: https://github.com/digitalocean/sample-html.git
8+
name: sample-html

.github/dependabot.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
# borrowed from https://github.com/dependabot/dependabot-core/blob/main/.github/dependabot.yml
6+
7+
version: 2
8+
updates:
9+
- package-ecosystem: "bundler"
10+
directory: "/"
11+
schedule:
12+
interval: "daily"
13+
groups:
14+
dev-dependencies:
15+
dependency-type: "development"
16+
update-types:
17+
- "minor"
18+
- "patch"
19+
- package-ecosystem: "composer"
20+
directory: "/"
21+
schedule:
22+
interval: "daily"
23+
groups:
24+
dev-dependencies:
25+
dependency-type: "development"
26+
update-types:
27+
- "minor"
28+
- "patch"
29+
- package-ecosystem: "docker"
30+
directory: "/"
31+
schedule:
32+
interval: "daily"
33+
- package-ecosystem: "github-actions"
34+
directory: "/"
35+
schedule:
36+
interval: "daily"
37+
- package-ecosystem: "gomod"
38+
directory: "/"
39+
schedule:
40+
interval: "daily"
41+
- package-ecosystem: "mix"
42+
directory: "/"
43+
schedule:
44+
interval: "daily"
45+
- package-ecosystem: "npm"
46+
directory: "/"
47+
schedule:
48+
interval: "daily"
49+
groups:
50+
dev-dependencies:
51+
dependency-type: "development"
52+
update-types:
53+
- "minor"
54+
- "patch"
55+
ignore:
56+
- dependency-name: "npm"
57+
update-types: ["version-update:semver-major"]
58+
- package-ecosystem: "pip"
59+
directory: "/"
60+
schedule:
61+
interval: "daily"
62+
- package-ecosystem: "pub"
63+
directory: "/"
64+
schedule:
65+
interval: "daily"

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git
2+
color.gif

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
## Getting Started
2+
3+
We provide a sample app using HTML that you can deploy on App Platform. These steps will get this sample application running for you using App Platform.
4+
5+
**Note: Following these steps may result in charges for the use of DigitalOcean services.**
6+
7+
### Requirements
8+
9+
* You need a DigitalOcean account. If you don't already have one, you can sign up at https://cloud.digitalocean.com/registrations/new.
10+
11+
## Deploying the App
12+
13+
Click this button to deploy the app to the DigitalOcean App Platform. If you are not logged in, you will be prompted to log in with your DigitalOcean account.
14+
15+
[![Deploy to DigitalOcean](https://www.deploytodo.com/do-btn-blue.svg)](https://cloud.digitalocean.com/apps/new?repo=https://github.com/digitalocean/sample-html/tree/main)
16+
17+
Using this button disables the ability to automatically re-deploy your app when pushing to a branch or tag in your repository as you are using this repo directly.
18+
19+
If you want to automatically re-deploy your app, [fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) the GitHub repository to your account so that you have a copy of it stored to the cloud. Click the **Fork** button in the GitHub repository and follow the on-screen instructions.
20+
21+
After forking the repo, you should now be viewing this README in your own GitHub org (e.g. `https://github.com/<your-org>/sample-html`). To deploy the new repo, visit https://cloud.digitalocean.com/apps and click **Create App**. Then, click **GitHub**, select the repository you created and select the `main` branch. App Platform will inspect the code, automatically detect the kind of component to create, and use the correct buildpack to create and deploy a container.
22+
23+
After clicking the **Deploy to DigitalOcean** button or completing the instructions above to fork the repo, follow these steps:
24+
25+
1. Configure the app such as specifying HTTP routes, environment variables or adding a database.
26+
1. Provide a name for your app and select which region you want to deploy your app to and click **Next**. The closest region to you should be selected by default. All App Platform apps are routed through a global CDN. So this will not affect your app performance, unless it needs to talk to external services.
27+
1. On the following screen, leave all the fields as they are and click **Next**.
28+
1. Confirm your **Plan** settings and how many containers you want to launch and click **Launch Basic/Pro App**.
29+
1. You should see a "Building..." progress indicator. You can click **View Logs** to see more details of the build.
30+
1. It can take a few minutes for the build to finish, but you can follow the progress in the **Deployments** tab.
31+
1. Once the build completes successfully, click the **Live App** link in the header and you should see your running application in a new tab, displaying the home page.
32+
33+
### Making Changes to Your App
34+
35+
If you followed the steps to fork the repo and used your own copy when deploying the app, you can push changes to your fork and see App Platform automatically re-deploy the update to your app. During these automatic deployments, your application will never pause or stop serving request because App Platform offers zero-downtime deployments.
36+
37+
Here's an example code change you can make for this app:
38+
39+
1. Edit code within the repository
40+
1. Commit the change to the `main` branch. Normally it's a better practice to create a new branch for your change and then merge that branch to `main` after review, but for this demo you can commit to the `main` branch directly.
41+
1. Visit https://cloud.digitalocean.com/apps and navigate to your sample app.
42+
1. You should see a "Building..." progress indicator, just like when you first created the app.
43+
1. Once the build completes successfully, click the **Live App** link in the header and you should see your updated application running. You may need to force refresh the page in your browser (e.g. using **Shift+Reload**).
44+
45+
### Learn More
46+
47+
You can learn more about the App Platform and how to manage and update your application at https://www.digitalocean.com/docs/app-platform/.
48+
49+
## Deleting the App
50+
51+
When you no longer need this sample application running live, you can delete it by following these steps:
52+
1. Visit the Apps control panel at https://cloud.digitalocean.com/apps.
53+
2. Navigate to the sample app.
54+
3. In the **Settings** tab, click **Destroy**.
55+
56+
**Note: If you do not delete your app, charges for using DigitalOcean services will continue to accrue.**

color.gif

487 KB
Loading

index.html

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8+
<title>#000000</title>
9+
<link type="image/x-icon" rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAHklEQVQ4T2NkYGD4z0ABYBw1gGE0DBhGw4BhWIQBAE5OEAELnjVHAAAAAElFTkSuQmCC">
10+
<style>
11+
:root {
12+
--color: #000000;
13+
--color-transparent: #00000022;
14+
}
15+
16+
::selection {
17+
background: var(--color-transparent);
18+
}
19+
20+
html,
21+
body {
22+
background: var(--color);
23+
height: 100%;
24+
margin: 0;
25+
}
26+
27+
body {
28+
display: flex;
29+
align-items: center;
30+
justify-content: center;
31+
cursor: pointer;
32+
}
33+
34+
#color {
35+
background: white;
36+
color: var(--color);
37+
font-size: 2.5rem;
38+
font-weight: 300;
39+
padding: 2.25rem 3rem;
40+
font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif;
41+
cursor: text;
42+
}
43+
</style>
44+
</head>
45+
46+
<body>
47+
<p id="color">#000000</p>
48+
<script>
49+
function randomInt(min, max) {
50+
return Math.floor(Math.random() * (max - min + 1) + min);
51+
}
52+
53+
function hslToHex(h, s, l) {
54+
h /= 360;
55+
s /= 100;
56+
l /= 100;
57+
var r = void 0,
58+
g = void 0,
59+
b = void 0;
60+
if (s === 0) {
61+
r = g = b = l; // achromatic
62+
} else {
63+
var hue2rgb = function hue2rgb(p, q, t) {
64+
if (t < 0) t += 1;
65+
if (t > 1) t -= 1;
66+
if (t < 1 / 6) return p + (q - p) * 6 * t;
67+
if (t < 1 / 2) return q;
68+
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
69+
return p;
70+
};
71+
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
72+
var p = 2 * l - q;
73+
r = hue2rgb(p, q, h + 1 / 3);
74+
g = hue2rgb(p, q, h);
75+
b = hue2rgb(p, q, h - 1 / 3);
76+
}
77+
var toHex = function toHex(x) {
78+
var hex = Math.round(x * 255).toString(16);
79+
return hex.length === 1 ? '0' + hex : hex;
80+
};
81+
return '#' + toHex(r) + toHex(g) + toHex(b);
82+
}
83+
84+
window.onload = function () {
85+
let stopProp = function (ev) {
86+
ev.stopPropagation();
87+
}
88+
89+
var colorElement = document.getElementById("color");
90+
colorElement.addEventListener("click", stopProp, false);
91+
colorElement.addEventListener("mousedown", stopProp, false);
92+
93+
var setFavicon = function (hex) {
94+
var canvas = document.createElement('canvas');
95+
canvas.width = 16;
96+
canvas.height = 16;
97+
var ctx = canvas.getContext('2d');
98+
ctx.fillStyle = hex;
99+
ctx.fillRect(0, 0, 16, 16);
100+
document.getElementsByTagName('link')[0].href = canvas.toDataURL("image/x-icon");
101+
}
102+
103+
var setRandomColor = function setRandomColor() {
104+
var h = void 0,
105+
s = void 0,
106+
l = void 0;
107+
108+
h = randomInt(0, 359);
109+
s = randomInt(55, 75);
110+
l = randomInt(40, 60);
111+
112+
document.documentElement.style.setProperty('--color', 'hsl(' + h + ', ' + s + '%, ' + l + '%)');
113+
var hex = hslToHex(h, s, l);
114+
document.title = hex;
115+
colorElement.innerHTML = hex;
116+
document.documentElement.style.setProperty('--color-transparent', hex + '22');
117+
118+
setFavicon(hex);
119+
};
120+
setRandomColor();
121+
122+
var body = document.getElementsByTagName("body")[0];
123+
body.addEventListener("mousedown", function (ev) {
124+
ev.preventDefault();
125+
});
126+
body.addEventListener("click", function () {
127+
setRandomColor();
128+
}, false);
129+
};
130+
</script>
131+
</body>
132+
133+
</html>

0 commit comments

Comments
 (0)