mirror of
https://github.com/atareao/self-hosted.git
synced 2024-07-01 19:45:39 +02:00
binary
This commit is contained in:
parent
f3858427cb
commit
e9fec2c55e
2
snibox/bin/restart
Executable file
2
snibox/bin/restart
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/bash
|
||||||
|
docker-compose restart $@
|
56
snibox/bin/setup
Executable file
56
snibox/bin/setup
Executable file
|
@ -0,0 +1,56 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
RED='\033[0;31m'
|
||||||
|
YELLOW='\033[0;33m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
DEFAULT_SECRET='paste_your_key'
|
||||||
|
|
||||||
|
function report_status() {
|
||||||
|
if [ $? -eq 0 ]
|
||||||
|
then
|
||||||
|
echo -e "${GREEN}Done${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}Unable to complete task${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
echo -e "Copy .env.sample to .env:"
|
||||||
|
if [ ! -f .env ]
|
||||||
|
then
|
||||||
|
cp .env.sample .env
|
||||||
|
report_status
|
||||||
|
else
|
||||||
|
echo -e "${GREEN}File .env already exists${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\nPull images:"
|
||||||
|
docker-compose pull
|
||||||
|
report_status
|
||||||
|
|
||||||
|
echo -e "\nInject secret key:"
|
||||||
|
if grep -Rq "$DEFAULT_SECRET" .env
|
||||||
|
then
|
||||||
|
secret=$(docker-compose run --rm --no-deps backend ./bin/rake secret)
|
||||||
|
echo "$secret"
|
||||||
|
# based on https://stackoverflow.com/a/22084103
|
||||||
|
sed -i.bak "s/$DEFAULT_SECRET/$secret/" .env
|
||||||
|
rm .env.bak
|
||||||
|
report_status
|
||||||
|
else
|
||||||
|
echo -e "${GREEN}Personal secret key exists${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\nCreate database:"
|
||||||
|
docker-compose run --rm backend ./bin/rake db:create
|
||||||
|
report_status
|
||||||
|
|
||||||
|
echo -e "\nRun migrations:"
|
||||||
|
docker-compose run --rm backend ./bin/rake db:migrate
|
||||||
|
report_status
|
||||||
|
|
||||||
|
echo -e "\n${GREEN}Setup completed!${NC}"
|
2
snibox/bin/start
Executable file
2
snibox/bin/start
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/bash
|
||||||
|
docker-compose up -d $@
|
2
snibox/bin/stop
Executable file
2
snibox/bin/stop
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/bash
|
||||||
|
docker-compose stop $@
|
Loading…
Reference in New Issue
Block a user