20 Commits
Author SHA1 Message Date
Takeus 1523fc977d Merge pull request #11 from TakeusV1/DEV
Dev
2025-04-01 11:55:15 +02:00
Takeus 969b7dac2f Merge branch 'PROD' into DEV 2025-04-01 11:55:08 +02:00
Takeus a19f59e9a2 Update _config.py 2025-04-01 11:53:41 +02:00
Takeus 6bae5cec91 Update _config.py
Dynamic SECRET_KEY for docker support.
2025-04-01 11:53:00 +02:00
Takeus 275c575e90 Update docker-compose.yml 2025-04-01 11:42:32 +02:00
Takeus 2956b0abed Merge pull request #9 from cafrays/PROD
Docker Container Deployment
2025-04-01 11:41:28 +02:00
Takeus 5651121181 Merge pull request #10 from TakeusV1/DEV
Fixes
2025-03-31 14:49:39 +02:00
Takeus 88c26c931c FIxes 2025-03-31 14:49:12 +02:00
fdrock 67094b541a Adjusted container version 2025-03-29 21:52:22 -04:00
fdrock e2380e6919 Adding volumes to docker compose 2025-03-29 21:47:21 -04:00
Cafray a5c9664bf1 Update README.md 2025-03-29 15:43:30 -04:00
Cafray bd40a774d7 Update README.md 2025-03-29 15:42:43 -04:00
fdrock 47d9078473 Adding Docker Compose 2025-03-29 15:42:27 -04:00
fdrock 55aaeae1da Working on a Docker Container 2025-03-29 15:10:17 -04:00
Takeus 621b2b681a Merge pull request #8 from cafrays/PROD
Update install.md
2025-03-27 20:53:19 +01:00
Cafray 1c8ec0c159 Update install.md
Typo correction and added instructions to update app/_config.py
2025-03-27 15:44:24 -04:00
Takeus 7d60ce672b Merge pull request #7 from TakeusV1/DEV
Update setup.py
2025-03-27 20:06:52 +01:00
Takeus f3b6270504 Merge pull request #5 from cafrays/PROD
Update install.md
2025-03-27 20:06:15 +01:00
Takeus eaa6499bd0 Update setup.py 2025-03-27 20:04:40 +01:00
Cafray 1464767d4e Update install.md
Adding missing steps
2025-03-27 14:36:59 -04:00
8 changed files with 56 additions and 11 deletions

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
FROM python:3.13.2-alpine3.21
WORKDIR /fipam
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app /fipam/app
COPY instance /fipam/instance
ENV APP_HOME=/fipam
ENV PYTHONPATH=${APP_HOME}
ENV PATH="$PATH:${APP_HOME}/.local/bin"
ENV GUNICORN_CMD_ARGS="--bind=0.0.0.0:5000 --workers=2 --preload"
EXPOSE 5000
ENTRYPOINT ["gunicorn","app:create_app()"]
+7
View File
@@ -14,3 +14,10 @@ _(I'm not an experienced developer, just a tinkerer)_
--- ---
- Installation : [here](install.md) - Installation : [here](install.md)
- Sources : [here](sources.md) - Sources : [here](sources.md)
## Docker Compose
The Docker image has a built in admin account, **PLEASE CHANGE PASSWORD AFTER INITIAL LOG IN**
- Username: admin
- Password: _PleaseChangeMe_
<br>
Use docker-compose.yml file to deploy.
+8 -5
View File
@@ -1,6 +1,8 @@
########################################################## ##########################################################
############# CONFIGURATION FILE | Flask IPAM ############ ############# CONFIGURATION FILE | Flask IPAM ############
import random, string
## Flask Server (For DEV) ## Flask Server (For DEV)
app_ip = '127.0.0.1' app_ip = '127.0.0.1'
app_port = 80 app_port = 80
@@ -8,13 +10,14 @@ app_debug = True
app_maintenance = False app_maintenance = False
app_name = 'takeus-ipam' app_name = 'takeus-ipam'
app_version = 'V1.2' app_version = 'V1.3'
app_release_date = '02/2025' app_release_date = '02/2025'
app_url = "http://127.0.0.1" app_url = "http://0.0.0.0"
class Configuration: class Configuration:
# openssl rand -hex 32 # replace SECRET_KEY with value from "openssl rand -hex 32" or similar for STATIC sessions
SECRET_KEY = 'change_me' # With actual configuration, every application restart, user have to re-login...
SECRET_KEY = ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(32))
# DB CONFIG # DB CONFIG
SQLALCHEMY_DATABASE_URI = 'sqlite:///database.db' SQLALCHEMY_DATABASE_URI = 'sqlite:///database.db'
SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_TRACK_MODIFICATIONS = False
@@ -22,4 +25,4 @@ class Configuration:
# CK CONFIG # CK CONFIG
SESSION_COOKIE_SECURE = False # SSL REQUIRED SESSION_COOKIE_SECURE = False # SSL REQUIRED
SESSION_COOKIE_HTTPONLY = True SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SAMESITE = 'Lax' SESSION_COOKIE_SAMESITE = 'Lax'
+1
View File
@@ -161,6 +161,7 @@ def allocation_delete(net_id,ipv4):
db_alloc.description = None db_alloc.description = None
db_alloc.is_dhcp = False db_alloc.is_dhcp = False
db_alloc.is_gateway = False db_alloc.is_gateway = False
db_alloc.is_decom = False
db.session.commit() db.session.commit()
flash("Allocation Removed", 'warning') flash("Allocation Removed", 'warning')
return redirect(url_for('network.allocations',net_id=net_id,page=request.args.get('page', type=int))) return redirect(url_for('network.allocations',net_id=net_id,page=request.args.get('page', type=int)))
+13
View File
@@ -0,0 +1,13 @@
name: Flask-IPAM
services:
flask-ipam:
image: ghcr.io/cafrays/flask_ipam:latest
container_name: flask-ipam
restart: unless-stopped
ports:
- 5000:5000
volumes:
- flask-ipam:/fipam/instance
volumes:
flask-ipam:
+8 -2
View File
@@ -2,10 +2,16 @@
This documentation is very good, but needs a few changes to make it work (in our case) : This documentation is very good, but needs a few changes to make it work (in our case) :
https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-22-04<br> https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-22-04<br>
- You don't need to create `wsgi.py`, when asked, replace : `wsgi:app` with `'app:create_app()'` . Before starting the app ensure to install pip packages in requirements.txt Referrenced [Section](https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-22-04#step-4-configuring-gunicorn)
- `pip install Flask-Login Flask-SQLAlchemy Flask-WTF mysql-connector-python SQLAlchemy cryptography`
- Update the configuration file under _app/\_config.py_.
- `app_ip = '127.0.0.1'` to `app_ip = '0.0.0.0'` for easy web access.
- Update **SECRET_KEY='CHANGE_ME'** variable, `openssl rand -hex 32` can be used to create a random key.
- You don't need to create or continue with the `wsgi.py` section. When asked, replace: `wsgi:app` with `'app:create_app()'` .
- EX : For starting APP with gunicorn : `gunicorn --bind 0.0.0.0:5000 'app:create_app()'` - EX : For starting APP with gunicorn : `gunicorn --bind 0.0.0.0:5000 'app:create_app()'`
- For any troubleshooting, you can add `--preload` at the end of the command for verbose logging.
- In Service File, replace "ExecStart" line with :<br> - In Service File, replace "ExecStart" line with :<br>
`ExecStart=/YOUR_ENV_LOCATION/bin/gunicorn --workers 1 --bind unix:fipam.sock -m 007 'app:create_app()'`<br> `ExecStart=/YOUR_ENV_LOCATION/bin/gunicorn --workers 1 --bind 0.0.0.0:5000 -m 007 'app:create_app()'`<br>
_(Adjust the number of workers to your needs)_ _(Adjust the number of workers to your needs)_
- you must first run setup.py to create the admin user.<br> - you must first run setup.py to create the admin user.<br>
_(it will create a second database in `./var/setup-instance`. It will have to be merged in the application database in `./var/app-instance`)_ _(it will create a second database in `./var/setup-instance`. It will have to be merged in the application database in `./var/app-instance`)_
+3 -1
View File
@@ -1,7 +1,9 @@
wheel
gunicorn
Flask Flask
Flask-Login Flask-Login
Flask-SQLAlchemy Flask-SQLAlchemy
Flask-WTF Flask-WTF
mysql-connector-python mysql-connector-python
SQLAlchemy SQLAlchemy
cryptography cryptography
Regular → Executable
+4 -3
View File
@@ -10,9 +10,10 @@ db = SQLAlchemy(app)
class User(db.Model): class User(db.Model):
id = db.Column(db.Integer(),primary_key=True,unique=True) id = db.Column(db.Integer(),primary_key=True,unique=True)
username = db.Column(db.String(16)) username = db.Column(db.String(16),unique=True)
password = db.Column(db.String(32),unique=True) password = db.Column(db.String(32))
is_admin = db.Column(db.Boolean(),default=False) is_admin = db.Column(db.Boolean(),default=False)
is_reado = db.Column(db.Boolean(),default=False)
dat_last = db.Column(db.DateTime()) dat_last = db.Column(db.DateTime())
with app.app_context(): with app.app_context():
@@ -21,7 +22,7 @@ with app.app_context():
@app.route('/',methods=['GET','POST']) @app.route('/',methods=['GET','POST'])
def setup(): def setup():
if request.method == "POST": if request.method == "POST":
db.session.add(User(username=request.form["username"],password=generate_password_hash(request.form["password"]),is_admin=True)) db.session.add(User(username=request.form["username"],password=generate_password_hash(request.form["password"]),is_admin=True,is_reado=False))
db.session.commit() db.session.commit()
return 'Done, you can delete setup.py' return 'Done, you can delete setup.py'
return "<h1>admin user creation</h1><br><form method='post'><input name='username' placeholder='username'><br><input type='password' name='password' placeholder='password'><br><button type='submit'>submit</button></form>" return "<h1>admin user creation</h1><br><form method='post'><input name='username' placeholder='username'><br><input type='password' name='password' placeholder='password'><br><button type='submit'>submit</button></form>"