Skip to content

Commit

Permalink
added all customization to env, removed yml (#11)
Browse files Browse the repository at this point in the history
* basic port to env complete

* updated the readme(s)

* updated the docker compose files

* added error handling and validation
  • Loading branch information
yjpictures committed Sep 29, 2023
1 parent e3a81b1 commit ed48096
Show file tree
Hide file tree
Showing 12 changed files with 314 additions and 350 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Docker Image Build and Deploy

on: push
on:
push:
branches:
- main

jobs:

Expand Down Expand Up @@ -42,7 +45,6 @@ jobs:
${{ vars.REGISTRY }}/${{ github.repository }}
${{ github.repository }}
tags: |
type=ref,event=branch
type=sha
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
Expand Down
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,22 @@ name: 'flask-license-manager'
services:

backend:
image: yjpictures/flask-license-manager:latest
image: yjpictures/flask-license-manager
container_name: backend
ports:
- '80:80'
env_file:
- <path to env file>
environment:
MONGODB_URI: mongodb+srv://<username>:<password>@<yourcluster>.mongodb.net/
ADMIN_PWD: <admin_password>
MANAGER_PWD: manager_password>
CLIENT_PWD: client_password>
REQUIRED_CREATE: name, email, company, product, machine-node, machine-sn
UNIQUE_VALIDATE: email, machine-node, machine-sn
```

2. Create a [`MongoDB Atlas`](https://www.mongodb.com/pricing) project/cluster and add the IP address(es) of the server into `MongoDB` (project -> security -> network access) for whitelisting (could also allow access from anywhere but its not recommended).

3. Customize the `.env` file based on your needs, `MONGODB_URI` is a connection string that can be obtained from your `MongoDB` project.
3. Customize the environment variables based on your needs, `MONGODB_URI` is a connection string that can be obtained from your `MongoDB` project.

4. Run `docker compose up` in your server to pull the image and run it into a container.

Expand All @@ -51,14 +56,16 @@ name: 'flask-license-manager'
services:

backend:
image: yjpictures/flask-license-manager:latest
image: yjpictures/flask-license-manager
container_name: backend
ports:
- '80:80'
environment:
MONGODB_URI: mongodb://database:27017/
env_file:
- <path to env file>
ADMIN_PWD: <admin_password>
MANAGER_PWD: manager_password>
CLIENT_PWD: client_password>
REQUIRED_CREATE: name, email, company, product, machine-node, machine-sn
UNIQUE_VALIDATE: email, machine-node, machine-sn
networks:
- backend-network

Expand All @@ -84,7 +91,7 @@ networks:
driver: bridge
```

3. Customize the `.env` file based on your needs.
3. Customize the environment variables based on your needs.

4. Run `docker compose up` in your server to pull the image and run it into a container.

Expand All @@ -107,6 +114,4 @@ The documentation for all the REST API calls can be seen if you do a `GET` reque

Depending on the size and scale, we can host, manage and customize the flask license manager to suit your needs so you can focus on the client side of things.

**Prices start @ US$7.99/month**

[Contact us for more information!](mailto:hello@yashj.ca)
[Contact us for more information!](mailto:hello@yashj.ca)
2 changes: 1 addition & 1 deletion docker/builds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ docker run -p 80:80 --env-file <env-file-path> flask-dev-static

We are not supplying `--evn-file` tag as the `.env` file should already exist in your `/server/` directory because of mounting.
```PowerShell
docker run -p 80:80 -v $pwd\server\static:/server/static -v $pwd\server\templates:/server/templates -v $pwd\server\main.py:/server/main.py -v $pwd\server\database.py:/server/database.py -v $pwd\server\.env:/server/.env -v $pwd\server\config.yml:/server/config.yml flask-dev-mount
docker run -p 80:80 -v $pwd\server\static:/server/static -v $pwd\server\templates:/server/templates -v $pwd\server\main.py:/server/main.py -v $pwd\server\database.py:/server/database.py -v $pwd\server\.env:/server/.env flask-dev-mount
```

## Production
Expand Down
3 changes: 1 addition & 2 deletions docker/cloud-MongoDB/dev-mount.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ services:
- ../../server/templates:/server/templates
- ../../server/main.py:/server/main.py
- ../../server/database.py:/server/database.py
- ../../server/.env:/server/.env
- ../../server/config.yml:/server/config.yml
- ../../server/.env:/server/.env
3 changes: 0 additions & 3 deletions docker/local-MongoDB/dev-mount.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ services:
container_name: backend
ports:
- '80:80'
environment:
MONGODB_URI: mongodb://database:27017/
volumes:
- ../../server/static:/server/static
- ../../server/templates:/server/templates
- ../../server/main.py:/server/main.py
- ../../server/database.py:/server/database.py
- ../../server/.env:/server/.env
- ../../server/config.yml:/server/config.yml
networks:
- backend-network

Expand Down
2 changes: 0 additions & 2 deletions docker/local-MongoDB/dev-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ services:
container_name: backend
ports:
- '80:80'
environment:
MONGODB_URI: mongodb://database:27017/
env_file:
- ../../server/.env
networks:
Expand Down
2 changes: 0 additions & 2 deletions docker/local-MongoDB/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ services:
container_name: backend
ports:
- '80:80'
environment:
MONGODB_URI: mongodb://database:27017/
env_file:
- ../../server/.env
networks:
Expand Down
Loading

0 comments on commit ed48096

Please sign in to comment.