2020-04-20 07:43:13 +00:00
|
|
|
# stack
|
2020-04-02 13:20:50 +00:00
|
|
|
|
2020-04-20 07:43:13 +00:00
|
|
|
* [Gitea](https://gitea.io/en-us/)
|
|
|
|
* [Drone](https://drone.io/)
|
|
|
|
* [Guacamole](https://guacamole.apache.org/)
|
2020-04-20 08:04:34 +00:00
|
|
|
* [Ghost](https://ghost.org/)
|
2020-04-20 07:43:13 +00:00
|
|
|
* [Rocket Chat](https://rocket.chat/)
|
2020-04-02 13:20:50 +00:00
|
|
|
|
2020-04-20 07:43:13 +00:00
|
|
|
In a [docker](https://www.docker.com/) stack.
|
2020-04-02 13:20:50 +00:00
|
|
|
|
2020-04-20 07:43:13 +00:00
|
|
|
## static ip
|
2020-04-18 07:42:32 +00:00
|
|
|
|
|
|
|
[![Build Status](https://sigyl.com:5000/api/badges/giles/stack/status.svg)](https://sigyl.com:5000/giles/stack)
|
|
|
|
|
2020-04-20 07:43:13 +00:00
|
|
|
* home - https://sigyl.com/
|
|
|
|
* git - https://sigyl.com/git/
|
|
|
|
* drone - https://sigyl.com:5000/
|
2020-04-20 08:04:34 +00:00
|
|
|
* ghost - https://sigyl.com/blog/
|
2020-04-20 07:43:13 +00:00
|
|
|
* guacamole - https://sigyl.com/remote/
|
|
|
|
* chat - https://sigyl.com/chat/
|
2020-04-02 13:20:50 +00:00
|
|
|
|
2020-04-20 07:43:13 +00:00
|
|
|
[drone.do.yml](drone.do.yml) - [docker-compose-do.yml](docker-compose-do.yml)
|
2020-04-02 13:20:50 +00:00
|
|
|
|
2020-04-20 07:43:13 +00:00
|
|
|
## tunnelled with ngrok
|
2020-04-02 13:20:50 +00:00
|
|
|
|
2020-04-20 07:43:13 +00:00
|
|
|
(very slow if home internet)
|
2020-04-02 13:20:50 +00:00
|
|
|
|
2020-04-20 07:43:13 +00:00
|
|
|
[![Build Status](https://drone.sigyl.com/api/badges/giles/stack/status.svg)](https://drone.sigyl.com/giles/stack)
|
2020-04-02 13:20:50 +00:00
|
|
|
|
2020-04-20 07:43:13 +00:00
|
|
|
* git - https://git.sigyl.com/
|
|
|
|
* drone - https://drone.sigyl.com/
|
|
|
|
* guacamole - https://remote.sigyl.com/
|
2020-04-29 06:07:43 +00:00
|
|
|
|
|
|
|
## installation
|
|
|
|
|
|
|
|
Once installed and running the system can redeploy itself.
|
|
|
|
|
2020-04-29 06:29:28 +00:00
|
|
|
However initially you need to do this yourself.
|
|
|
|
|
2020-04-29 10:05:39 +00:00
|
|
|
### docker
|
|
|
|
|
2020-04-29 06:29:28 +00:00
|
|
|
you need a docker swarm set up with nodes with the following labels
|
|
|
|
|
|
|
|
* com.sigyl.git-stack=yes
|
|
|
|
* com.sigyl.git-stack-data=yes
|
|
|
|
|
2020-04-29 10:05:39 +00:00
|
|
|
### global environment
|
|
|
|
|
|
|
|
the following environment variables need to be defined (define your own values)
|
|
|
|
|
|
|
|
```
|
|
|
|
echo 'export SIGYL_STACK_ROOT=/stack/deploy' | sudo tee -a /etc/profile.d/sigyl-stack.sh
|
|
|
|
echo 'export SIGYL_STACK_NAME=stack' | sudo tee -a /etc/profile.d/sigyl-stack.sh
|
|
|
|
|
|
|
|
sh /etc/profile.d/sigyl-stack.sh
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2020-04-29 06:29:28 +00:00
|
|
|
### make a folder and give yourself access
|
|
|
|
|
|
|
|
```
|
2020-04-29 10:05:39 +00:00
|
|
|
sudo mkdir -p $SIGYL_STACK_ROOT
|
2020-04-29 06:29:28 +00:00
|
|
|
cd /stack
|
2020-04-29 10:05:39 +00:00
|
|
|
sudo chown -R $USER:$USER $SIGYL_STACK_ROOT
|
|
|
|
|
2020-04-29 06:29:28 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### clone the repository
|
|
|
|
|
|
|
|
```
|
|
|
|
cd /stack
|
2020-04-29 10:05:39 +00:00
|
|
|
git clone https://sigyl.com/git/giles/stack.git $SIGYL_STACK_ROOT
|
|
|
|
cd $SIGYL_STACK_ROOT
|
2020-04-29 06:29:28 +00:00
|
|
|
git checkout home-deploy
|
|
|
|
|
|
|
|
```
|
|
|
|
|
2020-04-29 08:19:45 +00:00
|
|
|
### make certificates for the registry
|
|
|
|
|
|
|
|
these certificates will be in .ca and .certificates
|
2020-04-29 10:05:39 +00:00
|
|
|
where $REGISTRY_DOMAIN is the host where the stack will run it should be on the local subnet ie trafic should not have to go over the internet.
|
|
|
|
|
|
|
|
eg git.local-domain
|
2020-04-29 08:19:45 +00:00
|
|
|
|
|
|
|
```
|
2020-04-29 10:05:39 +00:00
|
|
|
cd $SIGYL_STACK_ROOT/certificates
|
2020-04-29 08:19:45 +00:00
|
|
|
sh ca.sh $REGISTRY_DOMAIN:5003
|
|
|
|
sh make-cert.sh $REGISTRY_DOMAIN registry
|
|
|
|
```
|
|
|
|
|
|
|
|
### make environment variables
|
|
|
|
|
|
|
|
```
|
|
|
|
export CERTBOT_EMAIL=giles.bradshaw@sigyl.com
|
|
|
|
export DRONE_DOMAIN=drone.git.sigyl.com
|
|
|
|
export DRONE_GITEA_CLIENT_ID=
|
|
|
|
export DRONE_GITEA_SERVER=
|
|
|
|
export DRONE_SERVER_HOST=drone.git.sigyl.com
|
|
|
|
export GIT_DOMAIN=git.sigyl.com
|
|
|
|
export LOCAL_DOCKER_REGISTRY=git.local-domain:5003/
|
|
|
|
export SSH_USER=giles
|
|
|
|
export GUACAMOLE_POSTGRES_DB=guacamole_db
|
|
|
|
export GUACAMOLE_POSTGRES_USER=guacamole_user
|
|
|
|
export DRONE_CONVERT_SECRET=topsecret
|
|
|
|
export DRONE_GITEA_CLIENT_SECRET=
|
|
|
|
export DRONE_RPC_SECRET=topsecret2
|
|
|
|
export GUACAMOLE_POSTGRES_PASSWORD=[passwordnospaces]
|
|
|
|
export NGROK_AUTH_TOKEN=[secret token from ngrok]
|
|
|
|
```
|
|
|
|
|
|
|
|
### build images
|
|
|
|
|
|
|
|
|
|
|
|
```
|
2020-04-29 10:05:39 +00:00
|
|
|
sh build.sh $SIGYL_STACK_ROOT
|
2020-04-29 08:19:45 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### initial deploy of stack
|
|
|
|
|
|
|
|
```
|
2020-04-29 10:05:39 +00:00
|
|
|
cd $SIGYL_STACK_ROOT
|
|
|
|
docker stack deploy -c docker-compose-home.yml $SIGYL_STACK_NAME
|
2020-04-29 08:19:45 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### initialise postgres database
|
|
|
|
|
|
|
|
find postgres id as $ID
|
|
|
|
|
|
|
|
```
|
|
|
|
docker ps | grep stack_guacamole-postgresql.1
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
sh init-postgresql.sh $ID
|
|
|
|
```
|
|
|
|
|
|
|
|
## initialise mongo
|
|
|
|
|
|
|
|
get mongo id as $ID
|
|
|
|
|
|
|
|
```
|
|
|
|
docker ps | grep stack_chat-mongo.1
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
sh init-mongo-chat.sh $ID
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### scale chat and ngrok and nginx
|
|
|
|
|
|
|
|
```
|
|
|
|
sh init-scale.sh stack
|
|
|
|
```
|
|
|
|
|
|
|
|
### create a gitea drone application
|
|
|
|
|
2020-04-29 10:05:39 +00:00
|
|
|
This might be on your local gitea or some other one.
|
|
|
|
|
|
|
|
set environment variables for it as follows (example values):
|
2020-04-29 08:19:45 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
export DRONE_GITEA_SERVER=https://sigyl.com/git
|
|
|
|
export DRONE_GITEA_CLIENT_ID=38218ed5-cf18-47e7-1234-710173dae499
|
|
|
|
export DRONE_GITEA_CLIENT_SECRET=ytsgdyXI_6zUrqwsI1wsssBAaUcsp27EyecT4nk5fA=
|
|
|
|
```
|
|
|
|
|
2020-04-29 10:05:39 +00:00
|
|
|
### redeploy
|
|
|
|
|
|
|
|
```
|
|
|
|
docker stack deploy -c docker-compose-home.yml $SIGYL_STACK_NAME
|
|
|
|
sh init-scale.sh stack
|
|
|
|
```
|