This repository has been archived by the owner on Oct 28, 2023. It is now read-only.
-
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.
Merge pull request #80 from aske-w/development
Add swarm to production
- Loading branch information
Showing
30 changed files
with
2,448 additions
and
106 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,8 @@ jobs: | |
docker build -t ${{ secrets.DOCKER_USERNAME }}/minitwit-client:latest . -f ./client/Dockerfile | ||
docker push ${{ secrets.DOCKER_USERNAME }}/minitwit-client:latest | ||
# Doesnt work ATM, see https://github.com/Azure/container-scan/issues/122 | ||
# Instead we have set up snyk.io to continuesly monitor our container directly from Docker Hub | ||
scan: | ||
name: "Scan the container" | ||
needs: build | ||
|
@@ -50,60 +52,91 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: copy file via ssh password | ||
- name: copy file to manager node via ssh password | ||
uses: appleboy/scp-action@master | ||
with: | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
host: ${{ secrets.SERVER_IP }} | ||
username: ${{ secrets.SERVER_USER }} | ||
key: ${{ secrets.XSSH_PRIVATE_KEY }} | ||
host: ${{ secrets.XSERVER_IP }} | ||
username: ${{ secrets.XSERVER_USER }} | ||
port: 22 | ||
strip_components: 2 | ||
source: "./remote_files/docker-compose.yml, ./filebeat/filebeat.yml" | ||
target: "/vagrant" | ||
source: "./swarm/docker-compose.yml, ./swarm/filebeat.yml, ./swarm/grafana/, ./swarm/prometheus/" | ||
target: "/root" | ||
- name: copy file to worker node via ssh password | ||
uses: appleboy/scp-action@master | ||
with: | ||
key: ${{ secrets.XSSH_PRIVATE_KEY }} | ||
host: ${{ secrets.WORKER_IP }} | ||
username: ${{ secrets.XSERVER_USER }} | ||
port: 22 | ||
strip_components: 2 | ||
source: "./swarm/filebeat.yml" | ||
target: "/root" | ||
|
||
deploy: | ||
name: "Deploy to droplet" | ||
needs: copy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Deploy to Digital Ocean droplet via SSH action | ||
uses: appleboy/[email protected] | ||
env: | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
MYSQL_USER: ${{ secrets.MYSQL_USER }} | ||
MYSQL_DATABASE: ${{ secrets.MYSQL_DATABASE }} | ||
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }} | ||
MYSQL_ADDRESS: ${{ secrets.MYSQL_ADDRESS }} | ||
MYSQL_PORT: 25060 | ||
GRAFANA_ADMIN_USERNAME: ${{ secrets.GRAFANA_ADMIN_USERNAME }} | ||
GRAFANA_ADMIN_PASSWORD: ${{ secrets.GRAFANA_ADMIN_PASSWORD }} | ||
ELK_USER: ${{ secrets.ELK_USER }} | ||
ELASTIC_USER: ${{ secrets.ELASTIC_USER }} | ||
ELASTIC_PASSWORD: ${{ secrets.ELASTIC_PASSWORD }} | ||
with: | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
host: ${{ secrets.SERVER_IP }} | ||
username: ${{ secrets.SERVER_USER }} | ||
port: 22 | ||
envs: DOCKER_USERNAME,MYSQL_USER,MYSQL_DATABASE,MYSQL_PASSWORD,MYSQL_ADDRESS,MYSQL_PORT,GRAFANA_ADMIN_USERNAME,GRAFANA_ADMIN_PASSWORD,ELK_USER,ELASTIC_USER,ELASTIC_PASSWORD | ||
|
||
script: | | ||
cd /vagrant | ||
- name: Shh into worker node | ||
uses: appleboy/[email protected] | ||
with: | ||
key: ${{ secrets.XSSH_PRIVATE_KEY }} | ||
host: ${{ secrets.WORKER_IP }} | ||
username: ${{ secrets.XSERVER_USER }} | ||
port: 22 | ||
script: | | ||
cd /root | ||
chown root filebeat.yml | ||
chmod go-w filebeat.yml | ||
export DOCKER_USERNAME=$DOCKER_USERNAME | ||
export MYSQL_USER=$MYSQL_USER | ||
export MYSQL_DATABASE=$MYSQL_DATABASE | ||
export MYSQL_PASSWORD=$MYSQL_PASSWORD | ||
export MYSQL_ADDRESS=$MYSQL_ADDRESS | ||
export MYSQL_PORT=$MYSQL_PORT | ||
export GRAFANA_ADMIN_USERNAME=$GRAFANA_ADMIN_USERNAME | ||
export GRAFANA_ADMIN_PASSWORD=$GRAFANA_ADMIN_PASSWORD | ||
export ELK_USER=$ELK_USER | ||
export ELASTIC_USER=$ELASTIC_USER | ||
export ELASTIC_PASSWORD=$ELASTIC_PASSWORD | ||
- name: Deploy to Digital Ocean droplet via SSH action | ||
uses: appleboy/[email protected] | ||
env: | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
MYSQL_USER: ${{ secrets.XMYSQL_USER }} | ||
MYSQL_DATABASE: ${{ secrets.XMYSQL_DATABASE }} | ||
MYSQL_PASSWORD: ${{ secrets.XMYSQL_PASSWORD }} | ||
MYSQL_ADDRESS: ${{ secrets.XMYSQL_ADDRESS }} | ||
MYSQL_PORT: 25060 | ||
GRAFANA_ADMIN_USERNAME: ${{ secrets.GRAFANA_ADMIN_USERNAME }} | ||
GRAFANA_ADMIN_PASSWORD: ${{ secrets.GRAFANA_ADMIN_PASSWORD }} | ||
ELK_USER: ${{ secrets.ELK_USER }} | ||
ELASTIC_USER: ${{ secrets.ELASTIC_USER }} | ||
ELASTIC_PASSWORD: ${{ secrets.ELASTIC_PASSWORD }} | ||
BUCKET_NAME: ${{ secrets.BUCKET_NAME }} | ||
SECRET_KEY: ${{ secrets.SECRET_KEY }} | ||
ACCESS_KEY: ${{ secrets.ACCESS_KEY }} | ||
STACK_NAME: ${{ secrets.STACK_NAME }} | ||
with: | ||
key: ${{ secrets.XSSH_PRIVATE_KEY }} | ||
host: ${{ secrets.XSERVER_IP }} | ||
username: ${{ secrets.XSERVER_USER }} | ||
port: 22 | ||
envs: DOCKER_USERNAME,MYSQL_USER,MYSQL_DATABASE,MYSQL_PORT,MYSQL_ADDRESS,MYSQL_PASSWORD,GRAFANA_ADMIN_USERNAME,GRAFANA_ADMIN_PASSWORD,ELK_USER,ELASTIC_USER,ELASTIC_PASSWORD,STACK_NAME,ACCESS_KEY,SECRET_KEY,BUCKET_NAME | ||
script: | | ||
cd /root | ||
export DOCKER_USERNAME=$DOCKER_USERNAME | ||
export MYSQL_USER=$MYSQL_USER | ||
export MYSQL_DATABASE=$MYSQL_DATABASE | ||
export MYSQL_PASSWORD=$MYSQL_PASSWORD | ||
export MYSQL_ADDRESS=$MYSQL_ADDRESS | ||
export MYSQL_PORT=$MYSQL_PORT | ||
export GRAFANA_ADMIN_USERNAME=$GRAFANA_ADMIN_USERNAME | ||
export GRAFANA_ADMIN_PASSWORD=$GRAFANA_ADMIN_PASSWORD | ||
export ELK_USER=$ELK_USER | ||
export ELASTIC_USER=$ELASTIC_USER | ||
export ELASTIC_PASSWORD=$ELASTIC_PASSWORD | ||
export STACK_NAME=$STACK_NAME | ||
export ACCESS_KEY=$ACCESS_KEY | ||
export SECRET_KEY=$SECRET_KEY | ||
export BUCKET_NAME=$BUCKET_NAME | ||
chown root filebeat.yml | ||
chmod go-w filebeat.yml | ||
docker-compose pull | ||
docker-compose up -d | ||
docker-compose pull | ||
docker stack deploy --compose-file docker-compose.yml $STACK_NAME | ||
versioning: | ||
name: "Tag and release" | ||
|
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 |
---|---|---|
|
@@ -10,4 +10,6 @@ config.monitoring | |
server/access.log | ||
server/itu-minitwit | ||
.htpasswd | ||
runner-build-errors.log | ||
runner-build | ||
|
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 +1 @@ | ||
REACT_APP_BASE_URL=http://67.207.75.163:8080/api | ||
REACT_APP_BASE_URL=http://138.68.125.155:8080/api |
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 @@ | ||
docker yeet |
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
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
Oops, something went wrong.