-
Notifications
You must be signed in to change notification settings - Fork 6
feat: Scaleway Serverless Containers deployment setup #349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b6db2c5
feat: Scaleway deployment setup with CLI script, Caddy proxy and GitH…
kaaloo 78bf62d
feat: switch to scaleway container registry for deployment
kaaloo 73237a0
chore: add dotenv-linter to pre-commit and CI
kaaloo ec0ed57
chore: fix order of other env vars and keep SCW suppressed
kaaloo 41c7f61
Quote variables in scw commands to avoid word-splitting/globbing
kaaloo 109e806
Install gnupg to fix gpg --dearmor failure
kaaloo e9bac4e
Add a jq dependency check
kaaloo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,8 @@ | ||
| :8080 { | ||
| handle_path /api/* { | ||
| reverse_proxy localhost:8000 | ||
| } | ||
| handle { | ||
| reverse_proxy localhost:3000 | ||
| } | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,75 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| # Configuration | ||
| CONTAINER_NAME="evalap" | ||
| REGION="fr-par" | ||
|
|
||
| # Get Scaleway Registry endpoint | ||
| echo "🔍 Fetching Scaleway Registry endpoint for namespace 'evalap'..." | ||
| REGISTRY_ENDPOINT=$(scw registry namespace list region=$REGION -o json | jq -r '.[] | select(.name == "evalap") | .endpoint') | ||
|
|
||
| if [ -z "$REGISTRY_ENDPOINT" ]; then | ||
| echo "❌ Error: Scaleway Registry namespace 'evalap' not found in region $REGION." | ||
| echo "Current namespaces:" | ||
| scw registry namespace list region=$REGION | ||
| exit 1 | ||
| fi | ||
|
|
||
| IMAGE_NAME="${REGISTRY_ENDPOINT}/${CONTAINER_NAME}" | ||
| IMAGE_TAG=$(git rev-parse --short HEAD) | ||
|
|
||
| # Check dependencies | ||
| if ! command -v scw &> /dev/null; then | ||
| echo "Error: scw CLI is not installed." | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! command -v docker &> /dev/null; then | ||
| echo "Error: docker is not installed." | ||
| exit 1 | ||
| fi | ||
|
kaaloo marked this conversation as resolved.
|
||
|
|
||
| if ! command -v jq &> /dev/null; then | ||
| echo "Error: jq is not installed." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "🚀 Starting deployment of $CONTAINER_NAME to Scaleway ($REGION)" | ||
|
|
||
| # 1. Build the production image | ||
| echo "📦 Building production Docker image..." | ||
| docker build --platform linux/amd64 -t "${IMAGE_NAME}:${IMAGE_TAG}" . | ||
|
|
||
| # 2. Login to Scaleway Registry | ||
| echo "🔐 Logging in to Scaleway Registry..." | ||
| scw registry login | ||
|
|
||
| # 3. Push to Registry | ||
| echo "⬆️ Pushing image to $IMAGE_NAME:$IMAGE_TAG..." | ||
| docker push "${IMAGE_NAME}:${IMAGE_TAG}" | ||
|
|
||
| # 4. Find Scaleway Container ID | ||
| echo "🔍 Searching for container named '$CONTAINER_NAME'..." | ||
| CONTAINER_ID=$(scw container container list region=$REGION name=$CONTAINER_NAME -o json | jq -r '.[0].id') | ||
|
|
||
| if [ "$CONTAINER_ID" == "null" ] || [ -z "$CONTAINER_ID" ]; then | ||
| echo "❌ Error: Container '$CONTAINER_NAME' not found in region $REGION." | ||
| echo "Please create the container first in the Scaleway Console or via Terraform." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "✅ Found container ID: $CONTAINER_ID" | ||
|
|
||
| # 5. Update and Deploy | ||
| echo "🔄 Updating container with new image..." | ||
| scw container container update "$CONTAINER_ID" \ | ||
| region=$REGION \ | ||
| registry-image="${IMAGE_NAME}:${IMAGE_TAG}" \ | ||
| port=8080 | ||
|
|
||
| echo "🚀 Triggering deployment..." | ||
| scw container container deploy "$CONTAINER_ID" region=$REGION | ||
|
|
||
| echo "✨ Deployment triggered successfully!" | ||
| echo "Check the status at: https://console.scaleway.com/containers/containers/$REGION/$CONTAINER_ID" | ||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.