Skip to content

Commit

Permalink
Merge pull request #4 from ARKultur/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Alvarwow69 authored Mar 24, 2023
2 parents 0421a85 + a3c01d9 commit c37af6d
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 22 deletions.
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Sentinel

### Setup

Clone the repo on your server, then define these environment variables:
```
CI_BRANCH - Target branch to automaticly deploy a projet (ex: main, develop)
SITE_DOMAIN - Domain name of the projet (ex: arktest.example.com)
SITE_ADDRESS - Current address of the server where the CI are (ex: 145.144.67.98)
```

### Start

Then when you have defined these variable you can juste run the command:
```shell
./start.sh
```
It will start all instance of ARKultur based on the target branch `CI_BRANCH`.

### Stop
If you want to stop the CI you can run the command:
```shell
./stop.sh
```
This command stop all instance (it doesn't remove anything).

### Configure auto deploy
When you run the command `./start.sh` the server who, auto deploy it also started, but
you have to link it with a GitHub webhook.
To do so go to:
- Repo's settings
- Webhooks
- Create a new one
- Content type: `application/json`
- Check: `Let me select individual events.`
- Uncheck: everything
- Check: `Workflow runs`

For the payload in caddy's config we've set a route called `ci_deploy/`. \
Add your server address (domain or IP) before this route (ex: https://example.com/ci_deploy). \
Then save your change and check if the ping work. \
If the configuration is good a new version of the project will be deployed when an action
called `docker` id successfully done. \

### Upgrade

If you want to upgrade something in the project there is:
- `docker-compose.yml`: All information about containers
- `configd/`: Contain Caddy's config file
- `ci/`: Server which auto deploy a project
2 changes: 1 addition & 1 deletion ci/script/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#$3 -> Port for the machine and the image

PREFIX="[ARKultur] "
REPO="bogdzn"
REPO="arkulturtest"

if [ "$( docker container inspect -f '{{.State.Running}}' $1 )" == "true" ];
then
Expand Down
9 changes: 1 addition & 8 deletions configs/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
}

route /api/* {
reverse_proxy api:8080
}

route /pgadmin4 {
reverse_proxy pgadmin:8200 {
header_up X-Script-Name "/pgadmin4"
header_up Host {upstream_hostport}
}
reverse_proxy api:4000
}

route /* {
Expand Down
9 changes: 4 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,22 @@ services:
restart: unless-stopped

web:
image: bogdzn/theed:${CI_BRANCH}
container_name: theed
image: arkulturtest/sidious:${CI_BRANCH}
container_name: sidious
ports:
- "3000:3000"
networks:
- internal
restart: unless-stopped

api:
image: bogdzn/naboo:${CI_BRANCH}
image: arkulturtest/naboo:${CI_BRANCH}
container_name: naboo
env_file:
- .env-api
volumes:
- ./configs/api:/app
ports:
- "8080:8080"
- "4000:4000"
depends_on:
- db
networks:
Expand Down
7 changes: 0 additions & 7 deletions scripts/rename_domain_name.sh

This file was deleted.

1 change: 0 additions & 1 deletion start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

PREFIX="[ARKultur] "

export CI_BRANCH=canon
printf "%sStarting docker-compose...\n" "$PREFIX"
docker-compose up -d --build
printf "%sDocker compose started!\n" "$PREFIX"
Expand Down

0 comments on commit c37af6d

Please sign in to comment.