投稿時間:2021-07-17 20:16:47 RSSフィード2021-07-17 20:00 分まとめ(19件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) tkinterでボタンを押してラベルを更新した3秒後にウィンドウを閉じたい https://teratail.com/questions/349989?rss=all tkinterでボタンを押してラベルを更新した秒後にウィンドウを閉じたい以下のようなコードがあり、clickedのメソッドにて「ボタンが押されたらラベルを更新して秒後にウィンドウを閉じる」としたいのですが、ラベルが更新されず秒後にウィンドウを閉じてしまいます。 2021-07-17 19:38:05
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Swift guard文に置き換えたい https://teratail.com/questions/349988?rss=all Swiftguard文に置き換えたい前提・実現したいこと現在ifでnil判定している箇所をgurad文に置き換えたいguradletUserdfaultselsenilの場合は弾くという処理にしたいです。 2021-07-17 19:36:52
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) 条件分岐で該当者以外の不正アクセスを防ぎたいです。 https://teratail.com/questions/349987?rss=all 条件分岐で該当者以外の不正アクセスを防ぎたいです。 2021-07-17 19:07:37
Docker dockerタグが付けられた新着投稿 - Qiita 別docker-composeで立ち上げたDBを参照する https://qiita.com/icoeco/items/619c487a6efa3aae9776 別dockercomposeで立ち上げたDBを参照するやりたいことDocker上に構築したeccubeのDBmySQLにこれまた別のDockerで構築したrailsアプリから接続したいrailsとeccubeでそれぞれ別のdockercomposeファイルが存在するどういう設定したらrailsからeccubeのDBのコンテナが見れるのかわかんない解決した方法別dockercompose同士のネットワークを繋げる設定をした具体的にはrailsとeccubeを同じネットワーク内に所属させ、コンテナ名で参照できるようにしたこちら参考にさせていただきました。 2021-07-17 19:21:58
Ruby Railsタグが付けられた新着投稿 - Qiita Railsで架空のCafeのHPを作ってみよう!【7日目】『クォーテーションの違い』編 https://qiita.com/hamazaki1996o/items/eb8ca818bc2947250e11 Railsで架空のCafeのHPを作ってみよう【日目】『クォーテーションの違い』編概要基本Railsの記法に則り書いていきますから全ての説明ではなくその中であれどうやるのと疑問に思った点や実装に困った箇所をピックアップして紹介していきます設定と準備・Rails・HTML・CSS・JavascriptjQuery↑上記の言語とフレームワークを使い架空自分で考えたテキトーなもののCafeのHPを作っていこうと思います日目の作業内容・テーブルの追加とそれに伴うコントローラーの作成日目の気になった箇所indexhtmlerbltsamplenameさんgt書き方合ってるはずなのになんで全部文字列判定されるの仮説書き方自体に問題はないので他に問題がある。 2021-07-17 19:17:16
海外TECH Ars Technica Facebook catches Iranian spies catfishing US military targets https://arstechnica.com/?p=1780872 hospitality 2021-07-17 10:45:50
海外TECH DEV Community JavaScript : Arrays https://dev.to/vivekalhat/javascript-arrays-4mkc JavaScript ArraysVariables can store only a single value at a time but what if you want to store multiple items at the same time It is not efficient to create separate variables to store each item right In JavaScript we can store multiple items together using an array An array is just a list like structure or a container that is used to store multiple elements irrespective of the data type In JavaScript you can create an array as given below let items Apples Bananas Purple true false An array is just a variable that stores a list In the above line we have created an items variable that contains a list of items All the items inside the array have different data types You can create an array of strings numbers boolean objects or a combination of multiple types An array does not care about the type of data that is stored inside it You can also create an array that contains another array such as let items Apples Bananas The syntax for creating an arraylet const var arrayName An array name should not begin with a number An array is created using square brackets Accessing elements from an arrayArrays are zero indexed It means that the first element inside an array is stored at index the second element is stored at index and so on If you want to access the third element then you can do it by using the following expression let items let thirdElement items Now the thirdElement variable contains the value To access an element from the array you have to specify the index of the element inside the square brackets i e arrayName index Since the array is a list like structure you can use loops to access all elements from the array To get the length of an array you can use the length property of an array i e array length forEach looplet items items forEach item gt console log item for each loop is used to access each element present inside the array for looplet items for let i i lt items length i console log items i The above loop will print each item to the console items length contains the value because array contains elements hence the loop will run until the value of i is less than Modifying array elementsWe have seen how to create and access array elements You can also modify the elements inside the array let items Suppose you want to modify the value of the third element and replace it with You can do it by items Now the array will be In this way you can reassign a value to any index inside the array This property of an array is called mutability It means that you can modify the elements inside the array Array Methodslet items get length of an arrayconsole log items length prints add and remove elements from the end of the array push adds element at the end of the array pop removes element from the end of the array add element at the end of an arrayitems push returns items push returns At this point items remove element from the end of an arrayitems pop returns let removedValue items pop console log removedValue prints At this point items check if element is present inside array or notconsole log items includes prints falseconsole log items includes prints true find index of array elements indexOf returns index of the first occurrence of the element lastIndexOf returns index of the last occurrence of the element let box pen pencil eraser pen pen console log box indexOf pen prints console log box lastIndexOf pen prints add and remove elements from the beginning of the array shift removes the first element from the array unshift add element at the beginning of the array let items items shift returns items unshift returns sort sorts an array in increasing order to sort array in decreasing order you have to pass comparison function to the sort syntax array sort let items items sort returns sort in decreasing orderlet items items sort a b gt if a lt b return else if a gt b return else return returns slice returns a portion of array without modifying the array syntax slice start end slice start slice does not return element present at the end index specified let items console log items slice returns console log items slice returns You can learn more about array methods here 2021-07-17 10:43:13
海外TECH DEV Community 💪🏻🏋🏻‍♂️Create your own Exercise Planner using React.js [Complete Code] https://dev.to/thenerdydev/create-your-own-exercise-planner-using-react-js-complete-code-2knb ‍ ️Create your own Exercise Planner using React js Complete Code Hey everyone In this article let us see how we can build an Exercise Planner Application using React js Demo for the Project amp Initial Setup So the first thing you need to do is to create a new project Make sure to install Node js onto your system because we will be needing that for our project We will be using this tool for creating a new React Project Create React App Install Node js Create a new React Project To create a new React Project npx create react app lt project name gt cd lt project name gt To run the project npm start Install React Router DOM packagenpm install react router dom Install JSON server package globallyWe will be using JSON server for our project npm install json server g Create a new file exercises jsonThis is the file that will contain all the exercises that we will be needing in this application This file will serve as a local JSON store for our application store data json exercises title Pushups details Pushups are beneficial for building upper body strength They work the triceps pectoral muscles and shoulders When done with proper form they can also strengthen the lower back and core by engaging pulling in the abdominal muscles complete false id Inside a new terminal run the json server by running the commandjson server g src store data json watch port Complete Code ‍ index jsimport React from react import ReactDOM from react dom import index css import App from App import reportWebVitals from reportWebVitals import BrowserRouter from react router dom ReactDOM render lt React StrictMode gt lt BrowserRouter gt lt App gt lt BrowserRouter gt lt React StrictMode gt document getElementById root If you want to start measuring performance in your app pass a function to log results for example reportWebVitals console log or send to an analytics endpoint Learn more reportWebVitals App jsximport Switch Route from react router dom import HomePage from pages HomePage import App css import CreateExercise from pages CreateExercise import Navbar from components Navbar import EditExercise from pages EditExercise function App return lt div className App gt lt Navbar gt lt Switch gt lt Route path home exact gt lt HomePage gt lt Route gt lt Route path create exercise exact gt lt CreateExercise gt lt Route gt lt Route path exercises id edit gt lt EditExercise gt lt Route gt lt Switch gt lt div gt export default App App css App text align center index csshtml pink D golden goldenrod green rgba text shadow px px rgba font size font family apple system BlinkMacSystemFont Segoe UI Roboto Oxygen Ubuntu Cantarell Open Sans Helvetica Neue sans serif box sizing border box before after box sizing inherit body font size rem line height background image url data image svg xml csvg xmlns version xmlns xlink xmlns svgjs width height preserveAspectRatio none viewBox e cg mask url quot b SvgjsMask quot b fill none e crect width height x y fill ea e c rect e cpath d M a z stroke e e c path e cpath d M L L L z stroke bb e c path e cpath d M a a z fill e e c path e cpath d M a z stroke bb e c path e cpath d M a a z stroke db e c path e cpath d M L L L z stroke db e c path e cpath d M L L L z fill db e c path e cpath d M L L L z fill db e c path e cpath d M a a z stroke db e c path e cpath d M L L L z fill e e c path e cpath d M L L L z stroke bb e c path e cpath d M a z stroke e e c path e cpath d M a a z stroke bb e c path e cpath d M L L L z fill e e c path e cpath d M a a z stroke db e c path e cpath d M a z stroke e e c path e cpath d M L L L z fill db e c path e cpath d M L L L z fill e e c path e cpath d M a z fill e e c path e cpath d M a z stroke bb e c path e cpath d M a a z stroke db e c path e cpath d M a z stroke e e c path e cpath d M L L L z stroke db e c path e cpath d M a a z fill db e c path e cpath d M L L L z fill e e c path e cpath d M L L L z stroke e e c path e cpath d M a z fill bb e c path e cpath d M L L L z fill e e c path e cpath d M a a z stroke bb e c path e cpath d M a a z fill bb e c path e cpath d M L L L z fill db e c path e cpath d M a z fill db e c path e cpath d M L L L z stroke e e c path e c g e cdefs e cmask id SvgjsMask e crect width height fill white e c rect e c mask e c defs e c svg e focus outline color var pink Components components BaseFilter css filter nav button background none border none color bbb outline none font size px text transform uppercase margin right px letter spacing px font weight bold cursor pointer filter nav button active color goldenrod components BaseFilter jsximport React from react import BaseFilter css const BaseFilter props gt lt nav className filter nav gt lt button onClick gt props onUpdate all className props current all active gt View all lt button gt lt button onClick gt props onUpdate completed className props current completed active gt Completed lt button gt lt button onClick gt props onUpdate pending className props current pending active gt Pending lt button gt lt nav gt export default BaseFilter components ExerciseItem jsximport React from react import Link from react router dom import ExerciseItem css function ExerciseItem props const performExerciseDeletion gt fetch http localhost exercises props exercise id method DELETE then gt props onDeleteExercise props exercise id catch err gt console log err const performExerciseCompletion gt fetch http localhost exercises props exercise id method PATCH headers Content Type application json body JSON stringify complete props exercise complete then gt props onCompleteExercise props exercise id catch err gt console log err const classes exercise if props exercise complete classes push complete return lt div className classes join gt lt div className actions gt lt h gt props exercise title lt h gt lt div className buttons gt lt button onClick performExerciseDeletion gt Delete lt button gt lt Link to exercises props exercise id edit gt Edit lt Link gt lt button onClick performExerciseCompletion gt Toggle lt button gt lt div gt lt div gt lt div className details gt lt p gt props exercise details lt p gt lt div gt lt div gt export default ExerciseItem components ExerciseItem css exercise margin px auto background white padding px px border radius px box shadow px px rgba border left px solid var pink exercise hover box shadow px px rgba h cursor pointer actions display flex justify content space between align items center exercise complete border left px solid var green buttons display flex flex direction column buttons button a color white background var pink padding rem border border px solid transparent text decoration none font weight font size rem margin bottom px border radius px buttons button hover a hover button active a active background rgb h transform skew deg background var golden components ExercisesList css exercises list font family Avenir Helvetica Arial sans serif webkit font smoothing antialiased moz osx font smoothing grayscale max width px margin auto color components ExercisesList jsximport React from react import ExerciseItem from ExerciseItem import ExercisesList css function ExercisesList props if props exercises length return null return lt div className exercises list gt props exercises map exercise gt lt ExerciseItem key exercise id exercise exercise onCompleteExercise props onCompleteExercise onDeleteExercise props onDeleteExercise gt lt div gt export default ExercisesList components Navbar css main nav text align center margin px auto main nav a display inline block text decoration none margin px color goldenrod font size px active style border bottom px solid goldenrod padding bottom px components Navbar jsximport React from react import Navbar css import NavLink from react router dom function Navbar return lt nav className main nav gt lt NavLink activeClassName active style to home gt Home lt NavLink gt lt NavLink activeClassName active style to create exercise gt Create Exercise lt NavLink gt lt nav gt export default Navbar Pages Views Create a folder for pages where we will house all our page components pages HomePage jsximport React useState useEffect from react import BaseFilter from components BaseFilter import ExercisesList from components ExercisesList const HomePage gt const exercises setExercises useState const currentFilter setCurrentFilter useState all const updateFilterHandler newFilter gt setCurrentFilter newFilter const deleteExerciseHandler function id const patchedExercises exercises filter exercise gt exercise id id setExercises patchedExercises const completeExerciseHandler function id const clonedExercises exercises const currentExerciseIndex clonedExercises findIndex exercise gt exercise id id const currentExercise clonedExercises currentExerciseIndex currentExercise complete currentExercise complete setExercises clonedExercises useEffect gt try const response await fetch http localhost exercises const fetchedExercises await response json console log fetchedExercises setExercises fetchedExercises catch error console log error fetchExercises let jsx lt ExercisesList exercises exercises onCompleteExercise completeExerciseHandler onDeleteExercise deleteExerciseHandler gt if currentFilter completed jsx lt ExercisesList exercises exercises filter exercise gt exercise complete onCompleteExercise completeExerciseHandler onDeleteExercise deleteExerciseHandler gt else if currentFilter pending jsx lt ExercisesList exercises exercises filter exercise gt exercise complete onCompleteExercise completeExerciseHandler onDeleteExercise deleteExerciseHandler gt return lt div gt lt BaseFilter onUpdate updateFilterHandler current currentFilter gt jsx lt div gt export default HomePage pages CreateExercise cssform padding px border radius px text align center label display block color goldenrod text transform uppercase font size px font weight bold letter spacing px margin px px input padding px width px max width box sizing border box border px solid var grey textarea padding px max width width px box sizing border box border px solid var grey form button display block margin px auto background goldenrod color white padding px border radius px font size px border px solid transparent pages CreateExercise jsximport React useState from react import CreateExercise css import useHistory from react router dom const CreateExercise gt const exercise setExercise useState title details const history useHistory const handleChange event gt setExercise exercise event target name event target value const handleExerciseCreation event gt event preventDefault const newExercise title exercise title details exercise details complete false id Math floor Math random console log newExercise fetch http localhost exercises method POST headers Content Type application json body JSON stringify newExercise then gt history push home catch err gt console log err return lt form onSubmit handleExerciseCreation gt lt label gt Title lt label gt lt input type text onChange handleChange name title value exercise title maxLength required gt lt label gt Details lt label gt lt textarea value exercise details name details onChange handleChange required gt lt textarea gt lt button gt Add Exercise lt button gt lt form gt export default CreateExercise pages EditExercise jsximport React useState useEffect from react import CreateExercise css import useHistory useParams from react router dom const EditExercise gt const exercise setExercise useState title details const params useParams const exerciseId params id const history useHistory const handleChange event gt setExercise exercise event target name event target value useEffect gt fetch http localhost exercises exerciseId then res gt res json then data gt setExercise title data title details data details catch err gt console log err exerciseId const handleExerciseUpdation event gt event preventDefault fetch http localhost exercises exerciseId method PATCH headers Content Type application json body JSON stringify exercise then gt history push home catch err gt console log err return lt form onSubmit handleExerciseUpdation gt lt label gt Title lt label gt lt input type text onChange handleChange name title value exercise title maxLength required gt lt label gt Details lt label gt lt textarea value exercise details name details onChange handleChange required gt lt textarea gt lt button gt Update Exercise lt button gt lt form gt export default EditExercise So this is the code for our entire project PS If you prefer learning React with a video I do have a video on same where we create this exact project Check this Thanks for reading PS If you are looking to learn Web Development I have curated a FREE course for you on my YouTube Channel check the below article Web Developer Full Course HTML CSS JavaScript Node js and MongoDB The Nerdy Dev・Apr ・ min read html css node javascript Follow me on Twitter Check out my YouTube Channel 2021-07-17 10:37:54
海外TECH DEV Community Temperature Monitoring using Python https://dev.to/mayankpathak/temperature-monitoring-using-python-1bg5 Temperature Monitoring using PythonHello guys so this post is going to be super excited and useful for those who are trying to find and implement some basic projects to increase and upscale their technical skills and knowledge Here is one of the simple projects which I did during my college project season and it is super useful and easy to implement with basic knowledge of python and some of the technical tools you can try out this project and can also list it to your Resume or CV you can also take this project and show to your project s coordinator during your project season What s the Project About The project is about the Temperature Monitoring where we will monitor the temperature of a closed environment for example like a closed room Since Environment temperature should be a comfortable one where the people can work comfortably and can go up to their efficiency and can work comfortably whether it is machinery or manpower One of important factors that are needed be monitored is the temperature and humidity of the room because if any one of the two goes mismatching it creates an unpleasing and uncomfortable environment Where it can be useful This project has so many uses from a real time perspective let me list some of the uses It can be useful in a room where s temperature needs to be in between certain range A factory or industry where people cannot present at all the time and there s temperature need to be fixed between certain range While transporting some of the goods where they need to be in certain temperature range with limited power supply Hence these are some of the useful parts of the project where it can be implemented with full control over the temperature and best results Let s know the Project in DetailControlling temperature of a controlled environment is an important aspect of any workspace whether it is a commercial space or a domestic space If temperature or humidity is either increased or decreased of any area it becomes very difficult to be there and thus if possible should be kept in comfortable conditions at all times One way to do it is to monitor and control the temperature of the closed surroundings using the concepts of Machine Learning and IoT This research s purpose is the same to find an easy and an inexpensive way to find an alternative to it which is based on microcontroller a Wi Fi Module Buzzer few Temperature sensors and a Solderless board The system is designed in such a way that the temperature can be monitored whether it is in the given range of temperature as prescribed by the user We are also enabling to predict the temperature which will predict the temperature according to the temperature graph being made as by the input taken by the Temperature Sensors using Polynomial Regression Algorithm Also if the temperature of the enclosed area is not in the threshold range as suggested by the user the System will automatically send a notification to user s via SMS E Mail or even through a Telegram Channel Note To do this project completely you will need some technical tools and access to some of the software and online services Introduction The main scope of this project is to measure the temperature of a closed environment let s say we want to measure the temperature of a room Basically a range is fixed that is the minimum and maximum temperature values are fixed and if the measured value is not in this range then the system alarms and sends a notification to the user s device through SMS email telegram etc Components required to work the project Bolt WiFi Module microcontroller LED generic Buzzer to alarm the area Jumper wires generic LM temperature sensor Breadboard generic We are using Z Score analysis which also help in detecting the anomaly of the temperature sensor which means a variable s value going beyond a certain range of values upper and lower bound These bound can be calculated using input values frame size and multiplication factor where frame size is minimum number of input values needed for Z Score analysis and these predictions as well as the old values all will be plotted on a graph which the user can easily understand what could be the next game of plan So we going to use a formula to find any kind of anomaly that can happen in the proposed system So in the above listed formula r Frame Size C Multiplication factor To do so and implement the project you have to register at a platform called Twilio this will help us to get the notification on the device Creating amp Setting up an account on TwilioTwilio is a rd party PaaS Platform as a Software company that provides cloud communication It uses web APIs to make calls and send and receive messages to registered mobile numbers The following gives step by step instructions to create a Twilio account URL Go to Sign up You will find the welcome page Here click on the Sign up for free option Basic steps include Register gt confirm mobile number gt setup required function to carry out gt Configure the file with the required private fieldsAfter this follow the steps as asked from verification till the project creation and in the project section ask to send notification to your device on the Twilio platform You can refer this guide if you encounter any problems but make sure to go for only free access option during Signup Twilio Guide ‍Codes to implement the ProjectMake sure to change the configurations and confidentials with yours before implementing the project Config code py This code is used to config the Twillio with the device configurations and credential fileapi key XXXXXX Enter your API Key used in Twillio Appdevice id BOLTXXXXXXX Enter the device id i e the Bolt Idtelegram chat id XXXXXXX telegram bot id botXXXXXXXX threshold Change the threshold values according to your environmentframe size mul factor Main code py This code helps in main working and running of the set up import conf json time math statistics requestsfrom boltiot import Boltdef compute bounds history data frame size factor if len history data lt frame size return None if len history data gt frame size del history data len history data frame size Mn statistics mean history data Variance for data in history data Variance math pow data Mn Zn factor math sqrt Variance frame size High bound history data frame size Zn Low bound history data frame size Zn return High bound Low bound mybolt Bolt conf api key conf device id history data def send telegram message message url conf telegram bot id sendMessage data chat id conf telegram chat id text message try response requests request POST url params data print This is the Telegram response print response text telegram data json loads response text return telegram data ok except Exception as e print An error occurredin sending the alert message via Telegram print e return Falsedef buzzer alert high response mybolt digitalWrite HIGH print high response time sleep low response mybolt digitalWrite LOW print low response time sleep def check temperature value checker if value gt conf threshold print The temperaure value increased the threshold value Sending an alert notification message Temperature increased the threshold value The current value is str int sensor value telegram status send telegram message message print This is the Telegram status telegram status if not checker return buzzer alert if checker return if value lt conf threshold print The temperature value decreased below the threshold value Sending an alert notification message Temperature decreased below the threshold value The current value is str int sensor value telegram status send telegram message message print This is the Telegram status telegram status if not checker return buzzer alert if checker return if value gt conf threshold and value lt conf threshold print The temperature value is between str int conf threshold and str int conf threshold Sending an alert notification message Temperature is between str int conf threshold and str int conf threshold Check prediction table The current value is str int sensor value telegram status send telegram message message print This is the Telegram status telegram status if not checker return buzzer alert if checker return if value gt conf threshold and value lt conf threshold if not checker time sleep if checker return while True checker False response mybolt analogRead A data json loads response if data success print There was an error while retriving the data print This is the error data value time sleep continue print This is the value data value sensor value try sensor value int data value except e print There was an error while parsing the response e continue bound compute bounds history data conf frame size conf mul factor if not bound required data count conf frame size len history data print Not enough data to compute Z score Need required data count more data points history data append int data value check temperature sensor value checker continue try if sensor value gt bound print The temperature value increased suddenly Sending an alert notification message Temperature increased suddenly The current value is str int sensor value telegram status send telegram message message print This is the Telegram status telegram status buzzer alert checker True elif sensor value lt bound print The temperature value decreased suddenly Sending an alert notification message Temperature decreased suddenly The current value is str int sensor value telegram status send telegram message message print This is the Telegram status telegram status buzzer alert checker True check temperature sensor value checker history data append sensor value except Exception as e print error e Pediction code py This code helps in Predicting future instance values Shows up the different Plots and can able to make comparisions setChartLibrary google chart setChartTitle Polynomial Regression setChartType predictionGraph setAxisName time stamp temp mul setAnimation true setCrosshair true plotChart time stamp analog Resulted Part of the Project is shown as Images Screenshot of Notification received on the connected device Prediction of the future Instance is shown in below Provided Image Paper work is available at visit to read and completely understand the logic and working process of the project The IJEAT JournalYou can download the paper and view it by Clicking here Conclusion of the ProjectThe project work is mainly to calculate the temperature of a closed environment and sends notification to the connected device through SMS Mail Telegram etc only if the temperature of the region varies i e either the temperature increases or the temperature decreases The system is also capable of displaying temperature humidity and predicted temperature in real time through web based application or through a Telegram Channel For Alerts the system can send it through SMS E Mail or through a Telegram Channel Hope that some of you try to implement the project and if done then drop your experience in the comment section This is just the overview of the project to understand it correctly and know more about it visit the Github RepositoryThank you for Reading would Love to hear your valuable feedback If anything is confusing or incorrect then let me know in the comment section Thanks from my side this is Mayank keep learning and exploring Let s Connect Twitter Linkedin 2021-07-17 10:33:22
海外TECH DEV Community Backing up Appwrite to Backblaze https://dev.to/meldiron/backup-appwrite-to-backblaze-476n Backing up Appwrite to Backblaze Table Of ContentsIntroductionGetting Backblaze secretsB CLI basicsAppwrite MariaDB BackblazeAppwrite Docker Volumes Backblaze Introduction Recently Appwrite has released an article on how to backup and restore all data on your production server You can read it here Appwrite In Production Backups and Restores Bradley Schofield for Appwrite・Jul ・ min read webdev opensource devops tutorial This article got me thinking Sure you can backup most MySQL databases into a simple backup sql file but what if you have multiple massive projects inside Appwrite Your disk storage may or may not be able to hold a backup of all Appwrite volumes Additionally you most likely need to backup periodically and need multiple versions of the backup So what are your options Write a complex bash script to keep last three versionsThrow all backups to a storage provider and let them take care of itYou should go with storage providers not only because they have a retention system already in place also due to their experience in the field as they most likely care about security a lot and use raids to ensure your data won t get lost I wrote this article as I was implementing this on my own production server and I will show you everything you need to know about backing up Appwrite into Backblaze Getting Backblaze secrets First things first what is Backblaze Backblaze is one of the most if not most used commercial platform to backup your data for the lowest price possible They provide solutions to backup your personal computer or your business data The service we will be using is B Cloud Storage as this gives our flexibility just like an actual hard drive You don t have to worry about pricing yet because their free plan gives you GB of free space To learn more about this product and its pricing you can take a look at Over one exabyte of data storage under management and counting Backblaze websiteAfter creating an account and logging in make sure to confirm your email Backblaze may ask you to set up FA using your phone number for additional security To use Backblaze from our server we will need BUCKET NAMEACCESS KEY IDAPPLICATION KEYBackblaze uses buckets to store your data In our case we will only need one bucket as we will only back up two or three files at most MySQL database and Appwrite Docker volumes To create a bucket navigate to Bucket and press Create a Bucket Give it some name such as appwrite and click Create a Bucket again You should see a newly created bucket on your list Make sure to mark your Bucket Name as we will need this later If you enter App Keys you can Add a New Application Key For simplicity we will ignore that and we will use our master key to have all permissions Simply click Generate a New Master Application Key and this should give you keyID and applicationKey Wohoo we have all secrets we need let s continue B CLI basics To make sure everything is working let s try some simple action on B List files in a bucketUpload a fileList files againWe need to have B CLI installed on our machine but this can be easily avoided thanks to a Docker image mtronix b cli This is the only image I could find that was actually working To list all files in our bucket we run docker run rm mtronix b cli bash c b authorize account lt ACCESS KEY ID gt lt ACCESS KEY ID gt amp amp b list file names lt BUCKET NAME gt The output should be an empty list of files files nextFileName null Let s upload a file We need to have a file I downloaded a cute cat image and saved it as cat png To upload the file I run docker run rm v PWD b mtronix b cli bash c b authorize account lt ACCESS KEY ID gt lt ACCESS KEY ID gt amp amp b upload file lt BUCKET NAME gt cat png cat png The successful result should look something like action upload fileId zdacdadba ffeca d m c v t fileName cat png size uploadTimestamp Finally run the list file names command from above again and you should see your file in the array of files files accountId acd action upload bucketId dacdadba contentLength Backblaze let you do all of this function manually on their website Exercise for you Remove our test file from the bucket Do it however you want you can remove it using B CLI or manually on the website Appwrite MariaDB Backblaze To create an Appwrite MariaDB backup you run this command docker compose exec mariadb sh c exec mysqldump all databases add drop database u MYSQL USER p MYSQL ROOT PASSWORD gt dump sql Source Appwrite article mentioned earlier To backup this export into Backblaze I created a script that Export MariaDB data to dump sqlUpload dump sql to BackblazeRemove dump sql to free up the space on the machineThis is what the script looks like docker compose exec mariadb sh c exec mysqldump all databases add drop database u MYSQL USER p MYSQL ROOT PASSWORD gt dump sql docker run rm v PWD b mtronix b cli bash c b authorize account lt ACCESS KEY ID gt lt ACCESS KEY ID gt amp amp b upload file lt BUCKET NAME gt dump sql dump sql rm dump sqlEach time you run this script it will backup your MariaDB database into Backblaze Backblaze can store multiple versions of a single file just make sure to configure retention on a bucket for example days Appwrite Docker Volumes Backblaze Once again let s get our base command from Appwrite s article Before running these commands is it highly recommended to shut down your Appwrite instance to ensure you get a complete backup mkdir p backup amp amp docker run rm volumes from docker compose ps q appwrite v PWD backup backup ubuntu bash c cd storage uploads amp amp tar cvf backup uploads tar mkdir p backup amp amp docker run rm volumes from docker compose ps q appwrite v PWD backup backup ubuntu bash c cd storage functions amp amp tar cvf backup functions tar These two commands will backup two different volumes The first one back up all files in Appwrite storage while the second one backup your function tags Let s start with backing up uploads Just like with MariaDB we will Create a backup in backup uploads tarSend the file to BackblazeRemove the backup fileThe full command to do this is mkdir p backup amp amp docker run rm volumes from docker compose ps q appwrite v PWD backup backup ubuntu bash c cd storage uploads amp amp tar cvf backup uploads tar docker run rm v PWD b mtronix b cli bash c b authorize account lt ACCESS KEY ID gt lt ACCESS KEY ID gt amp amp b upload file lt BUCKET NAME gt backup uploads tar upload backup tar rm dump sqlThis should create a file called upload backup tar in your Backblaze bucket Exercise time You will need to backup Appwrite functions too Using all knowledge from this article you should be able to prepare a command that will do it If you are here only to copy amp paste commands here is the command Command to backup Appwrite function to Backblaze mkdir p backup amp amp docker run rm volumes from docker compose ps q appwrite v PWD backup backup ubuntu bash c cd storage functions amp amp tar cvf backup functions tar docker run rm v PWD b mtronix b cli bash c b authorize account lt ACCESS KEY ID gt lt ACCESS KEY ID gt amp amp b upload file lt BUCKET NAME gt backup functions tar upload functions tar rm dump sqlThat s it I hope this article helped you backing up your Appwrite server If you have any questions feel free to join Appwrite s Discord server and chat with their amazing community 2021-07-17 10:28:31
ニュース BBC News - Home Covid: Fully jabbed arrivals from France must still quarantine https://www.bbc.co.uk/news/uk-57869880 covid 2021-07-17 10:18:34
LifeHuck ライフハッカー[日本版] 投資と投機の違い、正しく答えられますか? https://www.lifehacker.jp/2021/07/the-difference-between-investing-and-speculating-and.html 違い 2021-07-17 20:00:00
LifeHuck ライフハッカー[日本版] 【Amazonタイムセール祭り】塗って拭き取るだけの除毛クリームが2,533円、クリニカのデンタルフロスが31%オフとお買い得 https://www.lifehacker.jp/2021/07/amazon-timesale-fes-2021-0717-3.html 【Amazonタイムセール祭り】塗って拭き取るだけの除毛クリームが円、クリニカのデンタルフロスがオフとお買い得Amazonアマゾンでは、年月日時から月日時分まで「Amazonタイムセール祭り」を開催中です。 2021-07-17 19:45:00
北海道 北海道新聞 野沢が首位、稲見5位に浮上 ゴルフ、GMOサマンサ第2日 https://www.hokkaido-np.co.jp/article/568241/ 首位 2021-07-17 19:15:24
北海道 北海道新聞 LGBT当事者、聖火掲げる 東京9日目しょこたん登場 https://www.hokkaido-np.co.jp/article/568278/ 東京五輪 2021-07-17 19:15:00
北海道 北海道新聞 二階氏、中曽根氏への支持訴え 群馬1区、公認争い激化 https://www.hokkaido-np.co.jp/article/568277/ 中曽根康隆 2021-07-17 19:15:00
北海道 北海道新聞 ソフトボール日本、練習一部公開 男子投手の球を打ち込む https://www.hokkaido-np.co.jp/article/568273/ 日本代表 2021-07-17 19:13:00
北海道 北海道新聞 駐韓公使の発言、外交問題に 韓国側は再発防止要求、送還論も https://www.hokkaido-np.co.jp/article/568272/ 不適切発言 2021-07-17 19:13:00
北海道 北海道新聞 釧路管内 1人感染 新型コロナ https://www.hokkaido-np.co.jp/article/568271/ 新型コロナウイルス 2021-07-17 19:02:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)