Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
/rust/x509/ @dfinity/consensus

/svelte/svelte-motoko-starter/ @dfinity/sdk
/svelte/svelte-starter/ @dfinity/sdk
/svelte/sveltekit-starter/ @dfinity/sdk

/wasm/counter @dfinity/languages
20 changes: 12 additions & 8 deletions .github/workflows/hosting-photo-storage-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,33 @@ jobs:
- uses: actions/checkout@v1
- name: Provision Darwin
run: bash .github/workflows/provision-darwin.sh
- name: Pre-download network launcher
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bash .github/workflows/pre-download-launcher.sh
- name: Hosting Photo Storage Darwin
run: |
pushd hosting/photo-storage
# verify frontend deps install and build
npm install
npm run build
# verify that frontend asset canister deploys
dfx start --background
dfx deploy
icp network start -d
icp deploy
popd
hosting-photo-storage-linux:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
- name: Provision Linux
run: bash .github/workflows/provision-linux.sh
- name: Pre-download network launcher
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bash .github/workflows/pre-download-launcher.sh
- name: Hosting Photo Storage Linux
run: |
pushd hosting/photo-storage
# verify frontend deps install and build
npm install
npm run build
# verify that frontend asset canister deploys
dfx start --background
dfx deploy
icp network start -d
icp deploy
popd
18 changes: 13 additions & 5 deletions .github/workflows/hosting-static-website-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,35 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
hosting-unity-static-website-darwin:
hosting-static-website-darwin:
runs-on: macos-15
steps:
- uses: actions/checkout@v1
- name: Provision Darwin
run: bash .github/workflows/provision-darwin.sh
- name: Pre-download network launcher
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bash .github/workflows/pre-download-launcher.sh
- name: Hosting Static Website Darwin
run: |
dfx start --background
pushd hosting/static-website
dfx deploy
icp network start -d
icp deploy
popd
hosting-static-website-linux:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
- name: Provision Linux
run: bash .github/workflows/provision-linux.sh
- name: Pre-download network launcher
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bash .github/workflows/pre-download-launcher.sh
- name: Hosting Static Website Linux
run: |
dfx start --background
pushd hosting/static-website
dfx deploy
icp network start -d
icp deploy
popd
18 changes: 13 additions & 5 deletions .github/workflows/hosting-unity-webgl-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- master
pull_request:
paths:
- motoko/unity-webgl-template/**
- hosting/unity-webgl-template/**
- .github/workflows/provision-darwin.sh
- .github/workflows/provision-linux.sh
- .github/workflows/hosting-unity-webgl-example.yaml
Expand All @@ -20,21 +20,29 @@ jobs:
- uses: actions/checkout@v1
- name: Provision Darwin
run: bash .github/workflows/provision-darwin.sh
- name: Pre-download network launcher
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bash .github/workflows/pre-download-launcher.sh
- name: Hosting Unity Webgl Darwin
run: |
dfx start --background
pushd hosting/unity-webgl-template
dfx deploy
icp network start -d
icp deploy
popd
hosting-unity-webgl-linux:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
- name: Provision Linux
run: bash .github/workflows/provision-linux.sh
- name: Pre-download network launcher
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bash .github/workflows/pre-download-launcher.sh
- name: Hosting Unity Webgl Linux
run: |
dfx start --background
pushd hosting/unity-webgl-template
dfx deploy
icp network start -d
icp deploy
popd
41 changes: 41 additions & 0 deletions .github/workflows/pre-download-launcher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
# Pre-download the icp-cli network launcher to avoid GitHub API rate limits.
# icp-cli v0.1.0 doesn't support ICP_CLI_GITHUB_TOKEN yet, so `icp network start`
# hits the unauthenticated GitHub API rate limit (60 req/hr) when fetching the
# latest launcher version. This script uses the authenticated `gh` CLI to get
# the version, downloads the binary directly, and sets ICP_CLI_NETWORK_LAUNCHER_PATH
# so icp-cli skips the API call entirely.
#
# Requires: GH_TOKEN env var (for authenticated GitHub API access via gh CLI)
#
# This workaround can be removed once icp-cli supports ICP_CLI_GITHUB_TOKEN.
set -ex

VERSION=$(gh release view --repo dfinity/icp-cli-network-launcher --json tagName -q .tagName)

ARCH=$(uname -m)
case "$ARCH" in
arm64|aarch64) ARCH="arm64" ;;
x86_64) ARCH="x86_64" ;;
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
esac

OS=$(uname -s)
case "$OS" in
Darwin) OS="darwin" ;;
Linux) OS="linux" ;;
*) echo "Unsupported OS: $OS"; exit 1 ;;
esac

TARBALL="icp-cli-network-launcher-${ARCH}-${OS}-${VERSION}"
URL="https://github.com/dfinity/icp-cli-network-launcher/releases/download/${VERSION}/${TARBALL}.tar.gz"

LAUNCHER_DIR="$HOME/.icp-cli-launcher"
mkdir -p "$LAUNCHER_DIR"
curl -sL "$URL" | tar xz -C "$LAUNCHER_DIR"

LAUNCHER_PATH="${LAUNCHER_DIR}/${TARBALL}/icp-cli-network-launcher"
chmod +x "$LAUNCHER_PATH"

echo "ICP_CLI_NETWORK_LAUNCHER_PATH=${LAUNCHER_PATH}" >> "$GITHUB_ENV"
echo "Network launcher ${VERSION} downloaded to ${LAUNCHER_PATH}"
6 changes: 6 additions & 0 deletions .github/workflows/provision-darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ curl --location --output node.pkg "https://nodejs.org/dist/v$version/node-v$vers
sudo installer -pkg node.pkg -store -target /
rm node.pkg

# Install icp-cli
npm install -g @icp-sdk/icp-cli @icp-sdk/ic-wasm

# Install ic-mops (for Motoko projects)
npm install -g ic-mops

# Install DFINITY SDK.
curl --location --output install-dfx.sh "https://raw.githubusercontent.com/dfinity/sdk/master/public/install-dfxvm.sh"
DFX_VERSION=${DFX_VERSION:=0.30.2} DFXVM_INIT_YES=true bash install-dfx.sh
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/provision-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ sudo bash nodesource_setup.sh
sudo apt-get install --yes nodejs
rm nodesource_setup.sh

# Install icp-cli
npm install -g @icp-sdk/icp-cli @icp-sdk/ic-wasm

# Install ic-mops (for Motoko projects)
npm install -g ic-mops

# Install DFINITY SDK.
wget --output-document install-dfx.sh "https://raw.githubusercontent.com/dfinity/sdk/master/public/install-dfxvm.sh"
DFX_VERSION=${DFX_VERSION:=0.30.2} DFXVM_INIT_YES=true bash install-dfx.sh
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.dfx/
**/.icp/cache/
build/
node_modules/
package-lock.json
dist/
.DS_Store
_MACOSX
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
path = archive/c/qr/QR-Code-generator
url = https://github.com/nayuki/QR-Code-generator
branch = fd6917601d0a77b6b6df81599118212d8cdb9a27
[submodule "svelte/svelte-starter/internet-identity"]
path = svelte/svelte-starter/internet-identity
url = https://github.com/dfinity/internet-identity.git
[submodule "svelte/svelte-motoko-starter/internet-identity"]
path = svelte/svelte-motoko-starter/internet-identity
url = https://github.com/dfinity/internet-identity.git
Expand Down
39 changes: 21 additions & 18 deletions hosting/godot-html5-template/README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
---
keywords: [html5, html, godot, hosting, host a website, beginner]
---

# Godot HTML5 sample

[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/hosting/godot-html5-template)

## Overview
The example shows how to deploy a Godot HTML5 build on the IC in an asset canister. The Godot HTML5 build is deployed as frontend, no backend is needed in this sample.

This example project can be cloned, installed, and deployed locally, for learning and testing purposes. The instructions are based on running the example on either macOS or Linux, but when using WSL2 on Windows, the instructions will be the same.
The example shows how to deploy a Godot HTML5 build on ICP in an asset canister. The Godot HTML5 build is deployed as frontend, no backend is needed in this sample.

## Prerequisites
## Project structure

This example requires an installation of:
The `/frontend` folder contains the pre-built Godot HTML5 export. The frontend is deployed as an asset canister.

- [x] Install the [IC SDK](https://internetcomputer.org/docs/current/developer-docs/setup/install/).
## Prerequisites

- [x] Download and install [git](https://git-scm.com/downloads).
- [x] Install [icp-cli](https://cli.icp.build): `npm install -g @icp-sdk/icp-cli @icp-sdk/ic-wasm`

## Install

Clone the example dapp project:
Clone the example project:

```bash
git clone https://github.com/dfinity/examples
cd examples/hosting/godot-html5-template
```

## Deployment
The local replica is started by running this command:

Start the local network:

```bash
dfx start --background
icp network start -d
```

When the local replica is up and running, run this command to deploy the canisters:
Deploy the canisters:

```bash
dfx deploy
icp deploy
```

The URL for the frontend depends on the canister ID. When deployed, the URL will look like this:

```
http://{canister_id}.localhost:8000
```

If you get error code 500 after deploying to the IC mainnet, try to use `raw` keyword in the URL like this: `https://<canister-id>.raw.ic0.app`.
Stop the local network when done:

## License
This project is licensed under the Apache 2.0 license, see `LICENSE.md` for details. See `CONTRIBUTE.md` for details about how to contribute to this project.
```bash
icp network stop
```
15 changes: 0 additions & 15 deletions hosting/godot-html5-template/dfx.json

This file was deleted.

10 changes: 10 additions & 0 deletions hosting/godot-html5-template/icp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
canisters:
- name: godot_html5_assets
recipe:
type: "@dfinity/asset-canister@v2.1.0"
configuration:
dir: dist
build:
- mkdir -p dist
- cp -r src/godot_html5_assets/assets/* dist/
- cp -r src/godot_html5_assets/src/* dist/
Loading
Loading