-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding developer-setup.sh script to this repo and refactoring (#…
…148) * feat: adding developer-setup.sh script to this repo and refactoring * fix: missing developer-setup.sh * feat: update aws to use environment variables chore: update docs * chore: improve docs
- Loading branch information
1 parent
b44b831
commit a031593
Showing
7 changed files
with
108 additions
and
38 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,9 +1,36 @@ | ||
# codespaces | ||
|
||
## Description: | ||
|
||
This repo contains all the environmental tools/dependencies to deploy the entire glueops platform. Tools include but are not limited to: terraform, helm, kubectl, etc. We primarily use this repository in all of our codespaces as well as github actions. Ref: https://github.com/GlueOps/glueops/blob/%F0%9F%9A%80%F0%9F%92%8E%F0%9F%99%8C%F0%9F%9A%80/.devcontainer/devcontainer.json#L5 | ||
|
||
|
||
Releasing: | ||
# Releasing: | ||
- Please stick to semver standards when dropping a new tag. | ||
- Once you publish a release a new image will be built and uploaded to dockerhub: https://hub.docker.com/r/glueops/codespaces/tags | ||
- Once you publish a release a new image will be built and uploaded to GHCR: https://github.com/GlueOps/codespaces/pkgs/container/codespaces | ||
|
||
|
||
|
||
# Running packer locally: | ||
|
||
It's best to just reference the github workflows under `.github/workflows` the packer workflows for each respective cloud start with `packer-*`. For each respective cloud you will notice env variables are being passed into a github action step. To do this locally, you will need to create credentials for the respective cloud and then `export` the applicable environment variables before running the `packer build` command. | ||
|
||
|
||
### Running AWS: | ||
|
||
|
||
```bash | ||
export AWS_ACCESS_KEY_ID="XXXXXXXXXXXXXXXXX" | ||
export AWS_SECRET_ACCESS_KEY="XXXXXXXXXXXXXXXXX" | ||
packer build -var glueops_codespaces_container_tag=v0.52.0 aws.pkr.hcl | ||
``` | ||
|
||
### Running Hetzner | ||
|
||
```bash | ||
export HCLOUD_TOKEN="XXXXXXXXXXXXXXXXX" | ||
packer build -var glueops_codespaces_container_tag=v0.52.0 hetzner.pkr.hcl | ||
``` | ||
|
||
|
||
_Note: v0.52.0 is the latest version at the time of creating this README.md you can check for the latest version here: https://github.com/GlueOps/codespaces/releases |
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
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,56 @@ | ||
#!/bin/bash | ||
set -e | ||
# Prompt for GitHub username | ||
|
||
echo -e "\n\nEverything is now getting setup. This process will take a few minutes...\n\n" | ||
|
||
# Create user vscode | ||
sudo adduser --disabled-password --uid 1337 --gecos "" vscode | ||
|
||
# Create .ssh directory for vscode | ||
sudo mkdir -p /home/vscode/.ssh | ||
sudo chmod 700 /home/vscode/.ssh | ||
|
||
sudo touch /home/vscode/.ssh/authorized_keys | ||
sudo chmod 600 /home/vscode/.ssh/authorized_keys | ||
sudo chown -R vscode:vscode /home/vscode/.ssh | ||
|
||
# Give vscode sudo access without a password | ||
echo "vscode ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/vscode > /dev/null | ||
|
||
echo "Installing other requirements now" | ||
|
||
curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh && sudo apt-get update && sudo apt install tmux jq figlet -y && sudo apt-get clean | ||
#export DEBIAN_FRONTEND=noninteractive | ||
#sudo apt-get -s dist-upgrade | grep "^Inst" | grep -i securi | awk -F " " {'print $2'} | xargs sudo apt-get install -y | ||
sudo groupadd -f docker | ||
sudo usermod -aG docker vscode | ||
echo 'fs.inotify.max_user_instances=1024' | sudo tee -a /etc/sysctl.conf | ||
echo 1024 | sudo tee /proc/sys/fs/inotify/max_user_instances | ||
sudo curl https://raw.githubusercontent.com/GlueOps/development-only-utilities/v0.11.0/tools/developer-setup/.glueopsrc --output /home/vscode/.glueopsrc | ||
echo "source /home/vscode/.glueopsrc" | sudo tee -a /home/vscode/.bashrc | ||
sudo chown -R vscode:vscode /home/vscode | ||
# disables the password for the current user (ex. root/admin/ubuntu users) | ||
sudo passwd -d $USER | ||
server_ip=$(echo $SSH_CONNECTION | awk '{print $3}') | ||
echo "" | ||
echo "" | ||
#sudo figlet GlueOps | sudo tee /etc/motd | ||
{ echo -e "\e[1;32m$(figlet GlueOps)\e[0m"; echo ""; echo -e "\e[1;34mPlease log in as user 'vscode' or switch to that user by running:\e[0m"; echo ""; echo -e "\e[1;33m sudo su - vscode\e[0m"; echo ""; echo -e "\e[1;34mAfter switching to the 'vscode' user, run the following command:\e[0m"; echo ""; echo -e "\e[1;33m dev\e[0m"; } | sudo tee /etc/motd | ||
|
||
#Install tailscale | ||
curl -fsSL https://tailscale.com/install.sh | sh | ||
|
||
|
||
|
||
if [ -z "$GLUEOPS_CODESPACES_CONTAINER_TAG" ]; then | ||
echo "GLUEOPS_CODESPACES_CONTAINER_TAG is not set." | ||
else | ||
# If the variable is set, pull the Docker image using the tag | ||
echo "Pulling down codespace version: $GLUEOPS_CODESPACES_CONTAINER_TAG" | ||
sudo docker pull ghcr.io/glueops/codespaces:$GLUEOPS_CODESPACES_CONTAINER_TAG | ||
fi | ||
|
||
echo -e "\n\n\n\n\nPlease reboot using: sudo reboot \n\n" | ||
|
||
|
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
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
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,9 @@ | ||
#!/bin/bash | ||
set -e -o pipefail | ||
|
||
echo "waiting for cloud-init to finish..." | ||
sudo cloud-init status --wait | ||
|
||
echo "update packages..." | ||
sudo apt-get update | ||
|