Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: ['2.0', '2.1']
version:
- '2.0'
- '2.1'
- '2.2-standalone'
steps:
- name: Git Checkout
uses: actions/checkout@v3
Expand Down
60 changes: 2 additions & 58 deletions novosga-2.0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,62 +30,6 @@ You can set the system as you like with environment variables (using docker-comp
| NOVOSGA_PLACE_NAME | Box | Place name | yes |
| TZ | UTC | Timezone | yes |

### CLI
## Documentation

Minimal setting:

```shell
docker container run [--rm|-d] \
-p 80:80 -p 2020:2020
-e DATABASE_URL="connection_string" \
novosga/novosga:latest
```

### Compose file

```yaml
version: '2'

services:
novosga:
image: novosga/novosga:latest
restart: always
depends_on:
- mysqldb
ports:
- "80:80"
- "2020:2020"
environment:
APP_ENV: 'prod'
# database connection
DATABASE_URL: 'mysql://novosga:MySQL_App_P4ssw0rd!@mysqldb:3306/novosga2?charset=utf8mb4&serverVersion=5.7'
# default admin user
NOVOSGA_ADMIN_USERNAME: 'admin'
NOVOSGA_ADMIN_PASSWORD: '123456'
NOVOSGA_ADMIN_FIRSTNAME: 'Administrator'
NOVOSGA_ADMIN_LASTNAME: 'Global'
# default unity
NOVOSGA_UNITY_NAME: 'My Unity'
NOVOSGA_UNITY_CODE: 'U01'
# default no-priority
NOVOSGA_NOPRIORITY_NAME: 'Normal'
NOVOSGA_NOPRIORITY_DESCRIPTION: 'Normal service'
# default priority
NOVOSGA_PRIORITY_NAME: 'Priority'
NOVOSGA_PRIORITY_DESCRIPTION: 'Priority service'
# default place
NOVOSGA_PLACE_NAME: 'Box'
# Set TimeZone and locale
TZ: 'America/Sao_Paulo'
LANGUAGE: 'pt_BR'
mysqldb:
image: mysql:5.7
restart: always
environment:
MYSQL_USER: 'novosga'
MYSQL_DATABASE: 'novosga2'
MYSQL_ROOT_PASSWORD: 'MySQL_r00t_P4ssW0rd!'
MYSQL_PASSWORD: 'MySQL_App_P4ssw0rd!'
# Set TimeZone
TZ: 'America/Sao_Paulo'
```
https://novosga.org/docs/#/2.0/install-docker
69 changes: 7 additions & 62 deletions novosga-2.1/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# NovoSGA 2.1

## Docker image milestones
[x] Pre-flight check
[x] Auto setup
[x] Daily ticket reset at 1am
[ ] docker secrets support

- [x] Pre-flight check
- [x] Auto setup
- [x] Daily ticket reset at 1am
- [ ] docker secrets support

## How to use

Expand All @@ -29,62 +30,6 @@ You can set the system as you like with environment variables (using docker-comp
| NOVOSGA_PLACE_NAME | Box | Place name | yes |
| TZ | UTC | Timezone | yes |

### CLI

Minimal setting:

```shell
docker container run [--rm|-d] \
-p 80:80 -p 2020:2020
-e DATABASE_URL="connection_string" \
novosga/novosga:latest
```

### Compose file

```yaml
version: '2'
## Documentation

services:
novosga:
image: novosga/novosga:2.1
restart: always
depends_on:
- mysqldb
ports:
- "80:80"
- "2020:2020"
environment:
APP_ENV: 'prod'
# database connection
DATABASE_URL: 'mysql://novosga:MySQL_App_P4ssw0rd!@mysqldb:3306/novosga2?charset=utf8mb4&serverVersion=5.7'
# default admin user
NOVOSGA_ADMIN_USERNAME: 'admin'
NOVOSGA_ADMIN_PASSWORD: '123456'
NOVOSGA_ADMIN_FIRSTNAME: 'Administrator'
NOVOSGA_ADMIN_LASTNAME: 'Global'
# default unity
NOVOSGA_UNITY_NAME: 'My Unity'
NOVOSGA_UNITY_CODE: 'U01'
# default no-priority
NOVOSGA_NOPRIORITY_NAME: 'Normal'
NOVOSGA_NOPRIORITY_DESCRIPTION: 'Normal service'
# default priority
NOVOSGA_PRIORITY_NAME: 'Priority'
NOVOSGA_PRIORITY_DESCRIPTION: 'Priority service'
# default place
NOVOSGA_PLACE_NAME: 'Box'
# Set TimeZone and locale
TZ: 'America/Sao_Paulo'
LANGUAGE: 'pt_BR'
mysqldb:
image: mysql:5.7
restart: always
environment:
MYSQL_USER: 'novosga'
MYSQL_DATABASE: 'novosga2'
MYSQL_ROOT_PASSWORD: 'MySQL_r00t_P4ssW0rd!'
MYSQL_PASSWORD: 'MySQL_App_P4ssw0rd!'
# Set TimeZone
TZ: 'America/Sao_Paulo'
```
https://novosga.org/docs/#/2.1/install-docker
37 changes: 37 additions & 0 deletions novosga-2.2-standalone/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM novosga/novosga:2.2

#Set the default parameters
ENV APP_ENV=prod \
LANGUAGE=pt_BR \
NOVOSGA_ADMIN_USERNAME="admin" \
NOVOSGA_ADMIN_PASSWORD="123456" \
NOVOSGA_ADMIN_FIRSTNAME="Administrador" \
NOVOSGA_ADMIN_LASTNAME="Global" \
NOVOSGA_UNITY_NAME="Minha Unidade" \
NOVOSGA_UNITY_CODE="U01" \
NOVOSGA_NOPRIORITY_NAME="Normal" \
NOVOSGA_NOPRIORITY_DESCRIPTION="Serviço normal" \
NOVOSGA_PRIORITY_NAME="Prioridade" \
NOVOSGA_PRIORITY_DESCRIPTION="Serviço prioritário" \
NOVOSGA_PLACE_NAME="Guichê"

USER root

# https://github.com/aptible/supercronic/releases/tag/v0.2.33
ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.2.33/supercronic-linux-amd64 \
SUPERCRONIC_SHA1SUM=71b0d58cc53f6bd72cf2f293e09e294b79c666d8 \
SUPERCRONIC=supercronic-linux-amd64

RUN curl -fsSLO "$SUPERCRONIC_URL" \
&& echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \
&& chmod +x "$SUPERCRONIC" \
&& mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \
&& ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic

COPY start.sh /usr/local/bin
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY config/crontab /etc/crontab

USER nobody

CMD ["start.sh"]
31 changes: 31 additions & 0 deletions novosga-2.2-standalone/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# NovoSGA 2.2

## Docker image milestones

- [x] Pre-flight check
- [x] Auto setup
- [x] Daily ticket reset at 1am
- [ ] docker secrets support

## How to use

The container will check if the required settings are set and will start the database setup automatically.
You can set the system as you like with environment variables (using docker-compose.yml or `-e` flags at `docker container run`)

### Settings (environment variables)

| Option | Default setting | Description | Optional? |
| ------------------------------ | ----------------- | -------------------------------- | :-------: |
| APP_ENV | prod | Environment running the app | yes |
| DATABASE_URL | *blank* | Database connection string | ***no*** |
| NOVOSGA_ADMIN_USERNAME | admin | Admin username | yes |
| NOVOSGA_ADMIN_PASSWORD | 123456 | Admin password | yes |
| NOVOSGA_ADMIN_FIRSTNAME | Administrator | Administrator first name | yes |
| NOVOSGA_ADMIN_LASTNAME | Global | Administrador last name | yes |
| NOVOSGA_UNITY_NAME | My Unity | Unity name | yes |
| NOVOSGA_UNITY_CODE | U01 | Unity code | yes |
| NOVOSGA_NOPRIORITY_DESCRIPTION | Normal service | Non-Priority service description | yes |
| NOVOSGA_PRIORITY_NAME | Priority | Priority service name | yes |
| NOVOSGA_PRIORITY_DESCRIPTION | Priority service | Priority service description | yes |
| NOVOSGA_PLACE_NAME | Box | Place name | yes |
| TZ | UTC | Timezone | yes |
2 changes: 2 additions & 0 deletions novosga-2.2-standalone/config/crontab
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# m h dom mon dow command
0 1 * * * /var/www/html/bin/console novosga:reset
32 changes: 32 additions & 0 deletions novosga-2.2-standalone/config/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[supervisord]
nodaemon=true
logfile=/dev/null
logfile_maxbytes=0
pidfile=/run/supervisord.pid

[program:php-fpm]
command=php-fpm82 -F
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=false
startretries=0

[program:nginx]
command=nginx -g 'daemon off;'
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=false
startretries=0

[program:supercronic]
command=supercronic /etc/crontab
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=false
startretries=0
29 changes: 29 additions & 0 deletions novosga-2.2-standalone/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh
echo "Starting pre-flight check..."

echo -n "Database url: "
if [ -z "$DATABASE_URL" ]; then
echo "\nYou need to tell me where the database is and how to connect to it by setting DATABASE_URL environment variable"
echo "e.g.: Using the flag -e DATABASE_URL='mysql://user:pass@127.0.0.1:3306/dbname?charset=utf8mb4&serverVersion=5.7' at docker container run"
exit 1
fi
echo "Ok"

bin/console cache:clear --no-debug --no-warmup
bin/console cache:warmup

# we need to wait until the database is up and accepting connections
until bin/console -q doctrine:query:sql "select version()" > /dev/null 2>&1; do
echo "Waiting for database...";
sleep 5;
done

echo "Database is up, configuring schema"

set -xe

# Install/Updates the database schema
bin/console novosga:install

echo "Setup done! Starting application"
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf