Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoApp committed Jan 4, 2024
1 parent b8e5aba commit 993251f
Show file tree
Hide file tree
Showing 230 changed files with 27,136 additions and 11,353 deletions.
2 changes: 0 additions & 2 deletions .devcontainer/.gitignore

This file was deleted.

53 changes: 39 additions & 14 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
{
"name": "laravel-fresh-install",
"name": "Anythink Development Container",
"image": "public.ecr.aws/v0a2l7y2/wilco/anythink-devcontainer:latest",
"forwardPorts": [3000, 3001, 5433, 27017],
"portsAttributes": {
"3000": {
"label": "Backend",
"elevateIfNeeded": true,
"requireLocalPort": true,
"onAutoForward": "silent"
},
"3001": {
"label": "Frontend",
"elevateIfNeeded": true,
"requireLocalPort": true,
"onAutoForward": "silent"
},
"5433": {
"label": "Database",
"elevateIfNeeded": true,
"requireLocalPort": true,
"onAutoForward": "silent"
},
"27017": {
"label": "Database",
"elevateIfNeeded": true,
"requireLocalPort": true,
"onAutoForward": "silent"
}
},
"postStartCommand": "bash -c .devcontainer/setup.sh",

// "xdebug.php-debug" = official XDEBUG extension
"customizations": {
"vscode": {
"extensions": [
"xdebug.php-debug"
]
}
},

"forwardPorts": [80],

// execute our one-time repo init if /vendor/ does not exist
"postCreateCommand": "sh init_repo.sh"
"settings": {
"extensions.ignoreRecommendations": true,
"workbench.startupEditor": "none",
"workbench.colorTheme": "Visual Studio Dark",
"workbench.colorCustomizations": {},
"workbench.welcomePage.walkthroughs.openOnInstall": false,
"workbench.welcomePage.experimental.videoTutorials": "off",
"github.codespaces.defaultExtensions": []
}
}
29 changes: 29 additions & 0 deletions .devcontainer/open_port.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

RETRY_COUNT=3
RETRY_INTERVAL=5
TARGET_PORTS=("3000" "3001")

sleep 5

for port in "${TARGET_PORTS[@]}"; do
for ((try = 1; try <= RETRY_COUNT; try++)); do
echo "Attempt $try: Making port $port public."

gh codespace ports visibility $port:public -c $CODESPACE_NAME
sleep 1

ports_json=$(gh codespace ports -c $CODESPACE_NAME --json label,sourcePort,visibility)
visibility=$(echo "$ports_json" | jq -r ".[] | select(.sourcePort == $port) | .visibility")

if [ "$visibility" == "public" ]; then
echo "Port $port is now public."
break
elif [ $try -lt $RETRY_COUNT ]; then
echo "Port $port is still not public. Retrying in $RETRY_INTERVAL seconds..."
sleep $RETRY_INTERVAL
else
echo "Failed to make port $port public after $RETRY_COUNT attempts."
fi
done
done
25 changes: 25 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
WILCO_ID="`cat .wilco`"
ENGINE_EVENT_ENDPOINT="${ENGINE_BASE_URL}/users/${WILCO_ID}/event"
CODESPACE_BACKEND_HOST="${CODESPACE_NAME}-3000.preview.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"
CODESPACE_BACKEND_URL="https://${CODESPACE_BACKEND_HOST}"

# Update engine that codespace started for user
curl -L -X POST "${ENGINE_EVENT_ENDPOINT}" -H "Content-Type: application/json" --data-raw "{ \"event\": \"github_codespace_started\" }"

# Export backend envs when in codespaces
echo "export CODESPACE_BACKEND_HOST=\"${CODESPACE_BACKEND_HOST}\"" >> ~/.bashrc
echo "export CODESPACE_BACKEND_URL=\"${CODESPACE_BACKEND_URL}\"" >> ~/.bashrc
echo "export CODESPACE_WDS_SOCKET_PORT=443" >> ~/.bashrc


# Change backend port visibility to public
echo "(&>/dev/null .devcontainer/open_port.sh &)" >> ~/.bashrc


# Export welcome prompt in bash:
echo "printf \"\n\n☁️☁️☁️️ Anythink: Develop in the Cloud ☁️☁️☁️\n\"" >> ~/.bashrc
echo "printf \"\n=============================================\n\"" >> ~/.bashrc
echo "gh codespace ports -c $CODESPACE_NAME" >> ~/.bashrc
echo "printf \"=============================================\n\"" >> ~/.bashrc
echo "printf \"(Once docker-compose is up and running, you can access the frontend and backend using the above urls)\n\"" >> ~/.bashrc
echo "printf \"\n\x1b[31m \x1b[1m👉 Type: \\\`docker-compose up\\\` to run the project. 👈\n\n\"" >> ~/.bashrc
1 change: 0 additions & 1 deletion .docker/nginx/conf.d/error_reporting.ini

This file was deleted.

38 changes: 0 additions & 38 deletions .docker/nginx/conf.d/nginx-webserver.conf

This file was deleted.

52 changes: 0 additions & 52 deletions .docker/php/Dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion .docker/php/docker-php.ini

This file was deleted.

41 changes: 0 additions & 41 deletions .docker/php/xdebug.ini

This file was deleted.

3 changes: 3 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Loading

0 comments on commit 993251f

Please sign in to comment.